about summary refs log tree commit diff
path: root/crates/parser/src
diff options
context:
space:
mode:
authorbellau <laurent.belmonte@gmail.com>2022-02-12 16:07:58 +0100
committerbellau <laurent.belmonte@gmail.com>2022-02-12 16:07:58 +0100
commit200860794651c3dcae7dced3de1fe99bea2cd692 (patch)
treeef0f028193c87d44f20247eeffb92fad28dc0102 /crates/parser/src
parent1284bc0af32c7bf772150c3e64f8a867d4f533be (diff)
downloadrust-200860794651c3dcae7dced3de1fe99bea2cd692.tar.gz
rust-200860794651c3dcae7dced3de1fe99bea2cd692.zip
support static move too
Diffstat (limited to 'crates/parser/src')
-rw-r--r--crates/parser/src/grammar/expressions/atom.rs6
-rw-r--r--crates/parser/src/grammar/items.rs2
2 files changed, 5 insertions, 3 deletions
diff --git a/crates/parser/src/grammar/expressions/atom.rs b/crates/parser/src/grammar/expressions/atom.rs
index 7f9b9768dad..76d9b39d385 100644
--- a/crates/parser/src/grammar/expressions/atom.rs
+++ b/crates/parser/src/grammar/expressions/atom.rs
@@ -74,7 +74,7 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar
         T![|] => closure_expr(p),
         T![move] if la == T![|] => closure_expr(p),
         T![async] if la == T![|] || (la == T![move] && p.nth(2) == T![|]) => closure_expr(p),
-        T![static] if la == T![|] => closure_expr(p),
+        T![static] if la == T![|] || (la == T![move] && p.nth(2) == T![|]) => closure_expr(p),
         T![if] => if_expr(p),
 
         T![loop] => loop_expr(p, None),
@@ -236,6 +236,7 @@ fn array_expr(p: &mut Parser) -> CompletedMarker {
 //     move || {};
 //     async move || {};
 //     static || {};
+//     static move || {};
 // }
 fn closure_expr(p: &mut Parser) -> CompletedMarker {
     assert!(
@@ -244,11 +245,12 @@ fn closure_expr(p: &mut Parser) -> CompletedMarker {
             || (p.at(T![async]) && p.nth(1) == T![|])
             || (p.at(T![async]) && p.nth(1) == T![move] && p.nth(2) == T![|])
             || (p.at(T![static]) && p.nth(1) == T![|])
+            || (p.at(T![static]) && p.nth(1) == T![move] && p.nth(2) == T![|])
     );
     let m = p.start();
     p.eat(T![async]);
-    p.eat(T![move]);
     p.eat(T![static]);
+    p.eat(T![move]);
     params::param_list_closure(p);
     if opt_ret_type(p) {
         // test lambda_ret_block
diff --git a/crates/parser/src/grammar/items.rs b/crates/parser/src/grammar/items.rs
index ac39d470f87..e583ff782b6 100644
--- a/crates/parser/src/grammar/items.rs
+++ b/crates/parser/src/grammar/items.rs
@@ -230,7 +230,7 @@ fn opt_item_without_modifiers(p: &mut Parser, m: Marker) -> Result<(), Marker> {
         IDENT if p.at_contextual_kw(T![macro_rules]) && p.nth(1) == BANG => macro_rules(p, m),
 
         T![const] if (la == IDENT || la == T![_] || la == T![mut]) => consts::konst(p, m),
-        T![static] if la != PIPE => consts::static_(p, m),
+        T![static] if (la != PIPE && la != T![move] ) => consts::static_(p, m),
 
         _ => return Err(m),
     };