diff options
Diffstat (limited to 'crates/ra_parser/src/grammar/expressions')
-rw-r--r-- | crates/ra_parser/src/grammar/expressions/atom.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs index b82fa17cb..8dc7e44a9 100644 --- a/crates/ra_parser/src/grammar/expressions/atom.rs +++ b/crates/ra_parser/src/grammar/expressions/atom.rs | |||
@@ -69,6 +69,7 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar | |||
69 | L_BRACK => array_expr(p), | 69 | L_BRACK => array_expr(p), |
70 | PIPE => lambda_expr(p), | 70 | PIPE => lambda_expr(p), |
71 | MOVE_KW if la == PIPE => lambda_expr(p), | 71 | MOVE_KW if la == PIPE => lambda_expr(p), |
72 | ASYNC_KW if la == PIPE || (la == MOVE_KW && p.nth(2) == PIPE) => lambda_expr(p), | ||
72 | IF_KW => if_expr(p), | 73 | IF_KW => if_expr(p), |
73 | 74 | ||
74 | LOOP_KW => loop_expr(p, None), | 75 | LOOP_KW => loop_expr(p, None), |
@@ -93,7 +94,7 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar | |||
93 | } | 94 | } |
94 | } | 95 | } |
95 | } | 96 | } |
96 | ASYNC_KW if la == L_CURLY || la == MOVE_KW => { | 97 | ASYNC_KW if la == L_CURLY || (la == MOVE_KW && p.nth(2) == L_CURLY) => { |
97 | let m = p.start(); | 98 | let m = p.start(); |
98 | p.bump(); | 99 | p.bump(); |
99 | p.eat(MOVE_KW); | 100 | p.eat(MOVE_KW); |
@@ -191,10 +192,19 @@ fn array_expr(p: &mut Parser) -> CompletedMarker { | |||
191 | // || -> i32 { 92 }; | 192 | // || -> i32 { 92 }; |
192 | // |x| x; | 193 | // |x| x; |
193 | // move |x: i32,| x; | 194 | // move |x: i32,| x; |
195 | // async || {}; | ||
196 | // move || {}; | ||
197 | // async move || {}; | ||
194 | // } | 198 | // } |
195 | fn lambda_expr(p: &mut Parser) -> CompletedMarker { | 199 | fn lambda_expr(p: &mut Parser) -> CompletedMarker { |
196 | assert!(p.at(PIPE) || (p.at(MOVE_KW) && p.nth(1) == PIPE)); | 200 | assert!( |
201 | p.at(PIPE) | ||
202 | || (p.at(MOVE_KW) && p.nth(1) == PIPE) | ||
203 | || (p.at(ASYNC_KW) && p.nth(1) == PIPE) | ||
204 | || (p.at(ASYNC_KW) && p.nth(1) == MOVE_KW && p.nth(2) == PIPE) | ||
205 | ); | ||
197 | let m = p.start(); | 206 | let m = p.start(); |
207 | p.eat(ASYNC_KW); | ||
198 | p.eat(MOVE_KW); | 208 | p.eat(MOVE_KW); |
199 | params::param_list_opt_types(p); | 209 | params::param_list_opt_types(p); |
200 | if opt_fn_ret_type(p) { | 210 | if opt_fn_ret_type(p) { |