diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2023-04-07 16:47:54 -0400 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2023-04-14 07:35:37 +0000 |
commit | 37d4fa770ff751381db8f4fe225bf9e4ec22be56 (patch) | |
tree | 631fa9525e861db8e08941914705bfd94c981c75 | |
parent | 47b92ff1835ea0aa27c490600c40ae2ddb8681a1 (diff) | |
download | gcc-37d4fa770ff751381db8f4fe225bf9e4ec22be56.zip gcc-37d4fa770ff751381db8f4fe225bf9e4ec22be56.tar.gz gcc-37d4fa770ff751381db8f4fe225bf9e4ec22be56.tar.bz2 |
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.
-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 a7ed23e..d7eebc2 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) => {""} +} |