]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: parser: Fix if let parsing
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Wed, 1 Mar 2023 13:13:01 +0000 (14:13 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:19:01 +0000 (18:19 +0100)
Fix if let parsing in null_notation function. This problem was due to
the current token already being passed in the function parameters and
already out of the buffered queue. Hence why the peeked token was let
and not if.

gcc/rust/ChangeLog:

* parse/rust-parse-impl.h (Parser::null_denotation): Fix if let
parsing.

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

index 94bc04ccaa5a39e2a984586dad3325f9771d333e..de693ebc296fc550dce4486d29fe77a935140393 100644 (file)
@@ -13090,7 +13090,7 @@ Parser<ManagedTokenSource>::null_denotation (const_TokenPtr tok,
       return parse_block_expr (std::move (outer_attrs), tok->get_locus ());
     case IF:
       // if or if let, so more lookahead to find out
-      if (lexer.peek_token (1)->get_id () == LET)
+      if (lexer.peek_token ()->get_id () == LET)
        {
          // if let expr
          return parse_if_let_expr (std::move (outer_attrs), tok->get_locus ());