@@ -207,16 +207,18 @@ impl Step for Rustc {
207
207
let compiler = builder. compiler ( builder. top_stage , builder. config . build ) ;
208
208
let target = self . target ;
209
209
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
+ }
220
222
}
221
223
222
224
let mut cargo = builder:: Cargo :: new (
@@ -286,7 +288,9 @@ macro_rules! lint_any {
286
288
let compiler = builder. compiler( builder. top_stage, builder. config. build) ;
287
289
let target = self . target;
288
290
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
+ } ;
290
294
291
295
let cargo = prepare_tool_cargo(
292
296
builder,
0 commit comments