@@ -3529,22 +3529,23 @@ impl<'test> TestCx<'test> {
3529
3529
let parent_dir = self . testpaths . file . parent ( ) . unwrap ( ) ;
3530
3530
normalize_path ( parent_dir, "$DIR" ) ;
3531
3531
3532
- // Paths into the libstd/libcore
3533
- let base_dir = self . config . src_base . parent ( ) . unwrap ( ) . parent ( ) . unwrap ( ) . parent ( ) . unwrap ( ) ;
3534
- let src_dir = base_dir. join ( "library" ) ;
3535
- normalize_path ( & src_dir, "$SRC_DIR" ) ;
3536
-
3537
- // `ui-fulldeps` tests can show paths to the compiler source when testing macros from
3538
- // `rustc_macros`
3539
- // eg. /home/user/rust/compiler
3540
- let compiler_src_dir = base_dir. join ( "compiler" ) ;
3541
- normalize_path ( & compiler_src_dir, "$COMPILER_DIR" ) ;
3542
-
3543
- if let Some ( virtual_rust_source_base_dir) =
3544
- option_env ! ( "CFG_VIRTUAL_RUST_SOURCE_BASE_DIR" ) . map ( PathBuf :: from)
3545
- {
3546
- normalize_path ( & virtual_rust_source_base_dir. join ( "library" ) , "$SRC_DIR" ) ;
3547
- normalize_path ( & virtual_rust_source_base_dir. join ( "compiler" ) , "$COMPILER_DIR" ) ;
3532
+ let source_bases = & [
3533
+ // Source base on the current filesystem (calculated as parent of `src/test/$suite`):
3534
+ Some ( self . config . src_base . parent ( ) . unwrap ( ) . parent ( ) . unwrap ( ) . parent ( ) . unwrap ( ) . into ( ) ) ,
3535
+ // Source base on the sysroot (from the src components downloaded by `download-rustc`):
3536
+ Some ( self . config . sysroot_base . join ( "lib" ) . join ( "rustlib" ) . join ( "src" ) . join ( "rust" ) ) ,
3537
+ // Virtual `/rustc/$sha` remapped paths (if `remap-debuginfo` is enabled):
3538
+ option_env ! ( "CFG_VIRTUAL_RUST_SOURCE_BASE_DIR" ) . map ( PathBuf :: from) ,
3539
+ ] ;
3540
+ for base_dir in source_bases {
3541
+ if let Some ( base_dir) = base_dir {
3542
+ // Paths into the libstd/libcore
3543
+ normalize_path ( & base_dir. join ( "library" ) , "$SRC_DIR" ) ;
3544
+ // `ui-fulldeps` tests can show paths to the compiler source when testing macros from
3545
+ // `rustc_macros`
3546
+ // eg. /home/user/rust/compiler
3547
+ normalize_path ( & base_dir. join ( "compiler" ) , "$COMPILER_DIR" ) ;
3548
+ }
3548
3549
}
3549
3550
3550
3551
// Paths into the build directory
0 commit comments