From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 5E6143858418; Sun, 5 Mar 2023 11:41:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5E6143858418 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678016484; bh=BX58oLk6u1oRVo5/5LRoscO1zrg4r7BfrgPaIKZbs9U=; h=From:To:Subject:Date:From; b=aknK7v/a406gYj6g2iT/4ZFtzDvqA4jBHj8VFF/4hghcfJ+mvEfAREPEY7xt+Dw4E FrjU8U5i0LTnkmZq6I5FviK7cx6fDoiNXx7Uv1FpUJRXCsVrtVhag2b3PUbKmk+/Is 2GMdV+rW069Z5qkSZntYfzFEFnUgVRLavXeMlg5I= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] parser: Fix if let parsing X-Act-Checkin: gcc X-Git-Author: Pierre-Emmanuel Patry X-Git-Refname: refs/heads/devel/rust/master X-Git-Oldrev: 23befb042f90f5c84a59c0901b147c24a704847b X-Git-Newrev: 1f24ea4b3cdd25b019e2f972753a992beaacdd3a Message-Id: <20230305114124.5E6143858418@sourceware.org> Date: Sun, 5 Mar 2023 11:41:24 +0000 (GMT) List-Id: https://gcc.gnu.org/g:1f24ea4b3cdd25b019e2f972753a992beaacdd3a commit 1f24ea4b3cdd25b019e2f972753a992beaacdd3a Author: Pierre-Emmanuel Patry Date: Wed Mar 1 14:13:01 2023 +0100 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 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 7988d12309d..2cea013ce56 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -13090,7 +13090,7 @@ Parser::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 ());