[gcc r14-7322] gccrs: parser: Add RestPattern parsing

Arthur Cohen cohenarthur@gcc.gnu.org
Tue Jan 16 17:22:32 GMT 2024


https://gcc.gnu.org/g:c9644897bb18bc625fa95f8dc3a6ed52d4c4c57a

commit r14-7322-gc9644897bb18bc625fa95f8dc3a6ed52d4c4c57a
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Wed Mar 1 11:00:29 2023 +0100

    gccrs: parser: Add RestPattern parsing
    
    Add simple RestPattern parsing to the pattern parsing function.
    
    gcc/rust/ChangeLog:
    
            * parse/rust-parse-impl.h (Parser::parse_pattern_no_alt): Handle
            RestPattern correctly.
    
    Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>

Diff:
---
 gcc/rust/parse/rust-parse-impl.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index de693ebc296..23171690d95 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -10737,6 +10737,10 @@ Parser<ManagedTokenSource>::parse_pattern_no_alt ()
       lexer.skip_token ();
       return std::unique_ptr<AST::WildcardPattern> (
 	new AST::WildcardPattern (t->get_locus ()));
+    case DOT_DOT:
+      lexer.skip_token ();
+      return std::unique_ptr<AST::RestPattern> (
+	new AST::RestPattern (t->get_locus ()));
     case REF:
     case MUT:
       return parse_identifier_pattern ();


More information about the Gcc-cvs mailing list