Skip to content

parser: Parse reference patterns correctly#2138

Merged
CohenArthur merged 1 commit into
Rust-GCC:masterfrom
CohenArthur:fix-1807
Apr 21, 2023
Merged

parser: Parse reference patterns correctly#2138
CohenArthur merged 1 commit into
Rust-GCC:masterfrom
CohenArthur:fix-1807

Conversation

@CohenArthur

Copy link
Copy Markdown
Member

Reference patterns cannot contain AltPatterns per the Rust reference,
so we should not call into parse_pattern to parse the referenced pattern,
but rather the more restrictive parse_pattern_no_alt.

gcc/rust/ChangeLog:

* parse/rust-parse-impl.h (Parser::parse_reference_pattern): Do not
call into `parse_pattern` anymore.

gcc/testsuite/ChangeLog:

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

Fixes #1807

Reference patterns cannot contain AltPatterns per the Rust reference,
so we should not call into `parse_pattern` to parse the referenced pattern,
but rather the more restrictive `parse_pattern_no_alt`.

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h (Parser::parse_reference_pattern): Do not
	call into `parse_pattern` anymore.

gcc/testsuite/ChangeLog:

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

@philberty philberty left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM raise an issue with the error you get compiling without -fsyntax-only

@P-E-P P-E-P left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@CohenArthur

Copy link
Copy Markdown
Member Author

LGTM raise an issue with the error you get compiling without -fsyntax-only

good point, thanks :) #2142

@CohenArthur CohenArthur added this pull request to the merge queue Apr 21, 2023
Merged via the queue into Rust-GCC:master with commit 82e26f8 Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Parsing issues on closure parameters and return type

3 participants