]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Handle underscore in MacroMatch.
authorOwen Avery <powerboat9.gamer@gmail.com>
Fri, 7 Apr 2023 20:47:54 +0000 (16:47 -0400)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:28:47 +0000 (18:28 +0100)
gcc/rust/ChangeLog:

* parse/rust-parse-impl.h
(Parser::parse_macro_match): Handle underscore.

gcc/testsuite/ChangeLog:

* rust/compile/macro51.rs: New test.

gcc/rust/parse/rust-parse-impl.h
gcc/testsuite/rust/compile/macro51.rs [new file with mode: 0644]

index 67c4f6a3fabdc3bceebe9c7505b3714e80cc71ba..c48c71f6ca33a55b4f7ba7204819887ca6f9b669 100644 (file)
@@ -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 (file)
index 0000000..6659486
--- /dev/null
@@ -0,0 +1,3 @@
+macro_rules! test {
+    ($_:ident) => {""}
+}