From: Owen Avery Date: Fri, 7 Apr 2023 20:47:54 +0000 (-0400) Subject: gccrs: Handle underscore in MacroMatch. X-Git-Tag: basepoints/gcc-15~2666 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cd73752ad6df6dde49323e0d5facb87dce70fff1;p=thirdparty%2Fgcc.git 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. --- diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index 67c4f6a3fabd..c48c71f6ca33 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -2081,6 +2081,7 @@ Parser::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 000000000000..6659486d2682 --- /dev/null +++ b/gcc/testsuite/rust/compile/macro51.rs @@ -0,0 +1,3 @@ +macro_rules! test { + ($_:ident) => {""} +}