Skip to content

Conversation

@Villosse
Copy link
Contributor

@Villosse Villosse commented Jan 6, 2026

Fixes #1210
Adds the test from issue 1210 and adjust the error thrown.

Before:

issue-1210.rs:12:18: error: expecting '}' but ',' found
   12 |             y = 1,
      |                  ^
issue-1210.rs:12:18: error: error may be from having an expression (as opposed to statement) in the body of the function but not last
issue-1210.rs:14:9: error: failed to parse expr in match arm in match expr
   14 |         E::Two => {
      |         ^

After:

issue-1210.rs:12:18: error: expected ‘;’ or ‘}’ after expression, found ‘,’
   12 |             y = 1, // { dg-error "expected .;. or .\}. after expression, found .,." "" {target *-*-*} 0 }
      |                  ^

@Villosse Villosse changed the title 1210 Adds test from issue 1210 and correct error thrown Jan 6, 2026
Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Just a quick nitpick on the comment and it's all good IMO

Removes duplicate error in block expression parsing.
Removes cascading error in match arm parsing.
Adds proper error detection for unterminated expression.

Fixes Rust-GCC#1210

gcc/rust/ChangeLog:

	* parse/rust-parse-impl-expr.hxx: Removes duplicate errors.
	* parse/rust-parse-impl.hxx: Detects when an expression without
	block is not properly terminated

Signed-off-by: lenny.chiadmi-delage <[email protected]>
Adds new test.

Fixes Rust-GCC#1210

gcc/testsuite/ChangeLog:

	* rust/compile/issue-1210.rs: New test.

Signed-off-by: lenny.chiadmi-delage <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parser ICE on syntax error in match arm block

2 participants