]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Fix path expr segment parsing with generic path
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Tue, 10 Oct 2023 08:04:57 +0000 (10:04 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:09:14 +0000 (19:09 +0100)
When a token was identified as bit left shift it slipped through the
parser and resulted in an error.

gcc/rust/ChangeLog:

* parse/rust-parse-impl.h (Parser::parse_path_expr_segment): Accept
left shift tokens in order to let generic parsing function split the
token.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/parse/rust-parse-impl.h

index 8c04a1af17588bbf990d730392f6a8bc20bd92a0..dde3d63201e2792db584cfc6240498e5293207c1 100644 (file)
@@ -6808,11 +6808,13 @@ Parser<ManagedTokenSource>::parse_path_expr_segment ()
   /* use lookahead to determine if they actually exist (don't want to
    * accidently parse over next ident segment) */
   if (lexer.peek_token ()->get_id () == SCOPE_RESOLUTION
-      && lexer.peek_token (1)->get_id () == LEFT_ANGLE)
+      && (lexer.peek_token (1)->get_id () == LEFT_ANGLE
+         || lexer.peek_token (1)->get_id () == LEFT_SHIFT))
     {
       // skip scope resolution
       lexer.skip_token ();
 
+      // Let parse_path_generic_args split "<<" tokens
       AST::GenericArgs generic_args = parse_path_generic_args ();
 
       return AST::PathExprSegment (std::move (ident), locus,