Skip to content

Commit 97f4e70

Browse files
committed
syntax: Remove SyntaxExtension::IdentTT and IdentMacroExpander
1 parent a73ecb3 commit 97f4e70

File tree

3 files changed

+1
-64
lines changed

3 files changed

+1
-64
lines changed

src/librustc_plugin/registry.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc::lint::{EarlyLintPassObject, LateLintPassObject, LintId, Lint};
44
use rustc::session::Session;
55
use rustc::util::nodemap::FxHashMap;
66

7-
use syntax::ext::base::{SyntaxExtension, NamedSyntaxExtension, NormalTT, IdentTT};
7+
use syntax::ext::base::{SyntaxExtension, NamedSyntaxExtension, NormalTT};
88
use syntax::ext::base::MacroExpanderFn;
99
use syntax::symbol::{Symbol, sym};
1010
use syntax::ast;
@@ -109,9 +109,6 @@ impl<'a> Registry<'a> {
109109
edition,
110110
}
111111
}
112-
IdentTT { expander, span: _, allow_internal_unstable } => {
113-
IdentTT { expander, span: Some(self.krate_span), allow_internal_unstable }
114-
}
115112
_ => extension,
116113
}));
117114
}

src/libsyntax/ext/base.rs

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -288,34 +288,6 @@ impl<F> TTMacroExpander for F
288288
}
289289
}
290290

291-
pub trait IdentMacroExpander {
292-
fn expand<'cx>(&self,
293-
cx: &'cx mut ExtCtxt<'_>,
294-
sp: Span,
295-
ident: ast::Ident,
296-
token_tree: Vec<tokenstream::TokenTree>)
297-
-> Box<dyn MacResult+'cx>;
298-
}
299-
300-
pub type IdentMacroExpanderFn =
301-
for<'cx> fn(&'cx mut ExtCtxt<'_>, Span, ast::Ident, Vec<tokenstream::TokenTree>)
302-
-> Box<dyn MacResult+'cx>;
303-
304-
impl<F> IdentMacroExpander for F
305-
where F : for<'cx> Fn(&'cx mut ExtCtxt<'_>, Span, ast::Ident,
306-
Vec<tokenstream::TokenTree>) -> Box<dyn MacResult+'cx>
307-
{
308-
fn expand<'cx>(&self,
309-
cx: &'cx mut ExtCtxt<'_>,
310-
sp: Span,
311-
ident: ast::Ident,
312-
token_tree: Vec<tokenstream::TokenTree>)
313-
-> Box<dyn MacResult+'cx>
314-
{
315-
(*self)(cx, sp, ident, token_tree)
316-
}
317-
}
318-
319291
// Use a macro because forwarding to a simple function has type system issues
320292
macro_rules! make_stmts_default {
321293
($me:expr) => {
@@ -658,14 +630,6 @@ pub enum SyntaxExtension {
658630
edition: Edition,
659631
},
660632

661-
/// A function-like syntax extension that has an extra ident before
662-
/// the block.
663-
IdentTT {
664-
expander: Box<dyn IdentMacroExpander + sync::Sync + sync::Send>,
665-
span: Option<Span>,
666-
allow_internal_unstable: Option<Lrc<[Symbol]>>,
667-
},
668-
669633
/// An attribute-like procedural macro. TokenStream -> TokenStream.
670634
/// The input is the annotated item.
671635
/// Allows generating code to implement a Trait for a given struct
@@ -691,7 +655,6 @@ impl SyntaxExtension {
691655
match *self {
692656
SyntaxExtension::DeclMacro { .. } |
693657
SyntaxExtension::NormalTT { .. } |
694-
SyntaxExtension::IdentTT { .. } |
695658
SyntaxExtension::ProcMacro { .. } =>
696659
MacroKind::Bang,
697660
SyntaxExtension::NonMacroAttr { .. } |
@@ -725,7 +688,6 @@ impl SyntaxExtension {
725688
SyntaxExtension::ProcMacroDerive(.., edition) => edition,
726689
// Unstable legacy stuff
727690
SyntaxExtension::NonMacroAttr { .. } |
728-
SyntaxExtension::IdentTT { .. } |
729691
SyntaxExtension::MultiDecorator(..) |
730692
SyntaxExtension::MultiModifier(..) |
731693
SyntaxExtension::BuiltinDerive(..) => default_edition,

src/libsyntax/ext/expand.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -791,28 +791,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
791791
}
792792
}
793793

794-
IdentTT { ref expander, span: tt_span, ref allow_internal_unstable } => {
795-
if ident.name == kw::Invalid {
796-
self.cx.span_err(path.span,
797-
&format!("macro {}! expects an ident argument", path));
798-
self.cx.trace_macros_diag();
799-
kind.dummy(span)
800-
} else {
801-
invoc.expansion_data.mark.set_expn_info(ExpnInfo {
802-
call_site: span,
803-
def_site: tt_span,
804-
format: macro_bang_format(path),
805-
allow_internal_unstable: allow_internal_unstable.clone(),
806-
allow_internal_unsafe: false,
807-
local_inner_macros: false,
808-
edition: self.cx.parse_sess.edition,
809-
});
810-
811-
let input: Vec<_> = mac.node.stream().into_trees().collect();
812-
kind.make_from(expander.expand(self.cx, span, ident, input))
813-
}
814-
}
815-
816794
MultiDecorator(..) | MultiModifier(..) |
817795
AttrProcMacro(..) | SyntaxExtension::NonMacroAttr { .. } => {
818796
self.cx.span_err(path.span,

0 commit comments

Comments
 (0)