Skip to content

Commit 6bced6e

Browse files
committed
Ignore Inlined spans when computing caller location
cc rust-lang/rust#109307
1 parent 5c9f007 commit 6bced6e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/common.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,11 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
431431

432432
// Note: must be kept in sync with get_caller_location from cg_ssa
433433
pub(crate) fn get_caller_location(&mut self, mut source_info: mir::SourceInfo) -> CValue<'tcx> {
434-
let span_to_caller_location = |fx: &mut FunctionCx<'_, '_, 'tcx>, span: Span| {
434+
let span_to_caller_location = |fx: &mut FunctionCx<'_, '_, 'tcx>, mut span: Span| {
435+
// Remove `Inlined` marks as they pollute `expansion_cause`.
436+
while span.is_inlined() {
437+
span.remove_mark();
438+
}
435439
let topmost = span.ctxt().outer_expn().expansion_cause().unwrap_or(span);
436440
let caller = fx.tcx.sess.source_map().lookup_char_pos(topmost.lo());
437441
let const_loc = fx.tcx.const_caller_location((

0 commit comments

Comments
 (0)