diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs index 5725a759fef80..9a558e033fd76 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder.rs @@ -632,7 +632,7 @@ impl<'a, 'tcx> Decodable> for SpanData { let hi = hi + source_file.translated_source_file.start_pos; // Do not try to decode parent for foreign spans. - SpanData { lo, hi, ctxt, parent: None } + SpanData { lo, hi, ctxt, parent: None, span2: DUMMY_SP } } } diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index 76be546e9455c..98fb4b8d6b201 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -440,6 +440,7 @@ pub struct SpanData { /// code was created by a macro expansion. pub ctxt: SyntaxContext, pub parent: Option, + pub span2: Span, } // Order spans by position in the file. @@ -452,6 +453,7 @@ impl Ord for SpanData { // `LocalDefId` does not implement `Ord`. // The other fields are enough to determine in-file order. parent: _, + span2: _, } = self; let SpanData { lo: o_lo, @@ -460,6 +462,7 @@ impl Ord for SpanData { // `LocalDefId` does not implement `Ord`. // The other fields are enough to determine in-file order. parent: _, + span2: _, } = other; (s_lo, s_hi, s_ctxt).cmp(&(o_lo, o_hi, o_ctxt)) diff --git a/compiler/rustc_span/src/span_encoding.rs b/compiler/rustc_span/src/span_encoding.rs index f7d17a267d693..f96c2c5b06ab8 100644 --- a/compiler/rustc_span/src/span_encoding.rs +++ b/compiler/rustc_span/src/span_encoding.rs @@ -132,8 +132,9 @@ impl Span { } // Partially-interned or fully-interned format. - let index = - with_span_interner(|interner| interner.intern(&SpanData { lo, hi, ctxt, parent })); + let index = with_span_interner(|interner| { + interner.intern(&SpanData { lo, hi, ctxt, parent, span2: DUMMY_SP }) + }); let ctxt_or_parent_or_marker = if ctxt2 <= MAX_CTXT { ctxt2 as u16 // partially-interned } else { @@ -169,6 +170,7 @@ impl Span { hi: BytePos(self.lo_or_index + len), ctxt: SyntaxContext::from_u32(self.ctxt_or_parent_or_marker as u32), parent: None, + span2: DUMMY_SP, } } else { // Inline-parent format. @@ -182,6 +184,7 @@ impl Span { hi: BytePos(self.lo_or_index + len), ctxt: SyntaxContext::root(), parent: Some(parent), + span2: DUMMY_SP, } } } else {