@@ -153,18 +153,18 @@ pub trait MultiItemDecorator {
153
153
sp : Span ,
154
154
meta_item : & ast:: MetaItem ,
155
155
item : & Annotatable ,
156
- push : & mut FnMut ( Annotatable ) ) ;
156
+ push : & mut dyn FnMut ( Annotatable ) ) ;
157
157
}
158
158
159
159
impl < 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 ) )
161
161
{
162
162
fn expand ( & self ,
163
163
ecx : & mut ExtCtxt ,
164
164
sp : Span ,
165
165
meta_item : & ast:: MetaItem ,
166
166
item : & Annotatable ,
167
- push : & mut FnMut ( Annotatable ) ) {
167
+ push : & mut dyn FnMut ( Annotatable ) ) {
168
168
( * self ) ( ecx, sp, meta_item, item, push)
169
169
}
170
170
}
@@ -247,18 +247,19 @@ impl<F> AttrProcMacro for F
247
247
/// Represents a thing that maps token trees to Macro Results
248
248
pub trait TTMacroExpander {
249
249
fn expand < ' cx > ( & self , ecx : & ' cx mut ExtCtxt , span : Span , input : TokenStream )
250
- -> Box < MacResult +' cx > ;
250
+ -> Box < dyn MacResult +' cx > ;
251
251
}
252
252
253
253
pub type MacroExpanderFn =
254
254
for <' cx > fn ( & ' cx mut ExtCtxt , Span , & [ tokenstream:: TokenTree ] )
255
- -> Box < MacResult +' cx > ;
255
+ -> Box < dyn MacResult +' cx > ;
256
256
257
257
impl < 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 ] )
259
+ -> Box < dyn MacResult +' cx >
259
260
{
260
261
fn expand < ' cx > ( & self , ecx : & ' cx mut ExtCtxt , span : Span , input : TokenStream )
261
- -> Box < MacResult +' cx > {
262
+ -> Box < dyn MacResult +' cx > {
262
263
struct AvoidInterpolatedIdents ;
263
264
264
265
impl Folder for AvoidInterpolatedIdents {
@@ -289,23 +290,23 @@ pub trait IdentMacroExpander {
289
290
sp : Span ,
290
291
ident : ast:: Ident ,
291
292
token_tree : Vec < tokenstream:: TokenTree > )
292
- -> Box < MacResult +' cx > ;
293
+ -> Box < dyn MacResult +' cx > ;
293
294
}
294
295
295
296
pub type IdentMacroExpanderFn =
296
297
for <' cx > fn ( & ' cx mut ExtCtxt , Span , ast:: Ident , Vec < tokenstream:: TokenTree > )
297
- -> Box < MacResult +' cx > ;
298
+ -> Box < dyn MacResult +' cx > ;
298
299
299
300
impl < F > IdentMacroExpander for F
300
301
where F : for < ' cx > Fn ( & ' cx mut ExtCtxt , Span , ast:: Ident ,
301
- Vec < tokenstream:: TokenTree > ) -> Box < MacResult +' cx >
302
+ Vec < tokenstream:: TokenTree > ) -> Box < dyn MacResult +' cx >
302
303
{
303
304
fn expand < ' cx > ( & self ,
304
305
cx : & ' cx mut ExtCtxt ,
305
306
sp : Span ,
306
307
ident : ast:: Ident ,
307
308
token_tree : Vec < tokenstream:: TokenTree > )
308
- -> Box < MacResult +' cx >
309
+ -> Box < dyn MacResult +' cx >
309
310
{
310
311
( * self ) ( cx, sp, ident, token_tree)
311
312
}
@@ -378,7 +379,7 @@ macro_rules! make_MacEager {
378
379
379
380
impl MacEager {
380
381
$(
381
- pub fn $fld( v: $t) -> Box <MacResult > {
382
+ pub fn $fld( v: $t) -> Box <dyn MacResult > {
382
383
Box :: new( MacEager {
383
384
$fld: Some ( v) ,
384
385
..Default :: default ( )
@@ -462,7 +463,7 @@ impl DummyResult {
462
463
///
463
464
/// Use this as a return value after hitting any errors and
464
465
/// calling `span_err`.
465
- pub fn any ( sp : Span ) -> Box < MacResult +' static > {
466
+ pub fn any ( sp : Span ) -> Box < dyn MacResult +' static > {
466
467
Box :: new ( DummyResult { expr_only : false , span : sp } )
467
468
}
468
469
@@ -471,7 +472,7 @@ impl DummyResult {
471
472
/// Use this for macros that must expand to an expression, so even
472
473
/// if an error is encountered internally, the user will receive
473
474
/// an error that they also used it in the wrong place.
474
- pub fn expr ( sp : Span ) -> Box < MacResult +' static > {
475
+ pub fn expr ( sp : Span ) -> Box < dyn MacResult +' static > {
475
476
Box :: new ( DummyResult { expr_only : true , span : sp } )
476
477
}
477
478
@@ -559,7 +560,7 @@ impl MacResult for DummyResult {
559
560
}
560
561
561
562
pub type BuiltinDeriveFn =
562
- for <' cx > fn ( & ' cx mut ExtCtxt , Span , & MetaItem , & Annotatable , & mut FnMut ( Annotatable ) ) ;
563
+ for <' cx > fn ( & ' cx mut ExtCtxt , Span , & MetaItem , & Annotatable , & mut dyn FnMut ( Annotatable ) ) ;
563
564
564
565
/// Represents different kinds of macro invocations that can be resolved.
565
566
#[ derive( Clone , Copy , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug ) ]
@@ -590,15 +591,15 @@ pub enum SyntaxExtension {
590
591
/// `#[derive(...)]` is a `MultiItemDecorator`.
591
592
///
592
593
/// Prefer ProcMacro or MultiModifier since they are more flexible.
593
- MultiDecorator ( Box < MultiItemDecorator + sync:: Sync + sync:: Send > ) ,
594
+ MultiDecorator ( Box < dyn MultiItemDecorator + sync:: Sync + sync:: Send > ) ,
594
595
595
596
/// A syntax extension that is attached to an item and modifies it
596
597
/// in-place. Also allows decoration, i.e., creating new items.
597
- MultiModifier ( Box < MultiItemModifier + sync:: Sync + sync:: Send > ) ,
598
+ MultiModifier ( Box < dyn MultiItemModifier + sync:: Sync + sync:: Send > ) ,
598
599
599
600
/// A function-like procedural macro. TokenStream -> TokenStream.
600
601
ProcMacro {
601
- expander : Box < ProcMacro + sync:: Sync + sync:: Send > ,
602
+ expander : Box < dyn ProcMacro + sync:: Sync + sync:: Send > ,
602
603
allow_internal_unstable : bool ,
603
604
edition : Edition ,
604
605
} ,
@@ -607,13 +608,13 @@ pub enum SyntaxExtension {
607
608
/// The first TokenSteam is the attribute, the second is the annotated item.
608
609
/// Allows modification of the input items and adding new items, similar to
609
610
/// MultiModifier, but uses TokenStreams, rather than AST nodes.
610
- AttrProcMacro ( Box < AttrProcMacro + sync:: Sync + sync:: Send > , Edition ) ,
611
+ AttrProcMacro ( Box < dyn AttrProcMacro + sync:: Sync + sync:: Send > , Edition ) ,
611
612
612
613
/// A normal, function-like syntax extension.
613
614
///
614
615
/// `bytes!` is a `NormalTT`.
615
616
NormalTT {
616
- expander : Box < TTMacroExpander + sync:: Sync + sync:: Send > ,
617
+ expander : Box < dyn TTMacroExpander + sync:: Sync + sync:: Send > ,
617
618
def_info : Option < ( ast:: NodeId , Span ) > ,
618
619
/// Whether the contents of the macro can
619
620
/// directly use `#[unstable]` things (true == yes).
@@ -633,21 +634,21 @@ pub enum SyntaxExtension {
633
634
/// A function-like syntax extension that has an extra ident before
634
635
/// the block.
635
636
///
636
- IdentTT ( Box < IdentMacroExpander + sync:: Sync + sync:: Send > , Option < Span > , bool ) ,
637
+ IdentTT ( Box < dyn IdentMacroExpander + sync:: Sync + sync:: Send > , Option < Span > , bool ) ,
637
638
638
639
/// An attribute-like procedural macro. TokenStream -> TokenStream.
639
640
/// The input is the annotated item.
640
641
/// Allows generating code to implement a Trait for a given struct
641
642
/// or enum item.
642
- ProcMacroDerive ( Box < MultiItemModifier + sync:: Sync + sync:: Send > ,
643
+ ProcMacroDerive ( Box < dyn MultiItemModifier + sync:: Sync + sync:: Send > ,
643
644
Vec < Symbol > /* inert attribute names */ , Edition ) ,
644
645
645
646
/// An attribute-like procedural macro that derives a builtin trait.
646
647
BuiltinDerive ( BuiltinDeriveFn ) ,
647
648
648
649
/// A declarative macro, e.g. `macro m() {}`.
649
650
DeclMacro {
650
- expander : Box < TTMacroExpander + sync:: Sync + sync:: Send > ,
651
+ expander : Box < dyn TTMacroExpander + sync:: Sync + sync:: Send > ,
651
652
def_info : Option < ( ast:: NodeId , Span ) > ,
652
653
is_transparent : bool ,
653
654
edition : Edition ,
@@ -778,7 +779,7 @@ pub struct ExtCtxt<'a> {
778
779
pub parse_sess : & ' a parse:: ParseSess ,
779
780
pub ecfg : expand:: ExpansionConfig < ' a > ,
780
781
pub root_path : PathBuf ,
781
- pub resolver : & ' a mut Resolver ,
782
+ pub resolver : & ' a mut dyn Resolver ,
782
783
pub resolve_err_count : usize ,
783
784
pub current_expansion : ExpansionData ,
784
785
pub expansions : HashMap < Span , Vec < String > > ,
@@ -787,7 +788,7 @@ pub struct ExtCtxt<'a> {
787
788
impl < ' a > ExtCtxt < ' a > {
788
789
pub fn new ( parse_sess : & ' a parse:: ParseSess ,
789
790
ecfg : expand:: ExpansionConfig < ' a > ,
790
- resolver : & ' a mut Resolver )
791
+ resolver : & ' a mut dyn Resolver )
791
792
-> ExtCtxt < ' a > {
792
793
ExtCtxt {
793
794
parse_sess,
0 commit comments