@@ -35,6 +35,7 @@ use rustc_middle::ty::{self, AdtKind, GeneratorSubsts, ParamEnv, Ty, TyCtxt};
3535use rustc_middle:: { bug, span_bug} ;
3636use rustc_session:: config:: { self , DebugInfo } ;
3737use rustc_span:: symbol:: { Interner , Symbol } ;
38+ use rustc_span:: FileNameDisplayPreference ;
3839use rustc_span:: { self , SourceFile , SourceFileHash , Span } ;
3940use rustc_target:: abi:: { Abi , Align , HasDataLayout , Integer , LayoutOf , TagEncoding } ;
4041use rustc_target:: abi:: { Int , Pointer , F32 , F64 } ;
@@ -771,7 +772,13 @@ pub fn file_metadata(cx: &CodegenCx<'ll, '_>, source_file: &SourceFile) -> &'ll
771772 let hash = Some ( & source_file. src_hash ) ;
772773 let file_name = Some ( source_file. name . prefer_remapped ( ) . to_string ( ) ) ;
773774 let directory = if source_file. is_real_file ( ) && !source_file. is_imported ( ) {
774- Some ( cx. sess ( ) . opts . working_dir . to_string_lossy ( false ) . to_string ( ) )
775+ Some (
776+ cx. sess ( )
777+ . opts
778+ . working_dir
779+ . to_string_lossy ( FileNameDisplayPreference :: Remapped )
780+ . to_string ( ) ,
781+ )
775782 } else {
776783 // If the path comes from an upstream crate we assume it has been made
777784 // independent of the compiler's working directory one way or another.
@@ -999,7 +1006,7 @@ pub fn compile_unit_metadata(
9991006 let producer = format ! ( "clang LLVM ({})" , rustc_producer) ;
10001007
10011008 let name_in_debuginfo = name_in_debuginfo. to_string_lossy ( ) ;
1002- let work_dir = tcx. sess . opts . working_dir . to_string_lossy ( false ) ;
1009+ let work_dir = tcx. sess . opts . working_dir . to_string_lossy ( FileNameDisplayPreference :: Remapped ) ;
10031010 let flags = "\0 " ;
10041011 let output_filenames = tcx. output_filenames ( ( ) ) ;
10051012 let out_dir = & output_filenames. out_directory ;
0 commit comments