Skip to content

Commit 4419af8

Browse files
committed
Remove SyntaxExtension::MultiDecorator and MultiItemDecorator
1 parent 97a5173 commit 4419af8

File tree

9 files changed

+1
-410
lines changed

9 files changed

+1
-410
lines changed

src/libsyntax/ext/base.rs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -137,29 +137,6 @@ impl Annotatable {
137137
}
138138
}
139139

140-
// A more flexible ItemDecorator.
141-
pub trait MultiItemDecorator {
142-
fn expand(&self,
143-
ecx: &mut ExtCtxt<'_>,
144-
sp: Span,
145-
meta_item: &ast::MetaItem,
146-
item: &Annotatable,
147-
push: &mut dyn FnMut(Annotatable));
148-
}
149-
150-
impl<F> MultiItemDecorator for F
151-
where F : Fn(&mut ExtCtxt<'_>, Span, &ast::MetaItem, &Annotatable, &mut dyn FnMut(Annotatable))
152-
{
153-
fn expand(&self,
154-
ecx: &mut ExtCtxt<'_>,
155-
sp: Span,
156-
meta_item: &ast::MetaItem,
157-
item: &Annotatable,
158-
push: &mut dyn FnMut(Annotatable)) {
159-
(*self)(ecx, sp, meta_item, item, push)
160-
}
161-
}
162-
163140
// `meta_item` is the annotation, and `item` is the item being modified.
164141
// FIXME Decorators should follow the same pattern too.
165142
pub trait MultiItemModifier {
@@ -578,14 +555,6 @@ pub enum SyntaxExtension {
578555
/// A trivial "extension" that does nothing, only keeps the attribute and marks it as known.
579556
NonMacroAttr { mark_used: bool },
580557

581-
/// A syntax extension that is attached to an item and creates new items
582-
/// based upon it.
583-
///
584-
/// `#[derive(...)]` is a `MultiItemDecorator`.
585-
///
586-
/// Prefer ProcMacro or MultiModifier since they are more flexible.
587-
MultiDecorator(Box<dyn MultiItemDecorator + sync::Sync + sync::Send>),
588-
589558
/// A syntax extension that is attached to an item and modifies it
590559
/// in-place. Also allows decoration, i.e., creating new items.
591560
MultiModifier(Box<dyn MultiItemModifier + sync::Sync + sync::Send>),
@@ -655,7 +624,6 @@ impl SyntaxExtension {
655624
SyntaxExtension::ProcMacro { .. } =>
656625
MacroKind::Bang,
657626
SyntaxExtension::NonMacroAttr { .. } |
658-
SyntaxExtension::MultiDecorator(..) |
659627
SyntaxExtension::MultiModifier(..) |
660628
SyntaxExtension::AttrProcMacro(..) =>
661629
MacroKind::Attr,
@@ -685,7 +653,6 @@ impl SyntaxExtension {
685653
SyntaxExtension::ProcMacroDerive(.., edition) => edition,
686654
// Unstable legacy stuff
687655
SyntaxExtension::NonMacroAttr { .. } |
688-
SyntaxExtension::MultiDecorator(..) |
689656
SyntaxExtension::MultiModifier(..) |
690657
SyntaxExtension::BuiltinDerive(..) => default_edition,
691658
}

src/libsyntax/ext/expand.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -575,14 +575,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
575575
let item = mac.expand(self.cx, attr.span, &meta, item);
576576
Some(invoc.fragment_kind.expect_from_annotatables(item))
577577
}
578-
MultiDecorator(ref mac) => {
579-
let mut items = Vec::new();
580-
let meta = attr.parse_meta(self.cx.parse_sess)
581-
.expect("derive meta should already have been parsed");
582-
mac.expand(self.cx, attr.span, &meta, &item, &mut |item| items.push(item));
583-
items.push(item);
584-
Some(invoc.fragment_kind.expect_from_annotatables(items))
585-
}
586578
AttrProcMacro(ref mac, ..) => {
587579
self.gate_proc_macro_attr_item(attr.span, &item);
588580
let item_tok = TokenTree::Token(DUMMY_SP, Token::Interpolated(Lrc::new(match item {
@@ -791,8 +783,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
791783
}
792784
}
793785

794-
MultiDecorator(..) | MultiModifier(..) |
795-
AttrProcMacro(..) | SyntaxExtension::NonMacroAttr { .. } => {
786+
MultiModifier(..) | AttrProcMacro(..) | SyntaxExtension::NonMacroAttr { .. } => {
796787
self.cx.span_err(path.span,
797788
&format!("`{}` can only be used in attributes", path));
798789
self.cx.trace_macros_diag();

src/test/run-pass-fulldeps/auxiliary/custom-derive-partial-eq.rs

Lines changed: 0 additions & 71 deletions
This file was deleted.

src/test/run-pass-fulldeps/auxiliary/custom-derive-plugin-attr.rs

Lines changed: 0 additions & 84 deletions
This file was deleted.

src/test/run-pass-fulldeps/auxiliary/custom-derive-plugin.rs

Lines changed: 0 additions & 76 deletions
This file was deleted.

src/test/run-pass-fulldeps/custom-derive-partial-eq.rs

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/test/run-pass-fulldeps/derive-totalsum-attr.rs

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)