This repository was archived by the owner on Dec 27, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +7
-10
lines changed
Expand file tree Collapse file tree 3 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -6,10 +6,7 @@ Procedural functionlike!() macros using only Macros 1.1
66
77Did you think Macros 1.1 was only for custom derives? Think again.
88
9- * Note:* Currently only works with nightly-2016-11-06 because of
10- [ rust-lang/rust #38706 ] ( https://github.com/rust-lang/rust/issues/38706 ) . The bug
11- has been fixed in master and the fix will be in the next nightly after
12- nightly-2017-01-01 as well as backported to 1.15.0-beta.
9+ * Note:* Requires nightly-2017-01-04 or later.
1310
1411## Defining procedural macros
1512
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ pub fn hack_expr(input: TokenStream) -> TokenStream {
1414 #[derive({})]
1515 #[allow(unused)]
1616 enum ProcMacroHack {{
17- Input = {{ stringify!($($tt)*); 0 }}
17+ Input = ( stringify!($($tt)*), 0).1
1818 }}
1919
2020 proc_macro_call!()
@@ -36,7 +36,7 @@ pub fn hack_item(input: TokenStream) -> TokenStream {
3636 #[derive({})]
3737 #[allow(unused)]
3838 enum ProcMacroHack {{
39- Input = {{ stringify!($($tt)*); 0 }}
39+ Input = ( stringify!($($tt)*), 0).1
4040 }}
4141 }}
4242 }}
Original file line number Diff line number Diff line change @@ -39,8 +39,8 @@ macro_rules! proc_macro_expr_impl {
3939 pub fn $func( input: $crate:: TokenStream ) -> $crate:: TokenStream {
4040 let source = input. to_string( ) ;
4141
42- let prefix = "#[allow(unused)]\n enum ProcMacroHack { Input = { stringify!(" ;
43- let suffix = "); 0 } , }\n " ;
42+ let prefix = "#[allow(unused)]\n enum ProcMacroHack { Input = ( stringify!(" ;
43+ let suffix = "), 0).1 , }\n " ;
4444 if !( source. starts_with( prefix) && source. ends_with( suffix) ) {
4545 panic!( "`{}` procedural macro failed" , stringify!( $func) ) ;
4646 }
@@ -73,8 +73,8 @@ macro_rules! proc_macro_item_impl {
7373 pub fn $func( input: $crate:: TokenStream ) -> $crate:: TokenStream {
7474 let source = input. to_string( ) ;
7575
76- let prefix = "#[allow(unused)]\n enum ProcMacroHack { Input = { stringify!(" ;
77- let suffix = "); 0 } , }\n " ;
76+ let prefix = "#[allow(unused)]\n enum ProcMacroHack { Input = ( stringify!(" ;
77+ let suffix = "), 0).1 , }\n " ;
7878 if !( source. starts_with( prefix) && source. ends_with( suffix) ) {
7979 panic!( "`{}` procedural macro failed" , stringify!( $func) ) ;
8080 }
You can’t perform that action at this time.
0 commit comments