Skip to content

Commit 97a5173

Browse files
committed
syntax: Remove SyntaxExtension::IdentTT and IdentMacroExpander
1 parent 8b36867 commit 97a5173

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
@@ -285,34 +285,6 @@ impl<F> TTMacroExpander for F
285285
}
286286
}
287287

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

658-
/// A function-like syntax extension that has an extra ident before
659-
/// the block.
660-
IdentTT {
661-
expander: Box<dyn IdentMacroExpander + sync::Sync + sync::Send>,
662-
span: Option<Span>,
663-
allow_internal_unstable: Option<Lrc<[Symbol]>>,
664-
},
665-
666630
/// An attribute-like procedural macro. TokenStream -> TokenStream.
667631
/// The input is the annotated item.
668632
/// Allows generating code to implement a Trait for a given struct
@@ -688,7 +652,6 @@ impl SyntaxExtension {
688652
match *self {
689653
SyntaxExtension::DeclMacro { .. } |
690654
SyntaxExtension::NormalTT { .. } |
691-
SyntaxExtension::IdentTT { .. } |
692655
SyntaxExtension::ProcMacro { .. } =>
693656
MacroKind::Bang,
694657
SyntaxExtension::NonMacroAttr { .. } |
@@ -722,7 +685,6 @@ impl SyntaxExtension {
722685
SyntaxExtension::ProcMacroDerive(.., edition) => edition,
723686
// Unstable legacy stuff
724687
SyntaxExtension::NonMacroAttr { .. } |
725-
SyntaxExtension::IdentTT { .. } |
726688
SyntaxExtension::MultiDecorator(..) |
727689
SyntaxExtension::MultiModifier(..) |
728690
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)