diff options
| author | Urgau <urgau@numericable.fr> | 2023-08-23 15:46:58 +0200 |
|---|---|---|
| committer | Urgau <urgau@numericable.fr> | 2023-10-17 10:11:30 +0200 |
| commit | eccc9e66287d5fd141e458ae3ab25ac96a567972 (patch) | |
| tree | 3a25d640e092a65712b8d42c1ce2a8f8cdf959f5 /compiler/rustc_const_eval | |
| parent | 30f94717ca69f799873698e147ac03ffc0a6fa56 (diff) | |
| download | rust-eccc9e66287d5fd141e458ae3ab25ac96a567972.tar.gz rust-eccc9e66287d5fd141e458ae3ab25ac96a567972.zip | |
[RFC 3127 - Trim Paths]: Condition remapped filepath on remap scopes
Diffstat (limited to 'compiler/rustc_const_eval')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/intrinsics/caller_location.rs | 10 |
1 files changed, 9 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 948bec7464a..16b7decf9c4 100644 --- a/compiler/rustc_const_eval/src/interpret/intrinsics/caller_location.rs +++ b/compiler/rustc_const_eval/src/interpret/intrinsics/caller_location.rs @@ -114,8 +114,16 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { pub(crate) fn location_triple_for_span(&self, span: Span) -> (Symbol, u32, u32) { let topmost = span.ctxt().outer_expn().expansion_cause().unwrap_or(span); let caller = self.tcx.sess.source_map().lookup_char_pos(topmost.lo()); + + use rustc_session::{config::RemapPathScopeComponents, RemapFileNameExt}; ( - Symbol::intern(&caller.file.name.prefer_remapped().to_string_lossy()), + Symbol::intern( + &caller + .file + .name + .for_scope(&self.tcx.sess, RemapPathScopeComponents::DIAGNOSTICS) + .to_string_lossy(), + ), u32::try_from(caller.line).unwrap(), u32::try_from(caller.col_display).unwrap().checked_add(1).unwrap(), ) |
