Skip to content

Commit 1e4ebb0

Browse files
committed
Honor collapse_debuginfo when dealing with MIR-inlined functions inside macros.
The test relies on the fact that inlining more than 2^12 calls at the same callsite will trigger a panic (and after the following commit, a warning) due to LLVM limitations but with collapse_debuginfo the callsites should not be the same.
1 parent b71fb5e commit 1e4ebb0

File tree

2 files changed

+4126
-3
lines changed

2 files changed

+4126
-3
lines changed

Diff for: compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_middle::mir::{Body, SourceScope};
99
use rustc_middle::ty::layout::{FnAbiOf, HasTypingEnv};
1010
use rustc_middle::ty::{self, Instance};
1111
use rustc_session::config::DebugInfo;
12-
use rustc_span::BytePos;
12+
use rustc_span::{BytePos, hygiene};
1313

1414
use super::metadata::file_metadata;
1515
use super::utils::DIB;
@@ -138,8 +138,7 @@ fn make_mir_scope<'ll, 'tcx>(
138138
};
139139

140140
let inlined_at = scope_data.inlined.map(|(_, callsite_span)| {
141-
// FIXME(eddyb) this doesn't account for the macro-related
142-
// `Span` fixups that `rustc_codegen_ssa::mir::debuginfo` does.
141+
let callsite_span = hygiene::walk_chain_collapsed(callsite_span, mir.span);
143142
let callsite_scope = parent_scope.adjust_dbg_scope_for_span(cx, callsite_span);
144143
let loc = cx.dbg_loc(callsite_scope, parent_scope.inlined_at, callsite_span);
145144

0 commit comments

Comments
 (0)