diff options
| author | bors <bors@rust-lang.org> | 2023-10-19 19:09:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-10-19 19:09:29 +0000 |
| commit | 94c4e5c4111cbefcd098d6efcb0b222b6e512fcb (patch) | |
| tree | 550103880907fc185bae80be8a49624458319147 /compiler/rustc_const_eval/src | |
| parent | e76cb8c49831ff80d7d2e16319c86edbaa9edb8c (diff) | |
| parent | 5c41de113e8484085fbc01cf6d5a0b16159110a7 (diff) | |
| download | rust-94c4e5c4111cbefcd098d6efcb0b222b6e512fcb.tar.gz rust-94c4e5c4111cbefcd098d6efcb0b222b6e512fcb.zip | |
Auto merge of #115214 - Urgau:rfc-3127-trim-paths, r=compiler-errors
Implement rustc part of RFC 3127 trim-paths This PR implements (or at least tries to) [RFC 3127 trim-paths](https://github.com/rust-lang/rust/issues/111540), the rustc part. That is `-Zremap-path-scope` with all of it's components/scopes. `@rustbot` label: +F-trim-paths
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -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(), ) |
