@@ -252,7 +252,8 @@ impl Session {
252252
253253 pub fn local_crate_source_file ( & self ) -> Option < PathBuf > {
254254 let path = self . io . input . opt_path ( ) ?;
255- if self . should_prefer_remapped_for_codegen ( ) {
255+ // FIXME: The remap path scope should probably not be hardcoded.
256+ if self . should_prefer_remapped ( RemapPathScopeComponents :: DEBUGINFO ) {
256257 Some ( self . opts . file_path_mapping ( ) . map_prefix ( path) . 0 . into_owned ( ) )
257258 } else {
258259 Some ( path. to_path_buf ( ) )
@@ -886,8 +887,8 @@ impl Session {
886887 self . opts . cg . link_dead_code . unwrap_or ( false )
887888 }
888889
889- pub fn should_prefer_remapped_for_codegen ( & self ) -> bool {
890- self . opts . unstable_opts . remap_path_scope . contains ( RemapPathScopeComponents :: DEBUGINFO )
890+ pub fn should_prefer_remapped ( & self , scope : RemapPathScopeComponents ) -> bool {
891+ self . opts . unstable_opts . remap_path_scope . contains ( scope )
891892 }
892893}
893894
@@ -1440,12 +1441,8 @@ pub trait RemapFileNameExt {
14401441
14411442 /// Returns a possibly remapped filename based on the passed scope and remap cli options.
14421443 ///
1443- /// One and only one scope should be passed to this method. For anything related to
1444- /// "codegen" see the [`RemapFileNameExt::for_codegen`] method.
1444+ /// One and only one scope should be passed to this method, it will panic otherwise.
14451445 fn for_scope ( & self , sess : & Session , scope : RemapPathScopeComponents ) -> Self :: Output < ' _ > ;
1446-
1447- /// Return a possibly remapped filename, to be used in "codegen" related parts.
1448- fn for_codegen ( & self , sess : & Session ) -> Self :: Output < ' _ > ;
14491446}
14501447
14511448impl RemapFileNameExt for rustc_span:: FileName {
@@ -1462,14 +1459,6 @@ impl RemapFileNameExt for rustc_span::FileName {
14621459 self . prefer_local ( )
14631460 }
14641461 }
1465-
1466- fn for_codegen ( & self , sess : & Session ) -> Self :: Output < ' _ > {
1467- if sess. should_prefer_remapped_for_codegen ( ) {
1468- self . prefer_remapped_unconditionaly ( )
1469- } else {
1470- self . prefer_local ( )
1471- }
1472- }
14731462}
14741463
14751464impl RemapFileNameExt for rustc_span:: RealFileName {
@@ -1486,12 +1475,4 @@ impl RemapFileNameExt for rustc_span::RealFileName {
14861475 self . local_path_if_available ( )
14871476 }
14881477 }
1489-
1490- fn for_codegen ( & self , sess : & Session ) -> Self :: Output < ' _ > {
1491- if sess. should_prefer_remapped_for_codegen ( ) {
1492- self . remapped_path_if_available ( )
1493- } else {
1494- self . local_path_if_available ( )
1495- }
1496- }
14971478}
0 commit comments