about summary refs log tree commit diff
path: root/compiler/rustc_span/src
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2022-02-27 16:09:52 +0100
committerCamille GILLOT <gillot.camille@gmail.com>2022-02-27 19:05:56 +0100
commite77e4fcf898ca4b2aa2041d2cbac200ed0f11b5b (patch)
tree9994c3a36e798d935142a9dbee2c84c872be4b0c /compiler/rustc_span/src
parent6cbc6c35e4b0c948114619a1c883a75b731d32c5 (diff)
downloadrust-e77e4fcf898ca4b2aa2041d2cbac200ed0f11b5b.tar.gz
rust-e77e4fcf898ca4b2aa2041d2cbac200ed0f11b5b.zip
Only create a single expansion for each inline integration.
Diffstat (limited to 'compiler/rustc_span/src')
-rw-r--r--compiler/rustc_span/src/hygiene.rs21
1 files changed, 8 insertions, 13 deletions
diff --git a/compiler/rustc_span/src/hygiene.rs b/compiler/rustc_span/src/hygiene.rs
index 8265eb23c3d..5fae46d5fd8 100644
--- a/compiler/rustc_span/src/hygiene.rs
+++ b/compiler/rustc_span/src/hygiene.rs
@@ -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)
     }
 }