@@ -188,10 +188,7 @@ impl<F> AttrProcMacro for F
188
188
189
189
/// Represents a thing that maps token trees to Macro Results
190
190
pub trait TTMacroExpander {
191
- fn expand < ' cx > ( & self ,
192
- ecx : & ' cx mut ExtCtxt ,
193
- span : Span ,
194
- token_tree : & [ tokenstream:: TokenTree ] )
191
+ fn expand < ' cx > ( & self , ecx : & ' cx mut ExtCtxt , span : Span , input : TokenStream )
195
192
-> Box < MacResult +' cx > ;
196
193
}
197
194
@@ -200,15 +197,11 @@ pub type MacroExpanderFn =
200
197
-> Box < MacResult +' cx > ;
201
198
202
199
impl < F > TTMacroExpander for F
203
- where F : for < ' cx > Fn ( & ' cx mut ExtCtxt , Span , & [ tokenstream:: TokenTree ] )
204
- -> Box < MacResult +' cx >
200
+ where F : for < ' cx > Fn ( & ' cx mut ExtCtxt , Span , & [ tokenstream:: TokenTree ] ) -> Box < MacResult +' cx >
205
201
{
206
- fn expand < ' cx > ( & self ,
207
- ecx : & ' cx mut ExtCtxt ,
208
- span : Span ,
209
- token_tree : & [ tokenstream:: TokenTree ] )
202
+ fn expand < ' cx > ( & self , ecx : & ' cx mut ExtCtxt , span : Span , input : TokenStream )
210
203
-> Box < MacResult +' cx > {
211
- ( * self ) ( ecx, span, token_tree )
204
+ ( * self ) ( ecx, span, & input . trees ( ) . collect :: < Vec < _ > > ( ) )
212
205
}
213
206
}
214
207
@@ -654,9 +647,8 @@ impl<'a> ExtCtxt<'a> {
654
647
expand:: MacroExpander :: new ( self , true )
655
648
}
656
649
657
- pub fn new_parser_from_tts ( & self , tts : & [ tokenstream:: TokenTree ] )
658
- -> parser:: Parser < ' a > {
659
- parse:: tts_to_parser ( self . parse_sess , tts. to_vec ( ) )
650
+ pub fn new_parser_from_tts ( & self , tts : & [ tokenstream:: TokenTree ] ) -> parser:: Parser < ' a > {
651
+ parse:: stream_to_parser ( self . parse_sess , tts. iter ( ) . cloned ( ) . collect ( ) )
660
652
}
661
653
pub fn codemap ( & self ) -> & ' a CodeMap { self . parse_sess . codemap ( ) }
662
654
pub fn parse_sess ( & self ) -> & ' a parse:: ParseSess { self . parse_sess }
0 commit comments