diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2025-05-09 22:17:55 -0400 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2025-05-13 09:29:13 +0000 |
commit | dceaabbe556051101ef1c39b5a323ca7d5bf2f1e (patch) | |
tree | 421ef6afe7afa8ca838aa9b8d0f6c5ded921c6d8 /gcc/rust | |
parent | f33bae65a16b6d8c9d4f491638c4728f9c231ed4 (diff) | |
download | gcc-dceaabbe556051101ef1c39b5a323ca7d5bf2f1e.zip gcc-dceaabbe556051101ef1c39b5a323ca7d5bf2f1e.tar.gz gcc-dceaabbe556051101ef1c39b5a323ca7d5bf2f1e.tar.bz2 |
Fix Attr metavariable binding
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h
(Parser::parse_attr_input): Handle more delimeter tokens and the
END_OF_FILE token.
(Parser::skip_after_end_attribute): Handle the END_OF_FILE
token.
gcc/testsuite/ChangeLog:
* rust/compile/macros/mbe/meta-param.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust')
-rw-r--r-- | gcc/rust/parse/rust-parse-impl.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index e165998..bbe75ad 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -877,7 +877,10 @@ Parser<ManagedTokenSource>::parse_attr_input () return attr_input_lit; } break; + case RIGHT_PAREN: case RIGHT_SQUARE: + case RIGHT_CURLY: + case END_OF_FILE: // means AttrInput is missing, which is allowed return nullptr; default: @@ -11911,7 +11914,7 @@ Parser<ManagedTokenSource>::skip_after_end_attribute () { const_TokenPtr t = lexer.peek_token (); - while (t->get_id () != RIGHT_SQUARE) + while (t->get_id () != RIGHT_SQUARE && t->get_id () != END_OF_FILE) { lexer.skip_token (); t = lexer.peek_token (); |