aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax
diff options
context:
space:
mode:
Diffstat (limited to 'crates/syntax')
-rw-r--r--crates/syntax/Cargo.toml2
-rw-r--r--crates/syntax/src/ast/expr_ext.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0158_macro_rules_non_brace.rast57
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0158_macro_rules_non_brace.rs2
4 files changed, 64 insertions, 1 deletions
diff --git a/crates/syntax/Cargo.toml b/crates/syntax/Cargo.toml
index c6a6f11e1..21015591c 100644
--- a/crates/syntax/Cargo.toml
+++ b/crates/syntax/Cargo.toml
@@ -13,7 +13,7 @@ doctest = false
13[dependencies] 13[dependencies]
14itertools = "0.9.0" 14itertools = "0.9.0"
15rowan = "0.10.0" 15rowan = "0.10.0"
16rustc_lexer = { version = "691.0.0", package = "rustc-ap-rustc_lexer" } 16rustc_lexer = { version = "695.0.0", package = "rustc-ap-rustc_lexer" }
17rustc-hash = "1.1.0" 17rustc-hash = "1.1.0"
18arrayvec = "0.5.1" 18arrayvec = "0.5.1"
19once_cell = "1.3.1" 19once_cell = "1.3.1"
diff --git a/crates/syntax/src/ast/expr_ext.rs b/crates/syntax/src/ast/expr_ext.rs
index e4a9b945c..636ce166d 100644
--- a/crates/syntax/src/ast/expr_ext.rs
+++ b/crates/syntax/src/ast/expr_ext.rs
@@ -358,6 +358,7 @@ pub enum Effect {
358 Async(SyntaxToken), 358 Async(SyntaxToken),
359 Unsafe(SyntaxToken), 359 Unsafe(SyntaxToken),
360 Try(SyntaxToken), 360 Try(SyntaxToken),
361 Const(SyntaxToken),
361 // Very much not an effect, but we stuff it into this node anyway 362 // Very much not an effect, but we stuff it into this node anyway
362 Label(ast::Label), 363 Label(ast::Label),
363} 364}
@@ -373,6 +374,9 @@ impl ast::EffectExpr {
373 if let Some(token) = self.try_token() { 374 if let Some(token) = self.try_token() {
374 return Effect::Try(token); 375 return Effect::Try(token);
375 } 376 }
377 if let Some(token) = self.const_token() {
378 return Effect::Const(token);
379 }
376 if let Some(label) = self.label() { 380 if let Some(label) = self.label() {
377 return Effect::Label(label); 381 return Effect::Label(label);
378 } 382 }
diff --git a/crates/syntax/test_data/parser/inline/ok/0158_macro_rules_non_brace.rast b/crates/syntax/test_data/parser/inline/ok/0158_macro_rules_non_brace.rast
new file mode 100644
index 000000000..4a1f712aa
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0158_macro_rules_non_brace.rast
@@ -0,0 +1,57 @@
1[email protected]
2 [email protected]
3 [email protected] "macro_rules"
4 [email protected] "!"
5 [email protected] " "
6 [email protected]
7 [email protected] "m"
8 [email protected] " "
9 [email protected]
10 [email protected] "("
11 [email protected] " "
12 [email protected]
13 [email protected] "("
14 [email protected] "$"
15 [email protected] "i"
16 [email protected] ":"
17 [email protected] "ident"
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] " "
27 [email protected] ")"
28 [email protected] ";"
29 [email protected] "\n"
30 [email protected]
31 [email protected] "macro_rules"
32 [email protected] "!"
33 [email protected] " "
34 [email protected]
35 [email protected] "m"
36 [email protected] " "
37 [email protected]
38 [email protected] "["
39 [email protected] " "
40 [email protected]
41 [email protected] "("
42 [email protected] "$"
43 [email protected] "i"
44 [email protected] ":"
45 [email protected] "ident"
46 [email protected] ")"
47 [email protected] " "
48 [email protected] "="
49 [email protected] ">"
50 [email protected] " "
51 [email protected]
52 [email protected] "{"
53 [email protected] "}"
54 [email protected] " "
55 [email protected] "]"
56 [email protected] ";"
57 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0158_macro_rules_non_brace.rs b/crates/syntax/test_data/parser/inline/ok/0158_macro_rules_non_brace.rs
new file mode 100644
index 000000000..6033a28cd
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0158_macro_rules_non_brace.rs
@@ -0,0 +1,2 @@
1macro_rules! m ( ($i:ident) => {} );
2macro_rules! m [ ($i:ident) => {} ];