@@ -247,9 +247,11 @@ pub struct Link;
247
247
impl Step for Link {
248
248
type Output = ( ) ;
249
249
const DEFAULT : bool = true ;
250
+
250
251
fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
251
252
run. alias ( "link" )
252
253
}
254
+
253
255
fn make_run ( run : RunConfig < ' _ > ) {
254
256
if run. builder . config . dry_run ( ) {
255
257
return ;
@@ -262,21 +264,30 @@ impl Step for Link {
262
264
}
263
265
fn run ( self , builder : & Builder < ' _ > ) -> Self :: Output {
264
266
let config = & builder. config ;
267
+
265
268
if config. dry_run ( ) {
266
269
return ;
267
270
}
271
+
272
+ if !rustup_installed ( builder) {
273
+ println ! ( "WARNING: `rustup` is not installed; Skipping `stage1` toolchain linking." ) ;
274
+ return ;
275
+ }
276
+
268
277
let stage_path =
269
278
[ "build" , config. build . rustc_target_arg ( ) , "stage1" ] . join ( MAIN_SEPARATOR_STR ) ;
270
- if !rustup_installed ( builder) {
271
- eprintln ! ( "`rustup` is not installed; cannot link `stage1` toolchain" ) ;
272
- } else if stage_dir_exists ( & stage_path[ ..] ) && !config. dry_run ( ) {
279
+
280
+ if stage_dir_exists ( & stage_path[ ..] ) && !config. dry_run ( ) {
273
281
attempt_toolchain_link ( builder, & stage_path[ ..] ) ;
274
282
}
275
283
}
276
284
}
277
285
278
286
fn rustup_installed ( builder : & Builder < ' _ > ) -> bool {
279
- command ( "rustup" ) . arg ( "--version" ) . run_capture_stdout ( builder) . is_success ( )
287
+ let mut rustup = command ( "rustup" ) ;
288
+ rustup. arg ( "--version" ) ;
289
+
290
+ rustup. allow_failure ( ) . run_always ( ) . run_capture_stdout ( builder) . is_success ( )
280
291
}
281
292
282
293
fn stage_dir_exists ( stage_path : & str ) -> bool {
0 commit comments