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

@ -811,16 +811,8 @@ impl SyntaxExtension {
macro_def_id: Option<DefId>,
parent_module: Option<DefId>,
) -> ExpnData {
use SyntaxExtensionKind::*;
let proc_macro = match self.kind {
// User-defined proc macro
Bang(..) | Attr(..) | Derive(..) => true,
// Consider everthing else to be not a proc
// macro for diagnostic purposes
LegacyBang(..) | LegacyAttr(..) | NonMacroAttr { .. } | LegacyDerive(..) => false,
};
ExpnData::new(
ExpnKind::Macro { kind: self.macro_kind(), name: descr, proc_macro },
ExpnKind::Macro(self.macro_kind(), descr),
parent,
call_site,
self.span,

View file

@ -812,7 +812,7 @@ fn ident_name_compatibility_hack(
rustc: &mut Rustc<'_>,
) -> Option<(rustc_span::symbol::Ident, bool)> {
if let NtIdent(ident, is_raw) = nt {
if let ExpnKind::Macro { name: macro_name, .. } = orig_span.ctxt().outer_expn_data().kind {
if let ExpnKind::Macro(_, macro_name) = orig_span.ctxt().outer_expn_data().kind {
let source_map = rustc.sess.source_map();
let filename = source_map.span_to_filename(orig_span);
if let FileName::Real(RealFileName::LocalPath(path)) = filename {