File tree 1 file changed +16
-1
lines changed
compiler/rustc_metadata/src/rmeta
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -1637,7 +1637,22 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1637
1637
virtual_name. display( ) ,
1638
1638
new_path. display( ) ,
1639
1639
) ;
1640
- let new_name = rustc_span:: RealFileName :: LocalPath ( new_path) ;
1640
+
1641
+ // Check if the translated real path is affected by any user-requested
1642
+ // remaps via --remap-path-prefix. Apply them if so.
1643
+ // Note that this is a special case for imported rust-src paths specified by
1644
+ // https://rust-lang.github.io/rfcs/3127-trim-paths.html#handling-sysroot-paths.
1645
+ // Other imported paths are not currently remapped (see #66251).
1646
+ let ( user_remapped, applied) =
1647
+ sess. source_map ( ) . path_mapping ( ) . map_prefix ( & new_path) ;
1648
+ let new_name = if applied {
1649
+ rustc_span:: RealFileName :: Remapped {
1650
+ local_path : Some ( new_path. clone ( ) ) ,
1651
+ virtual_name : user_remapped. to_path_buf ( ) ,
1652
+ }
1653
+ } else {
1654
+ rustc_span:: RealFileName :: LocalPath ( new_path)
1655
+ } ;
1641
1656
* old_name = new_name;
1642
1657
}
1643
1658
}
You can’t perform that action at this time.
0 commit comments