Closed
Description
This example compiles on 1.35 but not 1.36 or later:
pub fn foo() -> &'static &'static bool {
{} // equivalent to {}; or ();
&&false
}
(The example above was reduced from one involving match ... {...} && false
, found by @digama0)
This regression was likely introduced by #60188, due to the definition of can_continue_expr_unambiguously
:
rust/src/librustc_ast/util/parser.rs
Lines 209 to 232 in daecab3
That function lists all of the operators that can't start an expression, but only continue it.
LAnd
(&&
) is incorrectly included, as &&expr
is parsed the same as & &expr
at the start of an expression.
cc @estebank
Metadata
Metadata
Assignees
Labels
Area: The lexing & parsing of Rust source code to an ASTCategory: This is a bug.High priorityRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from one stable version to another.Marks issues that should be documented in the release notes of the next release.
Activity
eddyb commentedon Jul 11, 2020
I've left some comments on #61500 (a partial fix for a regression that seems similar to this, but more specific), e.g.: #61500 (comment)
spastorino commentedon Jul 15, 2020
Assigning
P-high
as discussed as part of the Prioritization Working Group procedure and removingI-prioritize
.Correctly parse `{} && false` in tail expression
4 remaining items