public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Handle underscore in MacroMatch.
@ 2023-04-18 16:45 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-04-18 16:45 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:37d4fa770ff751381db8f4fe225bf9e4ec22be56

commit 37d4fa770ff751381db8f4fe225bf9e4ec22be56
Author: Owen Avery <powerboat9.gamer@gmail.com>
Date:   Fri Apr 7 16:47:54 2023 -0400

    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:
---
 gcc/rust/parse/rust-parse-impl.h      | 1 +
 gcc/testsuite/rust/compile/macro51.rs | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index a7ed23e4c4b..d7eebc25ecf 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 00000000000..6659486d268
--- /dev/null
+++ b/gcc/testsuite/rust/compile/macro51.rs
@@ -0,0 +1,3 @@
+macro_rules! test {
+    ($_:ident) => {""}
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-18 16:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-18 16:45 [gcc/devel/rust/master] Handle underscore in MacroMatch Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).