@@ -123,32 +123,34 @@ impl<F> MultiItemDecorator for F
123
123
}
124
124
}
125
125
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.
129
127
// FIXME Decorators should follow the same pattern too.
130
128
pub trait MultiItemModifier {
131
129
fn expand ( & self ,
132
130
ecx : & mut ExtCtxt ,
133
131
span : Span ,
134
132
meta_item : & ast:: MetaItem ,
135
133
item : Annotatable )
136
- -> Annotatable ;
134
+ -> Vec < Annotatable > ;
137
135
}
138
136
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 > > ,
144
140
{
145
141
fn expand ( & self ,
146
142
ecx : & mut ExtCtxt ,
147
143
span : Span ,
148
144
meta_item : & ast:: MetaItem ,
149
145
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 ]
152
154
}
153
155
}
154
156
0 commit comments