@@ -2658,16 +2658,27 @@ impl Step for Crate {
2658
2658
2659
2659
match mode {
2660
2660
Mode :: Std => {
2661
- compile:: std_cargo ( builder, target, compiler. stage , & mut cargo) ;
2662
- // `std_cargo` actually does the wrong thing: it passes `--sysroot build/host/stage2`,
2663
- // but we want to use the force-recompile std we just built in `build/host/stage2-test-sysroot`.
2664
- // Override it.
2665
- if builder. download_rustc ( ) && compiler. stage > 0 {
2666
- let sysroot = builder
2667
- . out
2668
- . join ( compiler. host . triple )
2669
- . join ( format ! ( "stage{}-test-sysroot" , compiler. stage) ) ;
2670
- cargo. env ( "RUSTC_SYSROOT" , sysroot) ;
2661
+ if builder. kind == Kind :: Miri {
2662
+ // We can't use `std_cargo` as that uses `optimized-compiler-builtins` which
2663
+ // needs host tools for the given target. This is similar to what `compile::Std`
2664
+ // does when `is_for_mir_opt_tests` is true. There's probably a chance for
2665
+ // de-duplication here... `std_cargo` should support a mode that avoids needing
2666
+ // host tools.
2667
+ cargo
2668
+ . arg ( "--manifest-path" )
2669
+ . arg ( builder. src . join ( "library/sysroot/Cargo.toml" ) ) ;
2670
+ } else {
2671
+ compile:: std_cargo ( builder, target, compiler. stage , & mut cargo) ;
2672
+ // `std_cargo` actually does the wrong thing: it passes `--sysroot build/host/stage2`,
2673
+ // but we want to use the force-recompile std we just built in `build/host/stage2-test-sysroot`.
2674
+ // Override it.
2675
+ if builder. download_rustc ( ) && compiler. stage > 0 {
2676
+ let sysroot = builder
2677
+ . out
2678
+ . join ( compiler. host . triple )
2679
+ . join ( format ! ( "stage{}-test-sysroot" , compiler. stage) ) ;
2680
+ cargo. env ( "RUSTC_SYSROOT" , sysroot) ;
2681
+ }
2671
2682
}
2672
2683
}
2673
2684
Mode :: Rustc => {
0 commit comments