Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix expression segment parsing #2671

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion gcc/rust/parse/rust-parse-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -6804,11 +6804,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,
Expand Down
4 changes: 4 additions & 0 deletions gcc/testsuite/rust/compile/parse_generic_path_expr.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// { dg-additional-options "-frust-compile-until=ast" }
fn main() {
only_foo::<<i32 as Bar>::Item>();
}
Loading