-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-pluginsArea: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.htmlArea: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.htmlC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.
Description
pub trait ItemDecorator {
fn expand(&self, ecx: &mut ExtCtxt, sp: Span, meta_item: &MetaItem, item: &Item, push: &mut FnMut(P<Item>));
}
is deprecated in favor of
pub trait MultiItemDecorator {
fn expand(&self, ecx: &mut ExtCtxt, sp: Span, meta_item: &MetaItem, item: Annotatable, push: &mut FnMut(Annotatable));
}
The new version takes the thing being decorated by-move, and this is achieved by a clone. The clone is totally unnecessary; a decorator doesn't modify the original item and should be fine with a simple reference to it.
This probably causes a lot of unnecessary clones since MultiDecorators are used everywhere in the form of #[derive]
.
Should we make this &Annotatable
and remove the clone?
Metadata
Metadata
Assignees
Labels
A-pluginsArea: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.htmlArea: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.htmlC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.