1
Fork 0

rustc_span: Revert addition of proc_macro field to ExpnKind::Macro

The flag has a vague meaning and is used for a single diagnostic change that is low benefit and appears only under `-Z macro_backtrace`.
This commit is contained in:
Vadim Petrochenkov 2021-07-10 22:14:52 +03:00
parent a31431fce7
commit 28f4dba438
19 changed files with 37 additions and 118 deletions

View file

@ -144,10 +144,7 @@ impl ExpnId {
let expn_data = self.expn_data();
// Stop going up the backtrace once include! is encountered
if expn_data.is_root()
|| matches!(
expn_data.kind,
ExpnKind::Macro { kind: MacroKind::Bang, name: sym::include, proc_macro: _ }
)
|| expn_data.kind == ExpnKind::Macro(MacroKind::Bang, sym::include)
{
break;
}
@ -850,13 +847,7 @@ pub enum ExpnKind {
/// No expansion, aka root expansion. Only `ExpnId::root()` has this kind.
Root,
/// Expansion produced by a macro.
Macro {
kind: MacroKind,
name: Symbol,
/// If `true`, this macro is a procedural macro. This
/// flag is only used for diagnostic purposes
proc_macro: bool,
},
Macro(MacroKind, Symbol),
/// Transform done by the compiler on the AST.
AstPass(AstPass),
/// Desugaring done by the compiler during HIR lowering.
@ -869,7 +860,7 @@ impl ExpnKind {
pub fn descr(&self) -> String {
match *self {
ExpnKind::Root => kw::PathRoot.to_string(),
ExpnKind::Macro { kind, name, proc_macro: _ } => match kind {
ExpnKind::Macro(macro_kind, name) => match macro_kind {
MacroKind::Bang => format!("{}!", name),
MacroKind::Attr => format!("#[{}]", name),
MacroKind::Derive => format!("#[derive({})]", name),