Only create a single expansion for each inline integration.
This commit is contained in:
parent
6cbc6c35e4
commit
e77e4fcf89
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