@@ -36,7 +36,7 @@ use rustc_session::output::{filename_for_input, filename_for_metadata};
36
36
use rustc_session:: search_paths:: PathKind ;
37
37
use rustc_session:: Session ;
38
38
use rustc_span:: symbol:: { Ident , Symbol } ;
39
- use rustc_span:: { FileName , RealFileName } ;
39
+ use rustc_span:: FileName ;
40
40
use rustc_trait_selection:: traits;
41
41
use rustc_typeck as typeck;
42
42
use tracing:: { info, warn} ;
@@ -532,10 +532,10 @@ fn output_conflicts_with_dir(output_paths: &[PathBuf]) -> Option<PathBuf> {
532
532
check_output ( output_paths, check)
533
533
}
534
534
535
- fn escape_dep_filename ( filename : & FileName ) -> String {
535
+ fn escape_dep_filename ( filename : & String ) -> String {
536
536
// Apparently clang and gcc *only* escape spaces:
537
537
// http://llvm.org/klaus/clang/commit/9d50634cfc268ecc9a7250226dd5ca0e945240d4
538
- filename. to_string ( ) . replace ( " " , "\\ " )
538
+ filename. replace ( " " , "\\ " )
539
539
}
540
540
541
541
// Makefile comments only need escaping newlines and `\`.
@@ -575,7 +575,14 @@ fn write_out_deps(
575
575
. iter ( )
576
576
. filter ( |fmap| fmap. is_real_file ( ) )
577
577
. filter ( |fmap| !fmap. is_imported ( ) )
578
- . map ( |fmap| escape_dep_filename ( & fmap. name ) )
578
+ . map ( |fmap| {
579
+ escape_dep_filename ( & match & fmap. name {
580
+ FileName :: Real ( real) => {
581
+ real. local_path ( ) . unwrap_or ( real. stable_name ( ) ) . display ( ) . to_string ( )
582
+ }
583
+ _ => fmap. name . to_string ( ) ,
584
+ } )
585
+ } )
579
586
. collect ( ) ;
580
587
581
588
if let Some ( ref backend) = sess. opts . debugging_opts . codegen_backend {
@@ -587,16 +594,13 @@ fn write_out_deps(
587
594
for cnum in resolver. cstore ( ) . crates_untracked ( ) {
588
595
let source = resolver. cstore ( ) . crate_source_untracked ( cnum) ;
589
596
if let Some ( ( path, _) ) = source. dylib {
590
- let file_name = FileName :: Real ( RealFileName :: LocalPath ( path) ) ;
591
- files. push ( escape_dep_filename ( & file_name) ) ;
597
+ files. push ( escape_dep_filename ( & path. display ( ) . to_string ( ) ) ) ;
592
598
}
593
599
if let Some ( ( path, _) ) = source. rlib {
594
- let file_name = FileName :: Real ( RealFileName :: LocalPath ( path) ) ;
595
- files. push ( escape_dep_filename ( & file_name) ) ;
600
+ files. push ( escape_dep_filename ( & path. display ( ) . to_string ( ) ) ) ;
596
601
}
597
602
if let Some ( ( path, _) ) = source. rmeta {
598
- let file_name = FileName :: Real ( RealFileName :: LocalPath ( path) ) ;
599
- files. push ( escape_dep_filename ( & file_name) ) ;
603
+ files. push ( escape_dep_filename ( & path. display ( ) . to_string ( ) ) ) ;
600
604
}
601
605
}
602
606
} ) ;
0 commit comments