File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
compiler/rustc_ast_lowering/src Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
104104 items : & [ Box < Item > ] ,
105105 spans : & ModSpans ,
106106 ) -> & ' hir hir:: Mod < ' hir > {
107+ println ! ( "{:?} {:?}" , spans. inner_span, spans. inner_span. parent( ) ) ;
107108 self . arena . alloc ( hir:: Mod {
108109 spans : hir:: ModSpans {
109110 inner_span : self . lower_span ( spans. inner_span ) ,
Original file line number Diff line number Diff line change @@ -220,6 +220,23 @@ struct SpanLowerer {
220220impl SpanLowerer {
221221 fn lower ( & self , span : Span ) -> Span {
222222 if self . is_incremental {
223+ // early return
224+ if span. parent ( ) . is_some_and ( |i| i == self . def_id ) {
225+ return span;
226+ }
227+
228+ // #[cfg(debug_assertions)]
229+ // {
230+ // if !span.is_dummy()
231+ // && let Some(p) = span.parent()
232+ // {
233+ // assert!(
234+ // p != self.def_id,
235+ // "duplicate span lowering detected, parent of span {span:?} was already set to {:?}",
236+ // self.def_id
237+ // );
238+ // }
239+ // }
223240 span. with_parent ( Some ( self . def_id ) )
224241 } else {
225242 // Do not make spans relative when not using incremental compilation.
You can’t perform that action at this time.
0 commit comments