@@ -1734,13 +1734,15 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
17341734 } else {
17351735 // We need to properly build cargo using the suitable stage compiler.
17361736
1737- // HACK: currently tool stages are off-by-one compared to compiler stages, i.e. if
1738- // you give `tool::Cargo` a stage 1 rustc, it will cause stage 2 rustc to be built
1739- // and produce a cargo built with stage 2 rustc. To fix this, we need to chop off
1740- // the compiler stage by 1 to align with expected `./x test run-make --stage N`
1741- // behavior, i.e. we need to pass `N - 1` compiler stage to cargo. See also Miri
1742- // which does a similar hack.
1743- let compiler = builder. compiler ( builder. top_stage - 1 , compiler. host ) ;
1737+ let compiler = builder. download_rustc ( ) . then_some ( compiler) . unwrap_or_else ( ||
1738+ // HACK: currently tool stages are off-by-one compared to compiler stages, i.e. if
1739+ // you give `tool::Cargo` a stage 1 rustc, it will cause stage 2 rustc to be built
1740+ // and produce a cargo built with stage 2 rustc. To fix this, we need to chop off
1741+ // the compiler stage by 1 to align with expected `./x test run-make --stage N`
1742+ // behavior, i.e. we need to pass `N - 1` compiler stage to cargo. See also Miri
1743+ // which does a similar hack.
1744+ builder. compiler ( builder. top_stage - 1 , compiler. host ) ) ;
1745+
17441746 builder. ensure ( tool:: Cargo { compiler, target : compiler. host } )
17451747 } ;
17461748
0 commit comments