Skip to content

Commit ff022f1

Browse files
committed
improve rustup check in x setup
Signed-off-by: onur-ozkan <[email protected]>
1 parent 44aed55 commit ff022f1

File tree

1 file changed

+14
-4
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+14
-4
lines changed

src/bootstrap/src/core/build_steps/setup.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,11 @@ pub struct Link;
247247
impl Step for Link {
248248
type Output = ();
249249
const DEFAULT: bool = true;
250+
250251
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
251252
run.alias("link")
252253
}
254+
253255
fn make_run(run: RunConfig<'_>) {
254256
if run.builder.config.dry_run() {
255257
return;
@@ -262,21 +264,29 @@ impl Step for Link {
262264
}
263265
fn run(self, builder: &Builder<'_>) -> Self::Output {
264266
let config = &builder.config;
267+
265268
if config.dry_run() {
266269
return;
267270
}
271+
272+
if !rustup_installed(builder) {
273+
println!("WARNING: `rustup` is not installed; Skipping `stage1` toolchain linking.");
274+
}
275+
268276
let stage_path =
269277
["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() {
278+
279+
if stage_dir_exists(&stage_path[..]) && !config.dry_run() {
273280
attempt_toolchain_link(builder, &stage_path[..]);
274281
}
275282
}
276283
}
277284

278285
fn rustup_installed(builder: &Builder<'_>) -> bool {
279-
command("rustup").arg("--version").run_capture_stdout(builder).is_success()
286+
let mut rustup = command("rustup");
287+
rustup.arg("--version");
288+
289+
rustup.allow_failure().run_always().run_capture_stdout(builder).is_success()
280290
}
281291

282292
fn stage_dir_exists(stage_path: &str) -> bool {

0 commit comments

Comments
 (0)