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 @@ -1650,7 +1650,22 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1650
1650
virtual_name. display( ) ,
1651
1651
new_path. display( ) ,
1652
1652
) ;
1653
- let new_name = rustc_span:: RealFileName :: LocalPath ( new_path) ;
1653
+
1654
+ // Check if the translated real path is affected by any user-requested
1655
+ // remaps via --remap-path-prefix. Apply them if so.
1656
+ // Note that this is a special case for imported rust-src paths specified by
1657
+ // https://rust-lang.github.io/rfcs/3127-trim-paths.html#handling-sysroot-paths.
1658
+ // Other imported paths are not currently remapped (see #66251).
1659
+ let ( user_remapped, applied) =
1660
+ sess. source_map ( ) . path_mapping ( ) . map_prefix ( & new_path) ;
1661
+ let new_name = if applied {
1662
+ rustc_span:: RealFileName :: Remapped {
1663
+ local_path : Some ( new_path. clone ( ) ) ,
1664
+ virtual_name : user_remapped. to_path_buf ( ) ,
1665
+ }
1666
+ } else {
1667
+ rustc_span:: RealFileName :: LocalPath ( new_path)
1668
+ } ;
1654
1669
* old_name = new_name;
1655
1670
}
1656
1671
}
You can’t perform that action at this time.
0 commit comments