aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-10-10 10:04:57 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 19:09:14 +0100
commit061c5d2e24831e520c2deaa383c7ba2041e89146 (patch)
tree51f842b210b96a234ca9414f9a956dbe3990da96 /gcc
parent292aec084c9986ea4274cd23f73248879a713911 (diff)
downloadgcc-061c5d2e24831e520c2deaa383c7ba2041e89146.zip
gcc-061c5d2e24831e520c2deaa383c7ba2041e89146.tar.gz
gcc-061c5d2e24831e520c2deaa383c7ba2041e89146.tar.bz2
gccrs: Fix path expr segment parsing with generic path
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>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/parse/rust-parse-impl.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index 8c04a1a..dde3d63 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -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,