diff options
Diffstat (limited to 'crates')
3 files changed, 96 insertions, 0 deletions
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs index d0feed616..8dc7e44a9 100644 --- a/crates/ra_parser/src/grammar/expressions/atom.rs +++ b/crates/ra_parser/src/grammar/expressions/atom.rs | |||
@@ -51,6 +51,7 @@ pub(super) const ATOM_EXPR_FIRST: TokenSet = | |||
51 | BREAK_KW, | 51 | BREAK_KW, |
52 | CONTINUE_KW, | 52 | CONTINUE_KW, |
53 | LIFETIME, | 53 | LIFETIME, |
54 | ASYNC_KW, | ||
54 | ]); | 55 | ]); |
55 | 56 | ||
56 | const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW]; | 57 | const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW]; |
diff --git a/crates/ra_syntax/tests/data/parser/ok/0050_async_block_as_argument.rs b/crates/ra_syntax/tests/data/parser/ok/0050_async_block_as_argument.rs new file mode 100644 index 000000000..ec4612cff --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/ok/0050_async_block_as_argument.rs | |||
@@ -0,0 +1,5 @@ | |||
1 | fn foo(x: impl std::future::Future<Output = i32>) {} | ||
2 | |||
3 | fn main() { | ||
4 | foo(async move { 12 }) | ||
5 | } | ||
diff --git a/crates/ra_syntax/tests/data/parser/ok/0050_async_block_as_argument.txt b/crates/ra_syntax/tests/data/parser/ok/0050_async_block_as_argument.txt new file mode 100644 index 000000000..82f0f8142 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/ok/0050_async_block_as_argument.txt | |||
@@ -0,0 +1,90 @@ | |||
1 | SOURCE_FILE@[0; 95) | ||
2 | FN_DEF@[0; 52) | ||
3 | FN_KW@[0; 2) | ||
4 | WHITESPACE@[2; 3) | ||
5 | NAME@[3; 6) | ||
6 | IDENT@[3; 6) "foo" | ||
7 | PARAM_LIST@[6; 49) | ||
8 | L_PAREN@[6; 7) | ||
9 | PARAM@[7; 48) | ||
10 | BIND_PAT@[7; 8) | ||
11 | NAME@[7; 8) | ||
12 | IDENT@[7; 8) "x" | ||
13 | COLON@[8; 9) | ||
14 | WHITESPACE@[9; 10) | ||
15 | IMPL_TRAIT_TYPE@[10; 48) | ||
16 | IMPL_KW@[10; 14) | ||
17 | WHITESPACE@[14; 15) | ||
18 | TYPE_BOUND_LIST@[15; 48) | ||
19 | TYPE_BOUND@[15; 48) | ||
20 | PATH_TYPE@[15; 48) | ||
21 | PATH@[15; 48) | ||
22 | PATH@[15; 26) | ||
23 | PATH@[15; 18) | ||
24 | PATH_SEGMENT@[15; 18) | ||
25 | NAME_REF@[15; 18) | ||
26 | IDENT@[15; 18) "std" | ||
27 | COLONCOLON@[18; 20) | ||
28 | PATH_SEGMENT@[20; 26) | ||
29 | NAME_REF@[20; 26) | ||
30 | IDENT@[20; 26) "future" | ||
31 | COLONCOLON@[26; 28) | ||
32 | PATH_SEGMENT@[28; 48) | ||
33 | NAME_REF@[28; 34) | ||
34 | IDENT@[28; 34) "Future" | ||
35 | TYPE_ARG_LIST@[34; 48) | ||
36 | L_ANGLE@[34; 35) | ||
37 | ASSOC_TYPE_ARG@[35; 47) | ||
38 | NAME_REF@[35; 41) | ||
39 | IDENT@[35; 41) "Output" | ||
40 | WHITESPACE@[41; 42) | ||
41 | EQ@[42; 43) | ||
42 | WHITESPACE@[43; 44) | ||
43 | PATH_TYPE@[44; 47) | ||
44 | PATH@[44; 47) | ||
45 | PATH_SEGMENT@[44; 47) | ||
46 | NAME_REF@[44; 47) | ||
47 | IDENT@[44; 47) "i32" | ||
48 | R_ANGLE@[47; 48) | ||
49 | R_PAREN@[48; 49) | ||
50 | WHITESPACE@[49; 50) | ||
51 | BLOCK@[50; 52) | ||
52 | L_CURLY@[50; 51) | ||
53 | R_CURLY@[51; 52) | ||
54 | WHITESPACE@[52; 54) | ||
55 | FN_DEF@[54; 94) | ||
56 | FN_KW@[54; 56) | ||
57 | WHITESPACE@[56; 57) | ||
58 | NAME@[57; 61) | ||
59 | IDENT@[57; 61) "main" | ||
60 | PARAM_LIST@[61; 63) | ||
61 | L_PAREN@[61; 62) | ||
62 | R_PAREN@[62; 63) | ||
63 | WHITESPACE@[63; 64) | ||
64 | BLOCK@[64; 94) | ||
65 | L_CURLY@[64; 65) | ||
66 | WHITESPACE@[65; 70) | ||
67 | CALL_EXPR@[70; 92) | ||
68 | PATH_EXPR@[70; 73) | ||
69 | PATH@[70; 73) | ||
70 | PATH_SEGMENT@[70; 73) | ||
71 | NAME_REF@[70; 73) | ||
72 | IDENT@[70; 73) "foo" | ||
73 | ARG_LIST@[73; 92) | ||
74 | L_PAREN@[73; 74) | ||
75 | BLOCK_EXPR@[74; 91) | ||
76 | ASYNC_KW@[74; 79) | ||
77 | WHITESPACE@[79; 80) | ||
78 | MOVE_KW@[80; 84) | ||
79 | WHITESPACE@[84; 85) | ||
80 | BLOCK@[85; 91) | ||
81 | L_CURLY@[85; 86) | ||
82 | WHITESPACE@[86; 87) | ||
83 | LITERAL@[87; 89) | ||
84 | INT_NUMBER@[87; 89) "12" | ||
85 | WHITESPACE@[89; 90) | ||
86 | R_CURLY@[90; 91) | ||
87 | R_PAREN@[91; 92) | ||
88 | WHITESPACE@[92; 93) | ||
89 | R_CURLY@[93; 94) | ||
90 | WHITESPACE@[94; 95) | ||