@@ -252,7 +252,8 @@ impl Session {
252
252
253
253
pub fn local_crate_source_file ( & self ) -> Option < PathBuf > {
254
254
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 ) {
256
257
Some ( self . opts . file_path_mapping ( ) . map_prefix ( path) . 0 . into_owned ( ) )
257
258
} else {
258
259
Some ( path. to_path_buf ( ) )
@@ -886,8 +887,8 @@ impl Session {
886
887
self . opts . cg . link_dead_code . unwrap_or ( false )
887
888
}
888
889
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 )
891
892
}
892
893
}
893
894
@@ -1440,12 +1441,8 @@ pub trait RemapFileNameExt {
1440
1441
1441
1442
/// Returns a possibly remapped filename based on the passed scope and remap cli options.
1442
1443
///
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.
1445
1445
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 < ' _ > ;
1449
1446
}
1450
1447
1451
1448
impl RemapFileNameExt for rustc_span:: FileName {
@@ -1462,14 +1459,6 @@ impl RemapFileNameExt for rustc_span::FileName {
1462
1459
self . prefer_local ( )
1463
1460
}
1464
1461
}
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
- }
1473
1462
}
1474
1463
1475
1464
impl RemapFileNameExt for rustc_span:: RealFileName {
@@ -1486,12 +1475,4 @@ impl RemapFileNameExt for rustc_span::RealFileName {
1486
1475
self . local_path_if_available ( )
1487
1476
}
1488
1477
}
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
- }
1497
1478
}
0 commit comments