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_metadata/src | |
| parent | e76cb8c49831ff80d7d2e16319c86edbaa9edb8c (diff) | |
| parent | 5c41de113e8484085fbc01cf6d5a0b16159110a7 (diff) | |
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_metadata/src')
| -rw-r--r-- | compiler/rustc_metadata/src/rmeta/encoder.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index 7c406f9bdda..345b3d5e57f 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -525,9 +525,17 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { // the remapped version -- as is necessary for reproducible builds. let mut source_file = match source_file.name { FileName::Real(ref original_file_name) => { - let adapted_file_name = source_map - .path_mapping() - .to_embeddable_absolute_path(original_file_name.clone(), working_directory); + let adapted_file_name = if self.tcx.sess.should_prefer_remapped_for_codegen() { + source_map.path_mapping().to_embeddable_absolute_path( + original_file_name.clone(), + working_directory, + ) + } else { + source_map.path_mapping().to_local_embeddable_absolute_path( + original_file_name.clone(), + working_directory, + ) + }; if adapted_file_name != *original_file_name { let mut adapted: SourceFile = (**source_file).clone(); |
