File tree Expand file tree Collapse file tree 2 files changed +49
-28
lines changed
crates/hir_def/src/macro_expansion_tests Expand file tree Collapse file tree 2 files changed +49
-28
lines changed Original file line number Diff line number Diff line change @@ -299,34 +299,6 @@ fn baz() {
299
299
)
300
300
}
301
301
302
- #[ test]
303
- fn asi ( ) {
304
- // Thanks, Christopher!
305
- //
306
- // https://internals.rust-lang.org/t/understanding-decisions-behind-semicolons/15181/29
307
- check (
308
- r#"
309
- macro_rules! asi { ($($stmt:stmt)*) => ($($stmt)*); }
310
-
311
- fn main() {
312
- asi! {
313
- let a = 2
314
- let b = 5
315
- drop(b-a)
316
- println!("{}", a+b)
317
- }
318
- }
319
- "# ,
320
- expect ! [ [ r#"
321
- macro_rules! asi { ($($stmt:stmt)*) => ($($stmt)*); }
322
-
323
- fn main() {
324
- let a = 2let b = 5drop(b-a)println!("{}", a+b)
325
- }
326
- "# ] ] ,
327
- )
328
- }
329
-
330
302
#[ test]
331
303
fn test_match_group_empty_fixed_token ( ) {
332
304
check (
Original file line number Diff line number Diff line change @@ -50,3 +50,52 @@ macro_rules! m{ ($fmt:expr) => (); }
50
50
"# ] ] ,
51
51
) ;
52
52
}
53
+
54
+ #[ test]
55
+ fn asi ( ) {
56
+ // Thanks, Christopher!
57
+ //
58
+ // https://internals.rust-lang.org/t/understanding-decisions-behind-semicolons/15181/29
59
+ check (
60
+ r#"
61
+ macro_rules! asi { ($($stmt:stmt)*) => ($($stmt)*); }
62
+
63
+ fn main() {
64
+ asi! {
65
+ let a = 2
66
+ let b = 5
67
+ drop(b-a)
68
+ println!("{}", a+b)
69
+ }
70
+ }
71
+ "# ,
72
+ expect ! [ [ r#"
73
+ macro_rules! asi { ($($stmt:stmt)*) => ($($stmt)*); }
74
+
75
+ fn main() {
76
+ let a = 2let b = 5drop(b-a)println!("{}", a+b)
77
+ }
78
+ "# ] ] ,
79
+ )
80
+ }
81
+
82
+ #[ test]
83
+ fn stmt_boundaries ( ) {
84
+ // FIXME: this actually works OK under rustc.
85
+ check (
86
+ r#"
87
+ macro_rules! m {
88
+ ($($s:stmt)*) => (stringify!($($s |)*))
89
+ }
90
+ // +errors
91
+ m!(;;92;let x = 92; loop {};);
92
+ "# ,
93
+ expect ! [ [ r#"
94
+ macro_rules! m {
95
+ ($($s:stmt)*) => (stringify!($($s |)*))
96
+ }
97
+ /* error: expected Stmt *//* parse error: expected SEMICOLON */
98
+ stringify!()
99
+ "# ] ] ,
100
+ ) ;
101
+ }
You can’t perform that action at this time.
0 commit comments