Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,13 @@ struct SpanLowerer {
impl SpanLowerer {
fn lower(&self, span: Span) -> Span {
if self.is_incremental {
// early return: span lowering takes some time since it accesses the query dependency graph
// to make sure we rerun the right code paths when spans change. When we've already lowered a span,
// or don't have to, bail out ASAP.
if span.is_dummy() || span.parent().is_some_and(|i| i == self.def_id) {
return span;
}

span.with_parent(Some(self.def_id))
} else {
// Do not make spans relative when not using incremental compilation.
Expand Down
Loading