@@ -153,18 +153,18 @@ pub trait MultiItemDecorator {
153153 sp : Span ,
154154 meta_item : & ast:: MetaItem ,
155155 item : & Annotatable ,
156- push : & mut FnMut ( Annotatable ) ) ;
156+ push : & mut dyn FnMut ( Annotatable ) ) ;
157157}
158158
159159impl < F > MultiItemDecorator for F
160- where F : Fn ( & mut ExtCtxt , Span , & ast:: MetaItem , & Annotatable , & mut FnMut ( Annotatable ) )
160+ where F : Fn ( & mut ExtCtxt , Span , & ast:: MetaItem , & Annotatable , & mut dyn FnMut ( Annotatable ) )
161161{
162162 fn expand ( & self ,
163163 ecx : & mut ExtCtxt ,
164164 sp : Span ,
165165 meta_item : & ast:: MetaItem ,
166166 item : & Annotatable ,
167- push : & mut FnMut ( Annotatable ) ) {
167+ push : & mut dyn FnMut ( Annotatable ) ) {
168168 ( * self ) ( ecx, sp, meta_item, item, push)
169169 }
170170}
@@ -247,18 +247,18 @@ impl<F> AttrProcMacro for F
247247/// Represents a thing that maps token trees to Macro Results
248248pub trait TTMacroExpander {
249249 fn expand < ' cx > ( & self , ecx : & ' cx mut ExtCtxt , span : Span , input : TokenStream )
250- -> Box < MacResult +' cx > ;
250+ -> Box < dyn MacResult +' cx > ;
251251}
252252
253253pub type MacroExpanderFn =
254254 for <' cx > fn ( & ' cx mut ExtCtxt , Span , & [ tokenstream:: TokenTree ] )
255- -> Box < MacResult +' cx > ;
255+ -> Box < dyn MacResult +' cx > ;
256256
257257impl < F > TTMacroExpander for F
258- where F : for < ' cx > Fn ( & ' cx mut ExtCtxt , Span , & [ tokenstream:: TokenTree ] ) -> Box < MacResult +' cx >
258+ where F : for < ' cx > Fn ( & ' cx mut ExtCtxt , Span , & [ tokenstream:: TokenTree ] ) -> Box < dyn MacResult +' cx >
259259{
260260 fn expand < ' cx > ( & self , ecx : & ' cx mut ExtCtxt , span : Span , input : TokenStream )
261- -> Box < MacResult +' cx > {
261+ -> Box < dyn MacResult +' cx > {
262262 struct AvoidInterpolatedIdents ;
263263
264264 impl Folder for AvoidInterpolatedIdents {
@@ -289,23 +289,23 @@ pub trait IdentMacroExpander {
289289 sp : Span ,
290290 ident : ast:: Ident ,
291291 token_tree : Vec < tokenstream:: TokenTree > )
292- -> Box < MacResult +' cx > ;
292+ -> Box < dyn MacResult +' cx > ;
293293}
294294
295295pub type IdentMacroExpanderFn =
296296 for <' cx > fn ( & ' cx mut ExtCtxt , Span , ast:: Ident , Vec < tokenstream:: TokenTree > )
297- -> Box < MacResult +' cx > ;
297+ -> Box < dyn MacResult +' cx > ;
298298
299299impl < F > IdentMacroExpander for F
300300 where F : for < ' cx > Fn ( & ' cx mut ExtCtxt , Span , ast:: Ident ,
301- Vec < tokenstream:: TokenTree > ) -> Box < MacResult +' cx >
301+ Vec < tokenstream:: TokenTree > ) -> Box < dyn MacResult +' cx >
302302{
303303 fn expand < ' cx > ( & self ,
304304 cx : & ' cx mut ExtCtxt ,
305305 sp : Span ,
306306 ident : ast:: Ident ,
307307 token_tree : Vec < tokenstream:: TokenTree > )
308- -> Box < MacResult +' cx >
308+ -> Box < dyn MacResult +' cx >
309309 {
310310 ( * self ) ( cx, sp, ident, token_tree)
311311 }
@@ -378,7 +378,7 @@ macro_rules! make_MacEager {
378378
379379 impl MacEager {
380380 $(
381- pub fn $fld( v: $t) -> Box <MacResult > {
381+ pub fn $fld( v: $t) -> Box <dyn MacResult > {
382382 Box :: new( MacEager {
383383 $fld: Some ( v) ,
384384 ..Default :: default ( )
@@ -462,7 +462,7 @@ impl DummyResult {
462462 ///
463463 /// Use this as a return value after hitting any errors and
464464 /// calling `span_err`.
465- pub fn any ( sp : Span ) -> Box < MacResult +' static > {
465+ pub fn any ( sp : Span ) -> Box < dyn MacResult +' static > {
466466 Box :: new ( DummyResult { expr_only : false , span : sp } )
467467 }
468468
@@ -471,7 +471,7 @@ impl DummyResult {
471471 /// Use this for macros that must expand to an expression, so even
472472 /// if an error is encountered internally, the user will receive
473473 /// an error that they also used it in the wrong place.
474- pub fn expr ( sp : Span ) -> Box < MacResult +' static > {
474+ pub fn expr ( sp : Span ) -> Box < dyn MacResult +' static > {
475475 Box :: new ( DummyResult { expr_only : true , span : sp } )
476476 }
477477
@@ -559,7 +559,7 @@ impl MacResult for DummyResult {
559559}
560560
561561pub type BuiltinDeriveFn =
562- for <' cx > fn ( & ' cx mut ExtCtxt , Span , & MetaItem , & Annotatable , & mut FnMut ( Annotatable ) ) ;
562+ for <' cx > fn ( & ' cx mut ExtCtxt , Span , & MetaItem , & Annotatable , & mut dyn FnMut ( Annotatable ) ) ;
563563
564564/// Represents different kinds of macro invocations that can be resolved.
565565#[ derive( Clone , Copy , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug ) ]
@@ -590,15 +590,15 @@ pub enum SyntaxExtension {
590590 /// `#[derive(...)]` is a `MultiItemDecorator`.
591591 ///
592592 /// Prefer ProcMacro or MultiModifier since they are more flexible.
593- MultiDecorator ( Box < MultiItemDecorator + sync:: Sync + sync:: Send > ) ,
593+ MultiDecorator ( Box < dyn MultiItemDecorator + sync:: Sync + sync:: Send > ) ,
594594
595595 /// A syntax extension that is attached to an item and modifies it
596596 /// in-place. Also allows decoration, i.e., creating new items.
597- MultiModifier ( Box < MultiItemModifier + sync:: Sync + sync:: Send > ) ,
597+ MultiModifier ( Box < dyn MultiItemModifier + sync:: Sync + sync:: Send > ) ,
598598
599599 /// A function-like procedural macro. TokenStream -> TokenStream.
600600 ProcMacro {
601- expander : Box < ProcMacro + sync:: Sync + sync:: Send > ,
601+ expander : Box < dyn ProcMacro + sync:: Sync + sync:: Send > ,
602602 allow_internal_unstable : bool ,
603603 edition : Edition ,
604604 } ,
@@ -607,13 +607,13 @@ pub enum SyntaxExtension {
607607 /// The first TokenSteam is the attribute, the second is the annotated item.
608608 /// Allows modification of the input items and adding new items, similar to
609609 /// MultiModifier, but uses TokenStreams, rather than AST nodes.
610- AttrProcMacro ( Box < AttrProcMacro + sync:: Sync + sync:: Send > , Edition ) ,
610+ AttrProcMacro ( Box < dyn AttrProcMacro + sync:: Sync + sync:: Send > , Edition ) ,
611611
612612 /// A normal, function-like syntax extension.
613613 ///
614614 /// `bytes!` is a `NormalTT`.
615615 NormalTT {
616- expander : Box < TTMacroExpander + sync:: Sync + sync:: Send > ,
616+ expander : Box < dyn TTMacroExpander + sync:: Sync + sync:: Send > ,
617617 def_info : Option < ( ast:: NodeId , Span ) > ,
618618 /// Whether the contents of the macro can
619619 /// directly use `#[unstable]` things (true == yes).
@@ -633,21 +633,21 @@ pub enum SyntaxExtension {
633633 /// A function-like syntax extension that has an extra ident before
634634 /// the block.
635635 ///
636- IdentTT ( Box < IdentMacroExpander + sync:: Sync + sync:: Send > , Option < Span > , bool ) ,
636+ IdentTT ( Box < dyn IdentMacroExpander + sync:: Sync + sync:: Send > , Option < Span > , bool ) ,
637637
638638 /// An attribute-like procedural macro. TokenStream -> TokenStream.
639639 /// The input is the annotated item.
640640 /// Allows generating code to implement a Trait for a given struct
641641 /// or enum item.
642- ProcMacroDerive ( Box < MultiItemModifier + sync:: Sync + sync:: Send > ,
642+ ProcMacroDerive ( Box < dyn MultiItemModifier + sync:: Sync + sync:: Send > ,
643643 Vec < Symbol > /* inert attribute names */ , Edition ) ,
644644
645645 /// An attribute-like procedural macro that derives a builtin trait.
646646 BuiltinDerive ( BuiltinDeriveFn ) ,
647647
648648 /// A declarative macro, e.g. `macro m() {}`.
649649 DeclMacro {
650- expander : Box < TTMacroExpander + sync:: Sync + sync:: Send > ,
650+ expander : Box < dyn TTMacroExpander + sync:: Sync + sync:: Send > ,
651651 def_info : Option < ( ast:: NodeId , Span ) > ,
652652 is_transparent : bool ,
653653 edition : Edition ,
@@ -784,7 +784,7 @@ pub struct ExtCtxt<'a> {
784784 pub parse_sess : & ' a parse:: ParseSess ,
785785 pub ecfg : expand:: ExpansionConfig < ' a > ,
786786 pub root_path : PathBuf ,
787- pub resolver : & ' a mut Resolver ,
787+ pub resolver : & ' a mut dyn Resolver ,
788788 pub resolve_err_count : usize ,
789789 pub current_expansion : ExpansionData ,
790790 pub expansions : HashMap < Span , Vec < String > > ,
@@ -793,7 +793,7 @@ pub struct ExtCtxt<'a> {
793793impl < ' a > ExtCtxt < ' a > {
794794 pub fn new ( parse_sess : & ' a parse:: ParseSess ,
795795 ecfg : expand:: ExpansionConfig < ' a > ,
796- resolver : & ' a mut Resolver )
796+ resolver : & ' a mut dyn Resolver )
797797 -> ExtCtxt < ' a > {
798798 ExtCtxt {
799799 parse_sess,
0 commit comments