Fix parsing of _ = x in closure body
This commit is contained in:
@@ -288,7 +288,7 @@ fn expr_bp(
|
||||
}
|
||||
|
||||
const LHS_FIRST: TokenSet =
|
||||
atom::ATOM_EXPR_FIRST.union(TokenSet::new(&[T![&], T![*], T![!], T![.], T![-]]));
|
||||
atom::ATOM_EXPR_FIRST.union(TokenSet::new(&[T![&], T![*], T![!], T![.], T![-], T![_]]));
|
||||
|
||||
fn lhs(p: &mut Parser<'_>, r: Restrictions) -> Option<(CompletedMarker, BlockLike)> {
|
||||
let m;
|
||||
|
||||
@@ -278,6 +278,8 @@ fn closure_expr(p: &mut Parser<'_>) -> CompletedMarker {
|
||||
// fn main() { || -> i32 { 92 }(); }
|
||||
block_expr(p);
|
||||
} else if p.at_ts(EXPR_FIRST) {
|
||||
// test closure_body_underscore_assignment
|
||||
// fn main() { || _ = 0; }
|
||||
expr(p);
|
||||
} else {
|
||||
p.error("expected expression");
|
||||
|
||||
Reference in New Issue
Block a user