mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
Fix parsing of _ = x
in closure body
This commit is contained in:
parent
21e61bee8b
commit
ed48bd8b9d
4 changed files with 36 additions and 1 deletions
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue