Auto merge of #94427 - cjgillot:inline-fresh-expn, r=oli-obk
Only create a single expansion for each inline integration. The inlining integrator used to create one expansion for each span from the callee body. This PR reverses the logic to create a single expansion for the whole call, which is more consistent with how macro expansions work for macros. This should remove the large memory regression in #91743.
This commit is contained in:
commit
48132caac2
51 changed files with 502 additions and 497 deletions
|
@ -874,19 +874,13 @@ impl Span {
|
|||
/// other compiler-generated code to set per-span properties like allowed unstable features.
|
||||
/// The returned span belongs to the created expansion and has the new properties,
|
||||
/// but its location is inherited from the current span.
|
||||
pub fn fresh_expansion(self, expn_data: ExpnData, ctx: impl HashStableContext) -> Span {
|
||||
self.fresh_expansion_with_transparency(expn_data, Transparency::Transparent, ctx)
|
||||
}
|
||||
|
||||
pub fn fresh_expansion_with_transparency(
|
||||
self,
|
||||
expn_data: ExpnData,
|
||||
transparency: Transparency,
|
||||
ctx: impl HashStableContext,
|
||||
) -> Span {
|
||||
let expn_id = LocalExpnId::fresh(expn_data, ctx).to_expn_id();
|
||||
pub fn fresh_expansion(self, expn_id: LocalExpnId) -> Span {
|
||||
HygieneData::with(|data| {
|
||||
self.with_ctxt(data.apply_mark(SyntaxContext::root(), expn_id, transparency))
|
||||
self.with_ctxt(data.apply_mark(
|
||||
SyntaxContext::root(),
|
||||
expn_id.to_expn_id(),
|
||||
Transparency::Transparent,
|
||||
))
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -903,7 +897,8 @@ impl Span {
|
|||
allow_internal_unstable,
|
||||
..ExpnData::default(ExpnKind::Desugaring(reason), self, edition, None, None)
|
||||
};
|
||||
self.fresh_expansion(expn_data, ctx)
|
||||
let expn_id = LocalExpnId::fresh(expn_data, ctx);
|
||||
self.fresh_expansion(expn_id)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue