@@ -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
@@ -1439,12 +1440,8 @@ pub trait RemapFileNameExt {
1439
1440
1440
1441
/// Returns a possibly remapped filename based on the passed scope and remap cli options.
1441
1442
///
1442
- /// One and only one scope should be passed to this method. For anything related to
1443
- /// "codegen" see the [`RemapFileNameExt::for_codegen`] method.
1443
+ /// One and only one scope should be passed to this method, it will panic otherwise.
1444
1444
fn for_scope ( & self , sess : & Session , scope : RemapPathScopeComponents ) -> Self :: Output < ' _ > ;
1445
-
1446
- /// Return a possibly remapped filename, to be used in "codegen" related parts.
1447
- fn for_codegen ( & self , sess : & Session ) -> Self :: Output < ' _ > ;
1448
1445
}
1449
1446
1450
1447
impl RemapFileNameExt for rustc_span:: FileName {
@@ -1461,14 +1458,6 @@ impl RemapFileNameExt for rustc_span::FileName {
1461
1458
self . prefer_local ( )
1462
1459
}
1463
1460
}
1464
-
1465
- fn for_codegen ( & self , sess : & Session ) -> Self :: Output < ' _ > {
1466
- if sess. should_prefer_remapped_for_codegen ( ) {
1467
- self . prefer_remapped_unconditionaly ( )
1468
- } else {
1469
- self . prefer_local ( )
1470
- }
1471
- }
1472
1461
}
1473
1462
1474
1463
impl RemapFileNameExt for rustc_span:: RealFileName {
@@ -1485,12 +1474,4 @@ impl RemapFileNameExt for rustc_span::RealFileName {
1485
1474
self . local_path_if_available ( )
1486
1475
}
1487
1476
}
1488
-
1489
- fn for_codegen ( & self , sess : & Session ) -> Self :: Output < ' _ > {
1490
- if sess. should_prefer_remapped_for_codegen ( ) {
1491
- self . remapped_path_if_available ( )
1492
- } else {
1493
- self . local_path_if_available ( )
1494
- }
1495
- }
1496
1477
}
0 commit comments