[gcc r14-7319] gccrs: parser: Fix if let parsing

Arthur Cohen cohenarthur@gcc.gnu.org
Tue Jan 16 17:22:17 GMT 2024


https://gcc.gnu.org/g:d34922c496430cfbfa855f59d45f15de852c2316

commit r14-7319-gd34922c496430cfbfa855f59d45f15de852c2316
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Wed Mar 1 14:13:01 2023 +0100

    gccrs: parser: Fix if let parsing
    
    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>

Diff:
---
 gcc/rust/parse/rust-parse-impl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index 94bc04ccaa5..de693ebc296 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -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 ());


More information about the Gcc-cvs mailing list