@@ -36,7 +36,7 @@ use rustc_session::output::{filename_for_input, filename_for_metadata};
3636use rustc_session:: search_paths:: PathKind ;
3737use rustc_session:: Session ;
3838use rustc_span:: symbol:: { Ident , Symbol } ;
39- use rustc_span:: { FileName , RealFileName } ;
39+ use rustc_span:: FileName ;
4040use rustc_trait_selection:: traits;
4141use rustc_typeck as typeck;
4242use tracing:: { info, warn} ;
@@ -532,10 +532,10 @@ fn output_conflicts_with_dir(output_paths: &[PathBuf]) -> Option<PathBuf> {
532532 check_output ( output_paths, check)
533533}
534534
535- fn escape_dep_filename ( filename : & FileName ) -> String {
535+ fn escape_dep_filename ( filename : & String ) -> String {
536536 // Apparently clang and gcc *only* escape spaces:
537537 // http://llvm.org/klaus/clang/commit/9d50634cfc268ecc9a7250226dd5ca0e945240d4
538- filename. to_string ( ) . replace ( " " , "\\ " )
538+ filename. replace ( " " , "\\ " )
539539}
540540
541541// Makefile comments only need escaping newlines and `\`.
@@ -575,7 +575,14 @@ fn write_out_deps(
575575 . iter ( )
576576 . filter ( |fmap| fmap. is_real_file ( ) )
577577 . 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+ } )
579586 . collect ( ) ;
580587
581588 if let Some ( ref backend) = sess. opts . debugging_opts . codegen_backend {
@@ -587,16 +594,13 @@ fn write_out_deps(
587594 for cnum in resolver. cstore ( ) . crates_untracked ( ) {
588595 let source = resolver. cstore ( ) . crate_source_untracked ( cnum) ;
589596 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 ( ) ) ) ;
592598 }
593599 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 ( ) ) ) ;
596601 }
597602 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 ( ) ) ) ;
600604 }
601605 }
602606 } ) ;
0 commit comments