@@ -123,32 +123,34 @@ impl<F> MultiItemDecorator for F
123123 }
124124}
125125
126- // A more flexible ItemKind::Modifier (ItemKind::Modifier should go away, eventually, FIXME).
127- // meta_item is the annotation, item is the item being modified, parent_item
128- // is the impl or trait item is declared in if item is part of such a thing.
126+ // `meta_item` is the annotation, and `item` is the item being modified.
129127// FIXME Decorators should follow the same pattern too.
130128pub trait MultiItemModifier {
131129 fn expand ( & self ,
132130 ecx : & mut ExtCtxt ,
133131 span : Span ,
134132 meta_item : & ast:: MetaItem ,
135133 item : Annotatable )
136- -> Annotatable ;
134+ -> Vec < Annotatable > ;
137135}
138136
139- impl < F > MultiItemModifier for F
140- where F : Fn ( & mut ExtCtxt ,
141- Span ,
142- & ast:: MetaItem ,
143- Annotatable ) -> Annotatable
137+ impl < F , T > MultiItemModifier for F
138+ where F : Fn ( & mut ExtCtxt , Span , & ast:: MetaItem , Annotatable ) -> T ,
139+ T : Into < Vec < Annotatable > > ,
144140{
145141 fn expand ( & self ,
146142 ecx : & mut ExtCtxt ,
147143 span : Span ,
148144 meta_item : & ast:: MetaItem ,
149145 item : Annotatable )
150- -> Annotatable {
151- ( * self ) ( ecx, span, meta_item, item)
146+ -> Vec < Annotatable > {
147+ ( * self ) ( ecx, span, meta_item, item) . into ( )
148+ }
149+ }
150+
151+ impl Into < Vec < Annotatable > > for Annotatable {
152+ fn into ( self ) -> Vec < Annotatable > {
153+ vec ! [ self ]
152154 }
153155}
154156
0 commit comments