File tree 2 files changed +24
-2
lines changed
2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change
1
+ use proc_macro:: { Delimiter , Group , TokenStream , TokenTree } ;
2
+
3
+ pub fn fix ( ts : TokenStream ) -> TokenStream {
4
+ ts. into_iter ( )
5
+ . map ( |t| match t {
6
+ TokenTree :: Group ( g) => {
7
+ let mut fixed = Group :: new (
8
+ match g. delimiter ( ) {
9
+ Delimiter :: None => Delimiter :: Parenthesis ,
10
+ d => d,
11
+ } ,
12
+ fix ( g. stream ( ) ) ,
13
+ ) ;
14
+ fixed. set_span ( g. span ( ) ) ;
15
+ TokenTree :: Group ( fixed)
16
+ }
17
+ t => t,
18
+ } )
19
+ . collect ( )
20
+ }
Original file line number Diff line number Diff line change @@ -15,17 +15,19 @@ type FormatArgs = Punctuated<syn::Expr, syn::token::Comma>;
15
15
#[ proc_macro_hack]
16
16
#[ doc( hidden) ]
17
17
pub fn check_impl ( tokens : TokenStream ) -> TokenStream {
18
- check_or_assert_impl ( syn:: parse_macro_input!( tokens) ) . into ( )
18
+ hygiene_bug :: fix ( check_or_assert_impl ( syn:: parse_macro_input!( tokens) ) . into ( ) )
19
19
}
20
20
21
+ mod hygiene_bug;
22
+
21
23
#[ cfg( feature = "let-assert" ) ]
22
24
mod let_assert;
23
25
24
26
#[ cfg( feature = "let-assert" ) ]
25
27
#[ proc_macro]
26
28
#[ doc( hidden) ]
27
29
pub fn let_assert_impl ( tokens : proc_macro:: TokenStream ) -> proc_macro:: TokenStream {
28
- let_assert:: let_assert_impl ( syn:: parse_macro_input!( tokens) ) . into ( )
30
+ hygiene_bug :: fix ( let_assert:: let_assert_impl ( syn:: parse_macro_input!( tokens) ) . into ( ) )
29
31
}
30
32
31
33
/// Real implementation for assert!() and check!().
You can’t perform that action at this time.
0 commit comments