diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-03-18 13:46:17 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-03-18 13:46:17 +0000 |
| commit | be8b32392953c7b5185afab809fa22191d442e10 (patch) | |
| tree | af94bcdf56b0e6e53505687602fa922a69b512c7 /compiler/rustc_const_eval/src | |
| parent | df61fcaec1fdd3b949a7721abfaf37a8ca6e144c (diff) | |
| download | rust-be8b32392953c7b5185afab809fa22191d442e10.tar.gz | |
Ignore `Inlined` spans when computing caller location.
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/intrinsics/caller_location.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/intrinsics/caller_location.rs b/compiler/rustc_const_eval/src/interpret/intrinsics/caller_location.rs index cf52299b7ba..76c8d0a975a 100644 --- a/compiler/rustc_const_eval/src/interpret/intrinsics/caller_location.rs +++ b/compiler/rustc_const_eval/src/interpret/intrinsics/caller_location.rs @@ -111,7 +111,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { location } - pub(crate) fn location_triple_for_span(&self, span: Span) -> (Symbol, u32, u32) { + pub(crate) fn location_triple_for_span(&self, mut span: Span) -> (Symbol, u32, u32) { + // 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 = self.tcx.sess.source_map().lookup_char_pos(topmost.lo()); ( |
