diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2023-04-07 16:47:54 -0400 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:28:47 +0100 |
commit | cd73752ad6df6dde49323e0d5facb87dce70fff1 (patch) | |
tree | d3fe787ce5ebe557d883d6b3707a7a33d1a002ea /gcc | |
parent | e7312c67a713ff2686b11d689b11eb94d5a88581 (diff) | |
download | gcc-cd73752ad6df6dde49323e0d5facb87dce70fff1.zip gcc-cd73752ad6df6dde49323e0d5facb87dce70fff1.tar.gz gcc-cd73752ad6df6dde49323e0d5facb87dce70fff1.tar.bz2 |
gccrs: Handle underscore in MacroMatch.
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h
(Parser::parse_macro_match): Handle underscore.
gcc/testsuite/ChangeLog:
* rust/compile/macro51.rs: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/parse/rust-parse-impl.h | 1 | ||||
-rw-r--r-- | gcc/testsuite/rust/compile/macro51.rs | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index 67c4f6a..c48c71f 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -2081,6 +2081,7 @@ Parser<ManagedTokenSource>::parse_macro_match () case WHILE: case YIELD: case IDENTIFIER: + case UNDERSCORE: // macro fragment return parse_macro_match_fragment (); case LEFT_PAREN: diff --git a/gcc/testsuite/rust/compile/macro51.rs b/gcc/testsuite/rust/compile/macro51.rs new file mode 100644 index 0000000..6659486 --- /dev/null +++ b/gcc/testsuite/rust/compile/macro51.rs @@ -0,0 +1,3 @@ +macro_rules! test { + ($_:ident) => {""} +} |