diff options
Diffstat (limited to 'crates')
9 files changed, 63 insertions, 32 deletions
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs index c76b7330c..efb424dae 100644 --- a/crates/ra_parser/src/grammar/expressions/atom.rs +++ b/crates/ra_parser/src/grammar/expressions/atom.rs | |||
@@ -92,6 +92,8 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar | |||
92 | T![loop] => loop_expr(p, Some(m)), | 92 | T![loop] => loop_expr(p, Some(m)), |
93 | T![for] => for_expr(p, Some(m)), | 93 | T![for] => for_expr(p, Some(m)), |
94 | T![while] => while_expr(p, Some(m)), | 94 | T![while] => while_expr(p, Some(m)), |
95 | // test labeled_block | ||
96 | // fn f() { 'label: {}; } | ||
95 | T!['{'] => { | 97 | T!['{'] => { |
96 | block_expr(p); | 98 | block_expr(p); |
97 | m.complete(p, EFFECT_EXPR) | 99 | m.complete(p, EFFECT_EXPR) |
@@ -115,6 +117,8 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar | |||
115 | m.complete(p, EFFECT_EXPR) | 117 | m.complete(p, EFFECT_EXPR) |
116 | } | 118 | } |
117 | T![match] => match_expr(p), | 119 | T![match] => match_expr(p), |
120 | // test unsafe_block | ||
121 | // fn f() { unsafe { } } | ||
118 | T![unsafe] if la == T!['{'] => { | 122 | T![unsafe] if la == T!['{'] => { |
119 | let m = p.start(); | 123 | let m = p.start(); |
120 | p.bump(T![unsafe]); | 124 | p.bump(T![unsafe]); |
@@ -466,8 +470,6 @@ fn match_guard(p: &mut Parser) -> CompletedMarker { | |||
466 | // test block_expr | 470 | // test block_expr |
467 | // fn foo() { | 471 | // fn foo() { |
468 | // {}; | 472 | // {}; |
469 | // unsafe {}; | ||
470 | // 'label: {}; | ||
471 | // } | 473 | // } |
472 | pub(super) fn block_expr(p: &mut Parser) -> CompletedMarker { | 474 | pub(super) fn block_expr(p: &mut Parser) -> CompletedMarker { |
473 | assert!(p.at(T!['{'])); | 475 | assert!(p.at(T!['{'])); |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0105_block_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0105_block_expr.rast index fa3c9db9f..f3a5e3096 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0105_block_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0105_block_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@0..52 | 1 | [email protected]1 |
2 | FN_DEF@0..51 | 2 | FN_DEF@0..20 |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -8,7 +8,7 @@ [email protected] | |||
8 | [email protected] "(" | 8 | [email protected] "(" |
9 | [email protected] ")" | 9 | [email protected] ")" |
10 | [email protected] " " | 10 | [email protected] " " |
11 | BLOCK_EXPR@9..51 | 11 | BLOCK_EXPR@9..20 |
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "\n " | 13 | [email protected] "\n " |
14 | [email protected] | 14 | [email protected] |
@@ -16,26 +16,6 @@ [email protected] | |||
16 | [email protected] "{" | 16 | [email protected] "{" |
17 | [email protected] "}" | 17 | [email protected] "}" |
18 | [email protected] ";" | 18 | [email protected] ";" |
19 | [email protected] "\n " | 19 | [email protected] "\n" |
20 | [email protected] | 20 | [email protected] "}" |
21 | [email protected] | 21 | [email protected] "\n" |
22 | [email protected] "unsafe" | ||
23 | [email protected] " " | ||
24 | [email protected] | ||
25 | [email protected] "{" | ||
26 | [email protected] "}" | ||
27 | [email protected] ";" | ||
28 | [email protected] "\n " | ||
29 | [email protected] | ||
30 | [email protected] | ||
31 | [email protected] | ||
32 | [email protected] "\'label" | ||
33 | [email protected] ":" | ||
34 | [email protected] " " | ||
35 | [email protected] | ||
36 | [email protected] "{" | ||
37 | [email protected] "}" | ||
38 | [email protected] ";" | ||
39 | [email protected] "\n" | ||
40 | [email protected] "}" | ||
41 | [email protected] "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0105_block_expr.rs b/crates/ra_syntax/test_data/parser/inline/ok/0105_block_expr.rs index 2fed74c5e..9c6019fb1 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0105_block_expr.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0105_block_expr.rs | |||
@@ -1,5 +1,3 @@ | |||
1 | fn foo() { | 1 | fn foo() { |
2 | {}; | 2 | {}; |
3 | unsafe {}; | ||
4 | 'label: {}; | ||
5 | } | 3 | } |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast index aabcd422f..93cc41533 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast | |||
@@ -15,7 +15,7 @@ [email protected] | |||
15 | [email protected] | 15 | [email protected] |
16 | [email protected] "{" | 16 | [email protected] "{" |
17 | [email protected] " " | 17 | [email protected] " " |
18 | EFFEC[email protected] | 18 | TRY[email protected] |
19 | [email protected] | 19 | [email protected] |
20 | [email protected] "#" | 20 | [email protected] "#" |
21 | [email protected] "[" | 21 | [email protected] "[" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0137_await_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0137_await_expr.rast index b3ab326e3..8e8d9e992 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0137_await_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0137_await_expr.rast | |||
@@ -39,7 +39,7 @@ [email protected] | |||
39 | [email protected] "\n " | 39 | [email protected] "\n " |
40 | [email protected] | 40 | [email protected] |
41 | [email protected] | 41 | [email protected] |
42 | EFFEC[email protected] | 42 | TRY[email protected] |
43 | [email protected] | 43 | [email protected] |
44 | [email protected] | 44 | [email protected] |
45 | [email protected] | 45 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0161_labeled_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0161_labeled_block.rast new file mode 100644 index 000000000..9efebd8b8 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0161_labeled_block.rast | |||
@@ -0,0 +1,26 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "f" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] ")" | ||
10 | [email protected] " " | ||
11 | [email protected] | ||
12 | [email protected] "{" | ||
13 | [email protected] " " | ||
14 | [email protected] | ||
15 | [email protected] | ||
16 | [email protected] | ||
17 | [email protected] "\'label" | ||
18 | [email protected] ":" | ||
19 | [email protected] " " | ||
20 | [email protected] | ||
21 | [email protected] "{" | ||
22 | [email protected] "}" | ||
23 | [email protected] ";" | ||
24 | [email protected] " " | ||
25 | [email protected] "}" | ||
26 | [email protected] "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0161_labeled_block.rs b/crates/ra_syntax/test_data/parser/inline/ok/0161_labeled_block.rs new file mode 100644 index 000000000..18b4ff4b1 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0161_labeled_block.rs | |||
@@ -0,0 +1 @@ | |||
fn f() { 'label: {}; } | |||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0162_unsafe_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0162_unsafe_block.rast new file mode 100644 index 000000000..4991f2c36 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0162_unsafe_block.rast | |||
@@ -0,0 +1,23 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "f" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] ")" | ||
10 | [email protected] " " | ||
11 | [email protected] | ||
12 | [email protected] "{" | ||
13 | [email protected] " " | ||
14 | [email protected] | ||
15 | [email protected] "unsafe" | ||
16 | [email protected] " " | ||
17 | [email protected] | ||
18 | [email protected] "{" | ||
19 | [email protected] " " | ||
20 | [email protected] "}" | ||
21 | [email protected] " " | ||
22 | [email protected] "}" | ||
23 | [email protected] "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0162_unsafe_block.rs b/crates/ra_syntax/test_data/parser/inline/ok/0162_unsafe_block.rs new file mode 100644 index 000000000..dfb9b2a1c --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0162_unsafe_block.rs | |||
@@ -0,0 +1 @@ | |||
fn f() { unsafe { } } | |||