@@ -207,16 +207,18 @@ impl Step for Rustc {
207207 let compiler = builder. compiler ( builder. top_stage , builder. config . build ) ;
208208 let target = self . target ;
209209
210- if compiler. stage != 0 {
211- // If we're not in stage 0, then we won't have a std from the beta
212- // compiler around. That means we need to make sure there's one in
213- // the sysroot for the compiler to find. Otherwise, we're going to
214- // fail when building crates that need to generate code (e.g., build
215- // scripts and their dependencies).
216- builder. ensure ( compile:: Std :: new ( compiler, compiler. host ) ) ;
217- builder. ensure ( compile:: Std :: new ( compiler, target) ) ;
218- } else {
219- builder. ensure ( check:: Std :: new ( target) . build_kind ( Some ( Kind :: Check ) ) ) ;
210+ if !builder. download_rustc ( ) {
211+ if compiler. stage != 0 {
212+ // If we're not in stage 0, then we won't have a std from the beta
213+ // compiler around. That means we need to make sure there's one in
214+ // the sysroot for the compiler to find. Otherwise, we're going to
215+ // fail when building crates that need to generate code (e.g., build
216+ // scripts and their dependencies).
217+ builder. ensure ( compile:: Std :: new ( compiler, compiler. host ) ) ;
218+ builder. ensure ( compile:: Std :: new ( compiler, target) ) ;
219+ } else {
220+ builder. ensure ( check:: Std :: new ( target) . build_kind ( Some ( Kind :: Check ) ) ) ;
221+ }
220222 }
221223
222224 let mut cargo = builder:: Cargo :: new (
@@ -286,7 +288,9 @@ macro_rules! lint_any {
286288 let compiler = builder. compiler( builder. top_stage, builder. config. build) ;
287289 let target = self . target;
288290
289- builder. ensure( check:: Rustc :: new( target, builder) . build_kind( Some ( Kind :: Check ) ) ) ;
291+ if !builder. download_rustc( ) {
292+ builder. ensure( check:: Rustc :: new( target, builder) . build_kind( Some ( Kind :: Check ) ) ) ;
293+ } ;
290294
291295 let cargo = prepare_tool_cargo(
292296 builder,
0 commit comments