about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/mir
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-03-18 13:46:17 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-03-18 13:46:17 +0000
commitbe8b32392953c7b5185afab809fa22191d442e10 (patch)
treeaf94bcdf56b0e6e53505687602fa922a69b512c7 /compiler/rustc_codegen_ssa/src/mir
parentdf61fcaec1fdd3b949a7721abfaf37a8ca6e144c (diff)
downloadrust-be8b32392953c7b5185afab809fa22191d442e10.tar.gz
rust-be8b32392953c7b5185afab809fa22191d442e10.zip
Ignore `Inlined` spans when computing caller location.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/mir')
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/block.rs6
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 71c71d59b7a..40a06098c5a 100644
--- a/compiler/rustc_codegen_ssa/src/mir/block.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/block.rs
@@ -1482,7 +1482,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((