summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_expand
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
commit1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch)
tree3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /compiler/rustc_expand
parentReleasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz
rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_expand')
-rw-r--r--compiler/rustc_expand/messages.ftl (renamed from compiler/rustc_expand/locales/en-US.ftl)2
-rw-r--r--compiler/rustc_expand/src/base.rs24
-rw-r--r--compiler/rustc_expand/src/build.rs20
-rw-r--r--compiler/rustc_expand/src/config.rs73
-rw-r--r--compiler/rustc_expand/src/expand.rs18
-rw-r--r--compiler/rustc_expand/src/lib.rs2
-rw-r--r--compiler/rustc_expand/src/mbe/diagnostics.rs41
-rw-r--r--compiler/rustc_expand/src/mbe/metavar_expr.rs2
-rw-r--r--compiler/rustc_expand/src/mbe/transcribe.rs2
-rw-r--r--compiler/rustc_expand/src/proc_macro.rs10
10 files changed, 108 insertions, 86 deletions
diff --git a/compiler/rustc_expand/locales/en-US.ftl b/compiler/rustc_expand/messages.ftl
index cfae781bd..5d999d0db 100644
--- a/compiler/rustc_expand/locales/en-US.ftl
+++ b/compiler/rustc_expand/messages.ftl
@@ -135,4 +135,4 @@ expand_proc_macro_panicked =
.help = message: {$message}
expand_proc_macro_derive_tokens =
- proc-macro derive produced unparseable tokens
+ proc-macro derive produced unparsable tokens
diff --git a/compiler/rustc_expand/src/base.rs b/compiler/rustc_expand/src/base.rs
index 22bc90f5c..caa2a201c 100644
--- a/compiler/rustc_expand/src/base.rs
+++ b/compiler/rustc_expand/src/base.rs
@@ -12,13 +12,13 @@ use rustc_ast::tokenstream::TokenStream;
use rustc_ast::visit::{AssocCtxt, Visitor};
use rustc_ast::{self as ast, AttrVec, Attribute, HasAttrs, Item, NodeId, PatKind};
use rustc_attr::{self as attr, Deprecation, Stability};
-use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
+use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::sync::{self, Lrc};
use rustc_errors::{
Applicability, DiagnosticBuilder, ErrorGuaranteed, IntoDiagnostic, MultiSpan, PResult,
};
use rustc_lint_defs::builtin::PROC_MACRO_BACK_COMPAT;
-use rustc_lint_defs::{BufferedEarlyLint, BuiltinLintDiagnostics};
+use rustc_lint_defs::{BufferedEarlyLint, BuiltinLintDiagnostics, RegisteredTools};
use rustc_parse::{self, parser, MACRO_ARGUMENTS};
use rustc_session::errors::report_lit_error;
use rustc_session::{parse::ParseSess, Limit, Session};
@@ -776,16 +776,14 @@ impl SyntaxExtension {
let allow_internal_unstable =
attr::allow_internal_unstable(sess, &attrs).collect::<Vec<Symbol>>();
- let allow_internal_unsafe = sess.contains_name(attrs, sym::allow_internal_unsafe);
- let local_inner_macros = sess
- .find_by_name(attrs, sym::macro_export)
+ let allow_internal_unsafe = attr::contains_name(attrs, sym::allow_internal_unsafe);
+ let local_inner_macros = attr::find_by_name(attrs, sym::macro_export)
.and_then(|macro_export| macro_export.meta_item_list())
.map_or(false, |l| attr::list_contains_name(&l, sym::local_inner_macros));
- let collapse_debuginfo = sess.contains_name(attrs, sym::collapse_debuginfo);
+ let collapse_debuginfo = attr::contains_name(attrs, sym::collapse_debuginfo);
tracing::debug!(?local_inner_macros, ?collapse_debuginfo, ?allow_internal_unsafe);
- let (builtin_name, helper_attrs) = sess
- .find_by_name(attrs, sym::rustc_builtin_macro)
+ let (builtin_name, helper_attrs) = attr::find_by_name(attrs, sym::rustc_builtin_macro)
.map(|attr| {
// Override `helper_attrs` passed above if it's a built-in macro,
// marking `proc_macro_derive` macros as built-in is not a realistic use case.
@@ -795,7 +793,9 @@ impl SyntaxExtension {
)
})
.unwrap_or_else(|| (None, helper_attrs));
- let (stability, const_stability, body_stability) = attr::find_stability(&sess, attrs, span);
+ let stability = attr::find_stability(&sess, attrs, span);
+ let const_stability = attr::find_const_stability(&sess, attrs, span);
+ let body_stability = attr::find_body_stability(&sess, attrs);
if let Some((_, sp)) = const_stability {
sess.emit_err(errors::MacroConstStability {
span: sp,
@@ -947,14 +947,14 @@ pub trait ResolverExpand {
fn declare_proc_macro(&mut self, id: NodeId);
/// Tools registered with `#![register_tool]` and used by tool attributes and lints.
- fn registered_tools(&self) -> &FxHashSet<Ident>;
+ fn registered_tools(&self) -> &RegisteredTools;
}
pub trait LintStoreExpand {
fn pre_expansion_lint(
&self,
sess: &Session,
- registered_tools: &FxHashSet<Ident>,
+ registered_tools: &RegisteredTools,
node_id: NodeId,
attrs: &[Attribute],
items: &[P<Item>],
@@ -1004,6 +1004,7 @@ pub struct ExpansionData {
pub struct ExtCtxt<'a> {
pub sess: &'a Session,
pub ecfg: expand::ExpansionConfig<'a>,
+ pub num_standard_library_imports: usize,
pub reduced_recursion_limit: Option<Limit>,
pub root_path: PathBuf,
pub resolver: &'a mut dyn ResolverExpand,
@@ -1032,6 +1033,7 @@ impl<'a> ExtCtxt<'a> {
ExtCtxt {
sess,
ecfg,
+ num_standard_library_imports: 0,
reduced_recursion_limit: None,
resolver,
lint_store,
diff --git a/compiler/rustc_expand/src/build.rs b/compiler/rustc_expand/src/build.rs
index 8a78c3296..264f30fb1 100644
--- a/compiler/rustc_expand/src/build.rs
+++ b/compiler/rustc_expand/src/build.rs
@@ -36,7 +36,7 @@ impl<'a> ExtCtxt<'a> {
);
let args = if !args.is_empty() {
let args = args.into_iter().map(ast::AngleBracketedArg::Arg).collect();
- ast::AngleBracketedArgs { args, span }.into()
+ Some(ast::AngleBracketedArgs { args, span }.into())
} else {
None
};
@@ -620,10 +620,15 @@ impl<'a> ExtCtxt<'a> {
span: Span,
name: Ident,
ty: P<ast::Ty>,
- mutbl: ast::Mutability,
+ mutability: ast::Mutability,
expr: P<ast::Expr>,
) -> P<ast::Item> {
- self.item(span, name, AttrVec::new(), ast::ItemKind::Static(ty, mutbl, Some(expr)))
+ self.item(
+ span,
+ name,
+ AttrVec::new(),
+ ast::ItemKind::Static(ast::StaticItem { ty, mutability, expr: Some(expr) }.into()),
+ )
}
pub fn item_const(
@@ -633,8 +638,13 @@ impl<'a> ExtCtxt<'a> {
ty: P<ast::Ty>,
expr: P<ast::Expr>,
) -> P<ast::Item> {
- let def = ast::Defaultness::Final;
- self.item(span, name, AttrVec::new(), ast::ItemKind::Const(def, ty, Some(expr)))
+ let defaultness = ast::Defaultness::Final;
+ self.item(
+ span,
+ name,
+ AttrVec::new(),
+ ast::ItemKind::Const(ast::ConstItem { defaultness, ty, expr: Some(expr) }.into()),
+ )
}
// Builds `#[name]`.
diff --git a/compiler/rustc_expand/src/config.rs b/compiler/rustc_expand/src/config.rs
index 01500c2c7..4ff8e409d 100644
--- a/compiler/rustc_expand/src/config.rs
+++ b/compiler/rustc_expand/src/config.rs
@@ -12,8 +12,8 @@ use rustc_ast::tokenstream::{LazyAttrTokenStream, TokenTree};
use rustc_ast::NodeId;
use rustc_ast::{self as ast, AttrStyle, Attribute, HasAttrs, HasTokens, MetaItem};
use rustc_attr as attr;
+use rustc_data_structures::flat_map_in_place::FlatMapInPlace;
use rustc_data_structures::fx::FxHashMap;
-use rustc_data_structures::map_in_place::MapInPlace;
use rustc_feature::{Feature, Features, State as FeatureState};
use rustc_feature::{
ACCEPTED_FEATURES, ACTIVE_FEATURES, REMOVED_FEATURES, STABLE_REMOVED_FEATURES,
@@ -24,7 +24,6 @@ use rustc_session::Session;
use rustc_span::edition::{Edition, ALL_EDITIONS};
use rustc_span::symbol::{sym, Symbol};
use rustc_span::{Span, DUMMY_SP};
-use thin_vec::ThinVec;
/// A folder that strips out items that do not belong in the current configuration.
pub struct StripUnconfigured<'a> {
@@ -37,7 +36,7 @@ pub struct StripUnconfigured<'a> {
pub lint_node_id: NodeId,
}
-fn get_features(sess: &Session, krate_attrs: &[ast::Attribute]) -> Features {
+pub fn features(sess: &Session, krate_attrs: &[Attribute]) -> Features {
fn feature_removed(sess: &Session, span: Span, reason: Option<&str>) {
sess.emit_err(FeatureRemoved {
span,
@@ -191,39 +190,16 @@ fn get_features(sess: &Session, krate_attrs: &[ast::Attribute]) -> Features {
features
}
-/// `cfg_attr`-process the crate's attributes and compute the crate's features.
-pub fn features(
- sess: &Session,
- mut krate: ast::Crate,
- lint_node_id: NodeId,
-) -> (ast::Crate, Features) {
- let mut strip_unconfigured =
- StripUnconfigured { sess, features: None, config_tokens: false, lint_node_id };
-
- let unconfigured_attrs = krate.attrs.clone();
- let diag = &sess.parse_sess.span_diagnostic;
- let err_count = diag.err_count();
- let features = match strip_unconfigured.configure_krate_attrs(krate.attrs) {
- None => {
- // The entire crate is unconfigured.
- krate.attrs = ast::AttrVec::new();
- krate.items = ThinVec::new();
- Features::default()
- }
- Some(attrs) => {
- krate.attrs = attrs;
- let features = get_features(sess, &krate.attrs);
- if err_count == diag.err_count() {
- // Avoid reconfiguring malformed `cfg_attr`s.
- strip_unconfigured.features = Some(&features);
- // Run configuration again, this time with features available
- // so that we can perform feature-gating.
- strip_unconfigured.configure_krate_attrs(unconfigured_attrs);
- }
- features
- }
+pub fn pre_configure_attrs(sess: &Session, attrs: &[Attribute]) -> ast::AttrVec {
+ let strip_unconfigured = StripUnconfigured {
+ sess,
+ features: None,
+ config_tokens: false,
+ lint_node_id: ast::CRATE_NODE_ID,
};
- (krate, features)
+ let attrs: ast::AttrVec =
+ attrs.iter().flat_map(|attr| strip_unconfigured.process_cfg_attr(attr)).collect();
+ if strip_unconfigured.in_cfg(&attrs) { attrs } else { ast::AttrVec::new() }
}
#[macro_export]
@@ -254,11 +230,6 @@ impl<'a> StripUnconfigured<'a> {
}
}
- fn configure_krate_attrs(&self, mut attrs: ast::AttrVec) -> Option<ast::AttrVec> {
- attrs.flat_map_in_place(|attr| self.process_cfg_attr(attr));
- self.in_cfg(&attrs).then_some(attrs)
- }
-
/// Performs cfg-expansion on `stream`, producing a new `AttrTokenStream`.
/// This is only used during the invocation of `derive` proc-macros,
/// which require that we cfg-expand their entire input.
@@ -281,7 +252,7 @@ impl<'a> StripUnconfigured<'a> {
.iter()
.flat_map(|tree| match tree.clone() {
AttrTokenTree::Attributes(mut data) => {
- data.attrs.flat_map_in_place(|attr| self.process_cfg_attr(attr));
+ data.attrs.flat_map_in_place(|attr| self.process_cfg_attr(&attr));
if self.in_cfg(&data.attrs) {
data.tokens = LazyAttrTokenStream::new(
@@ -319,12 +290,16 @@ impl<'a> StripUnconfigured<'a> {
/// the syntax of any `cfg_attr` is incorrect.
fn process_cfg_attrs<T: HasAttrs>(&self, node: &mut T) {
node.visit_attrs(|attrs| {
- attrs.flat_map_in_place(|attr| self.process_cfg_attr(attr));
+ attrs.flat_map_in_place(|attr| self.process_cfg_attr(&attr));
});
}
- fn process_cfg_attr(&self, attr: Attribute) -> Vec<Attribute> {
- if attr.has_name(sym::cfg_attr) { self.expand_cfg_attr(attr, true) } else { vec![attr] }
+ fn process_cfg_attr(&self, attr: &Attribute) -> Vec<Attribute> {
+ if attr.has_name(sym::cfg_attr) {
+ self.expand_cfg_attr(attr, true)
+ } else {
+ vec![attr.clone()]
+ }
}
/// Parse and expand a single `cfg_attr` attribute into a list of attributes
@@ -334,9 +309,9 @@ impl<'a> StripUnconfigured<'a> {
/// Gives a compiler warning when the `cfg_attr` contains no attributes and
/// is in the original source file. Gives a compiler error if the syntax of
/// the attribute is incorrect.
- pub(crate) fn expand_cfg_attr(&self, attr: Attribute, recursive: bool) -> Vec<Attribute> {
+ pub(crate) fn expand_cfg_attr(&self, attr: &Attribute, recursive: bool) -> Vec<Attribute> {
let Some((cfg_predicate, expanded_attrs)) =
- rustc_parse::parse_cfg_attr(&attr, &self.sess.parse_sess) else {
+ rustc_parse::parse_cfg_attr(attr, &self.sess.parse_sess) else {
return vec![];
};
@@ -365,10 +340,10 @@ impl<'a> StripUnconfigured<'a> {
// `#[cfg_attr(false, cfg_attr(true, some_attr))]`.
expanded_attrs
.into_iter()
- .flat_map(|item| self.process_cfg_attr(self.expand_cfg_attr_item(&attr, item)))
+ .flat_map(|item| self.process_cfg_attr(&self.expand_cfg_attr_item(attr, item)))
.collect()
} else {
- expanded_attrs.into_iter().map(|item| self.expand_cfg_attr_item(&attr, item)).collect()
+ expanded_attrs.into_iter().map(|item| self.expand_cfg_attr_item(attr, item)).collect()
}
}
@@ -491,7 +466,7 @@ impl<'a> StripUnconfigured<'a> {
//
// N.B., this is intentionally not part of the visit_expr() function
// in order for filter_map_expr() to be able to avoid this check
- if let Some(attr) = expr.attrs().iter().find(|a| is_cfg(*a)) {
+ if let Some(attr) = expr.attrs().iter().find(|a| is_cfg(a)) {
self.sess.emit_err(RemoveExprNotSupported { span: attr.span });
}
diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs
index 79d058d9c..ec4091154 100644
--- a/compiler/rustc_expand/src/expand.rs
+++ b/compiler/rustc_expand/src/expand.rs
@@ -20,7 +20,7 @@ use rustc_ast::{ForeignItemKind, HasAttrs, HasNodeId};
use rustc_ast::{Inline, ItemKind, MacStmtStyle, MetaItemKind, ModKind};
use rustc_ast::{NestedMetaItem, NodeId, PatKind, StmtKind, TyKind};
use rustc_ast_pretty::pprust;
-use rustc_data_structures::map_in_place::MapInPlace;
+use rustc_data_structures::flat_map_in_place::FlatMapInPlace;
use rustc_data_structures::sync::Lrc;
use rustc_errors::PResult;
use rustc_feature::Features;
@@ -1038,6 +1038,9 @@ trait InvocationCollectorNode: HasAttrs + HasNodeId + Sized {
) -> Result<Self::OutputTy, Self> {
Ok(noop_flat_map(node, collector))
}
+ fn expand_cfg_false(&mut self, collector: &mut InvocationCollector<'_, '_>, span: Span) {
+ collector.cx.emit_err(RemoveNodeNotSupported { span, descr: Self::descr() });
+ }
}
impl InvocationCollectorNode for P<ast::Item> {
@@ -1378,6 +1381,11 @@ impl InvocationCollectorNode for ast::Crate {
fn noop_visit<V: MutVisitor>(&mut self, visitor: &mut V) {
noop_visit_crate(self, visitor)
}
+ fn expand_cfg_false(&mut self, collector: &mut InvocationCollector<'_, '_>, _span: Span) {
+ self.attrs.clear();
+ // Standard prelude imports are left in the crate for backward compatibility.
+ self.items.truncate(collector.cx.num_standard_library_imports);
+ }
}
impl InvocationCollectorNode for P<ast::Ty> {
@@ -1688,7 +1696,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
res
}
- fn expand_cfg_attr(&self, node: &mut impl HasAttrs, attr: ast::Attribute, pos: usize) {
+ fn expand_cfg_attr(&self, node: &mut impl HasAttrs, attr: &ast::Attribute, pos: usize) {
node.visit_attrs(|attrs| {
// Repeated `insert` calls is inefficient, but the number of
// insertions is almost always 0 or 1 in practice.
@@ -1712,7 +1720,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
Default::default()
}
sym::cfg_attr => {
- self.expand_cfg_attr(&mut node, attr, pos);
+ self.expand_cfg_attr(&mut node, &attr, pos);
continue;
}
_ => {
@@ -1756,11 +1764,11 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
continue;
}
- self.cx.emit_err(RemoveNodeNotSupported { span, descr: Node::descr() });
+ node.expand_cfg_false(self, span);
continue;
}
sym::cfg_attr => {
- self.expand_cfg_attr(node, attr, pos);
+ self.expand_cfg_attr(node, &attr, pos);
continue;
}
_ => visit_clobber(node, |node| {
diff --git a/compiler/rustc_expand/src/lib.rs b/compiler/rustc_expand/src/lib.rs
index 634e206e5..ced7531c3 100644
--- a/compiler/rustc_expand/src/lib.rs
+++ b/compiler/rustc_expand/src/lib.rs
@@ -64,4 +64,4 @@ mod mut_visit {
mod tests;
}
-fluent_messages! { "../locales/en-US.ftl" }
+fluent_messages! { "../messages.ftl" }
diff --git a/compiler/rustc_expand/src/mbe/diagnostics.rs b/compiler/rustc_expand/src/mbe/diagnostics.rs
index f469b2dae..355722922 100644
--- a/compiler/rustc_expand/src/mbe/diagnostics.rs
+++ b/compiler/rustc_expand/src/mbe/diagnostics.rs
@@ -1,12 +1,10 @@
-use std::borrow::Cow;
-
use crate::base::{DummyResult, ExtCtxt, MacResult};
use crate::expand::{parse_ast_fragment, AstFragmentKind};
use crate::mbe::{
macro_parser::{MatcherLoc, NamedParseResult, ParseResult::*, TtParser},
macro_rules::{try_match_macro, Tracker},
};
-use rustc_ast::token::{self, Token};
+use rustc_ast::token::{self, Token, TokenKind};
use rustc_ast::tokenstream::TokenStream;
use rustc_ast_pretty::pprust;
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder, DiagnosticMessage};
@@ -14,6 +12,7 @@ use rustc_parse::parser::{Parser, Recovery};
use rustc_span::source_map::SourceMap;
use rustc_span::symbol::Ident;
use rustc_span::Span;
+use std::borrow::Cow;
use super::macro_rules::{parser_from_cx, NoopTracker};
@@ -63,6 +62,18 @@ pub(super) fn failed_to_match_macro<'cx>(
err.note(format!("while trying to match {remaining_matcher}"));
}
+ if let MatcherLoc::Token { token: expected_token } = &remaining_matcher
+ && (matches!(expected_token.kind, TokenKind::Interpolated(_))
+ || matches!(token.kind, TokenKind::Interpolated(_)))
+ {
+ err.note("captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens");
+ err.note("see <https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment> for more information");
+
+ if !def_span.is_dummy() && !cx.source_map().is_imported(def_span) {
+ err.help("try using `:tt` instead in the macro definition");
+ }
+ }
+
// Check whether there's a missing comma in this macro call, like `println!("{}" a);`
if let Some((arg, comma_span)) = arg.add_comma() {
for lhs in lhses {
@@ -239,12 +250,24 @@ pub(super) fn emit_frag_parse_err(
e.note(
"the macro call doesn't expand to an expression, but it can expand to a statement",
);
- e.span_suggestion_verbose(
- site_span.shrink_to_hi(),
- "add `;` to interpret the expansion as a statement",
- ";",
- Applicability::MaybeIncorrect,
- );
+
+ if parser.token == token::Semi {
+ if let Ok(snippet) = parser.sess.source_map().span_to_snippet(site_span) {
+ e.span_suggestion_verbose(
+ site_span,
+ "surround the macro invocation with `{}` to interpret the expansion as a statement",
+ format!("{{ {}; }}", snippet),
+ Applicability::MaybeIncorrect,
+ );
+ }
+ } else {
+ e.span_suggestion_verbose(
+ site_span.shrink_to_hi(),
+ "add `;` to interpret the expansion as a statement",
+ ";",
+ Applicability::MaybeIncorrect,
+ );
+ }
}
},
_ => annotate_err_with_kind(&mut e, kind, site_span),
diff --git a/compiler/rustc_expand/src/mbe/metavar_expr.rs b/compiler/rustc_expand/src/mbe/metavar_expr.rs
index de34df011..fb3a00d86 100644
--- a/compiler/rustc_expand/src/mbe/metavar_expr.rs
+++ b/compiler/rustc_expand/src/mbe/metavar_expr.rs
@@ -41,7 +41,7 @@ impl MetaVarExpr {
};
check_trailing_token(&mut tts, sess)?;
let mut iter = args.trees();
- let rslt = match &*ident.as_str() {
+ let rslt = match ident.as_str() {
"count" => parse_count(&mut iter, sess, ident.span)?,
"ignore" => MetaVarExpr::Ignore(parse_ident(&mut iter, sess, ident.span)?),
"index" => MetaVarExpr::Index(parse_depth(&mut iter, sess, ident.span)?),
diff --git a/compiler/rustc_expand/src/mbe/transcribe.rs b/compiler/rustc_expand/src/mbe/transcribe.rs
index 47a8b4bc4..a07cb6517 100644
--- a/compiler/rustc_expand/src/mbe/transcribe.rs
+++ b/compiler/rustc_expand/src/mbe/transcribe.rs
@@ -367,7 +367,7 @@ impl LockstepIterSize {
///
/// Example: `$($($x $y)+*);+` -- we need to make sure that `x` and `y` repeat the same amount as
/// each other at the given depth when the macro was invoked. If they don't it might mean they were
-/// declared at unequal depths or there was a compile bug. For example, if we have 3 repetitions of
+/// declared at depths which weren't equal or there was a compiler bug. For example, if we have 3 repetitions of
/// the outer sequence and 4 repetitions of the inner sequence for `x`, we should have the same for
/// `y`; otherwise, we can't transcribe them both at the given depth.
fn lockstep_iter_size(
diff --git a/compiler/rustc_expand/src/proc_macro.rs b/compiler/rustc_expand/src/proc_macro.rs
index ddba14417..26bc216f6 100644
--- a/compiler/rustc_expand/src/proc_macro.rs
+++ b/compiler/rustc_expand/src/proc_macro.rs
@@ -54,7 +54,7 @@ impl base::BangProcMacro for BangProcMacro {
) -> Result<TokenStream, ErrorGuaranteed> {
let _timer =
ecx.sess.prof.generic_activity_with_arg_recorder("expand_proc_macro", |recorder| {
- recorder.record_arg_with_span(ecx.expansion_descr(), span);
+ recorder.record_arg_with_span(ecx.sess.source_map(), ecx.expansion_descr(), span);
});
let proc_macro_backtrace = ecx.ecfg.proc_macro_backtrace;
@@ -85,7 +85,7 @@ impl base::AttrProcMacro for AttrProcMacro {
) -> Result<TokenStream, ErrorGuaranteed> {
let _timer =
ecx.sess.prof.generic_activity_with_arg_recorder("expand_proc_macro", |recorder| {
- recorder.record_arg_with_span(ecx.expansion_descr(), span);
+ recorder.record_arg_with_span(ecx.sess.source_map(), ecx.expansion_descr(), span);
});
let proc_macro_backtrace = ecx.ecfg.proc_macro_backtrace;
@@ -134,7 +134,11 @@ impl MultiItemModifier for DeriveProcMacro {
let stream = {
let _timer =
ecx.sess.prof.generic_activity_with_arg_recorder("expand_proc_macro", |recorder| {
- recorder.record_arg_with_span(ecx.expansion_descr(), span);
+ recorder.record_arg_with_span(
+ ecx.sess.source_map(),
+ ecx.expansion_descr(),
+ span,
+ );
});
let proc_macro_backtrace = ecx.ecfg.proc_macro_backtrace;
let strategy = exec_strategy(ecx);