File tree Expand file tree Collapse file tree 3 files changed +38
-22
lines changed Expand file tree Collapse file tree 3 files changed +38
-22
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ fn pretty_print_macro_expansion(expn: SyntaxNode) -> String {
126
126
( T ! [ >] , IDENT ) => " " ,
127
127
( T ! [ >] , _) if curr_kind. is_keyword ( ) => " " ,
128
128
( T ! [ ->] , _) | ( _, T ! [ ->] ) => " " ,
129
+ ( T ! [ &&] , _) | ( _, T ! [ &&] ) => " " ,
129
130
_ => "" ,
130
131
} ;
131
132
Original file line number Diff line number Diff line change @@ -346,3 +346,40 @@ fn bar() {
346
346
"# ] ] ,
347
347
)
348
348
}
349
+
350
+ #[ test]
351
+ fn test_match_group_with_multichar_sep ( ) {
352
+ check (
353
+ r#"
354
+ macro_rules! m {
355
+ (fn $name:ident { $($i:literal)* }) => ( fn $name() -> bool { $($i)&&* } );
356
+ }
357
+ m! (fn baz { true false } );
358
+ "# ,
359
+ expect ! [ [ r#"
360
+ macro_rules! m {
361
+ (fn $name:ident { $($i:literal)* }) => ( fn $name() -> bool { $($i)&&* } );
362
+ }
363
+ fn baz() -> bool {
364
+ true && false
365
+ }
366
+ "# ] ] ,
367
+ ) ;
368
+
369
+ check (
370
+ r#"
371
+ macro_rules! m {
372
+ (fn $name:ident { $($i:literal)&&* }) => ( fn $name() -> bool { $($i)&&* } );
373
+ }
374
+ m! (fn baz { true && false } );
375
+ "# ,
376
+ expect ! [ [ r#"
377
+ macro_rules! m {
378
+ (fn $name:ident { $($i:literal)&&* }) => ( fn $name() -> bool { $($i)&&* } );
379
+ }
380
+ fn baz() -> bool {
381
+ true && false
382
+ }
383
+ "# ] ] ,
384
+ ) ;
385
+ }
Original file line number Diff line number Diff line change @@ -71,28 +71,6 @@ macro_rules! foobar {
71
71
assert_eq ! ( get_text( tt:: TokenId ( 13 ) , T ![ '{' ] ) , "{" ) ;
72
72
}
73
73
74
- #[ test]
75
- fn test_match_group_with_multichar_sep ( ) {
76
- parse_macro (
77
- r#"
78
- macro_rules! foo {
79
- (fn $name:ident {$($i:literal)*} ) => ( fn $name() -> bool { $($i)&&*} );
80
- }"# ,
81
- )
82
- . assert_expand_items ( "foo! (fn baz {true true} );" , "fn baz () -> bool {true &&true}" ) ;
83
- }
84
-
85
- #[ test]
86
- fn test_match_group_with_multichar_sep2 ( ) {
87
- parse_macro (
88
- r#"
89
- macro_rules! foo {
90
- (fn $name:ident {$($i:literal)&&*} ) => ( fn $name() -> bool { $($i)&&*} );
91
- }"# ,
92
- )
93
- . assert_expand_items ( "foo! (fn baz {true && true} );" , "fn baz () -> bool {true &&true}" ) ;
94
- }
95
-
96
74
#[ test]
97
75
fn test_match_group_zero_match ( ) {
98
76
parse_macro (
You can’t perform that action at this time.
0 commit comments