diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-03-20 09:46:54 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-20 09:46:54 +0100 |
| commit | 3efecba6e73fb202f3c2a23134eb299286826169 (patch) | |
| tree | 40658c60d8c6b6c17f1204f6ac73b763ec8b047b /compiler/rustc_codegen_ssa/src/mir | |
| parent | d86fd83ef61f7d92a9131a9af97de84afa70325d (diff) | |
| parent | be8b32392953c7b5185afab809fa22191d442e10 (diff) | |
| download | rust-3efecba6e73fb202f3c2a23134eb299286826169.tar.gz rust-3efecba6e73fb202f3c2a23134eb299286826169.zip | |
Rollup merge of #109307 - cjgillot:inline-location, r=compiler-errors
Ignore `Inlined` spans when computing caller location. Fixes https://github.com/rust-lang/rust/issues/105538
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/mir')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/block.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs index f9aa2aecf65..bdfc0aa1c30 100644 --- a/compiler/rustc_codegen_ssa/src/mir/block.rs +++ b/compiler/rustc_codegen_ssa/src/mir/block.rs @@ -1475,7 +1475,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { ) -> OperandRef<'tcx, Bx::Value> { let tcx = bx.tcx(); - let mut span_to_caller_location = |span: Span| { + let mut span_to_caller_location = |mut span: Span| { + // Remove `Inlined` marks as they pollute `expansion_cause`. + while span.is_inlined() { + span.remove_mark(); + } let topmost = span.ctxt().outer_expn().expansion_cause().unwrap_or(span); let caller = tcx.sess.source_map().lookup_char_pos(topmost.lo()); let const_loc = tcx.const_caller_location(( |
