From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7905) id 37F6A3857438; Tue, 16 Jan 2024 18:13:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 37F6A3857438 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705428825; bh=7kZAK01eu4pWx3HovYgPrIVRS0wLodMw85I8/0HcNXc=; h=From:To:Subject:Date:From; b=yfXwQugTux1qpqWWIgshg4B6V3Ndwc9X7SgIcd9P/MmfCIAeYcP9Myd2bSmwEJu2+ jftgFfr2HFsJ/9ICO9bECsYNDmjI/6FYrwLYQpV/O8Y1aMhB6hLcuazfKxcKjqx9hW eWZErtjmp4a5xb0XoeW8CbXikwkZ1HahllVRfhWE= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Arthur Cohen To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-8044] gccrs: Fix path expr segment parsing with generic path X-Act-Checkin: gcc X-Git-Author: Pierre-Emmanuel Patry X-Git-Refname: refs/heads/trunk X-Git-Oldrev: 292aec084c9986ea4274cd23f73248879a713911 X-Git-Newrev: 061c5d2e24831e520c2deaa383c7ba2041e89146 Message-Id: <20240116181345.37F6A3857438@sourceware.org> Date: Tue, 16 Jan 2024 18:13:45 +0000 (GMT) List-Id: https://gcc.gnu.org/g:061c5d2e24831e520c2deaa383c7ba2041e89146 commit r14-8044-g061c5d2e24831e520c2deaa383c7ba2041e89146 Author: Pierre-Emmanuel Patry Date: Tue Oct 10 10:04:57 2023 +0200 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 Diff: --- gcc/rust/parse/rust-parse-impl.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index 8c04a1af175..dde3d63201e 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -6808,11 +6808,13 @@ Parser::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,