about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authoronur-ozkan <work@onurozkan.dev>2024-08-03 09:10:00 +0300
committeronur-ozkan <work@onurozkan.dev>2024-08-06 20:36:26 +0300
commit8d7c374b2ec4f6cfd99f9c8e7cd5b2624909fa21 (patch)
tree39168ab8a1d218497f9fcb95ee3bd7bce0c58ede /src
parentbc0bc91e109fb21243f6bf15747c6fe2158d6a4b (diff)
downloadrust-8d7c374b2ec4f6cfd99f9c8e7cd5b2624909fa21.tar.gz
rust-8d7c374b2ec4f6cfd99f9c8e7cd5b2624909fa21.zip
improve rustup check in `x setup`
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/src/core/build_steps/setup.rs19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/bootstrap/src/core/build_steps/setup.rs b/src/bootstrap/src/core/build_steps/setup.rs
index 8cd9ba5fd14..f7b26712cab 100644
--- a/src/bootstrap/src/core/build_steps/setup.rs
+++ b/src/bootstrap/src/core/build_steps/setup.rs
@@ -247,9 +247,11 @@ pub struct Link;
 impl Step for Link {
     type Output = ();
     const DEFAULT: bool = true;
+
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
         run.alias("link")
     }
+
     fn make_run(run: RunConfig<'_>) {
         if run.builder.config.dry_run() {
             return;
@@ -262,21 +264,30 @@ impl Step for Link {
     }
     fn run(self, builder: &Builder<'_>) -> Self::Output {
         let config = &builder.config;
+
         if config.dry_run() {
             return;
         }
+
+        if !rustup_installed(builder) {
+            println!("WARNING: `rustup` is not installed; Skipping `stage1` toolchain linking.");
+            return;
+        }
+
         let stage_path =
             ["build", config.build.rustc_target_arg(), "stage1"].join(MAIN_SEPARATOR_STR);
-        if !rustup_installed(builder) {
-            eprintln!("`rustup` is not installed; cannot link `stage1` toolchain");
-        } else if stage_dir_exists(&stage_path[..]) && !config.dry_run() {
+
+        if stage_dir_exists(&stage_path[..]) && !config.dry_run() {
             attempt_toolchain_link(builder, &stage_path[..]);
         }
     }
 }
 
 fn rustup_installed(builder: &Builder<'_>) -> bool {
-    command("rustup").arg("--version").run_capture_stdout(builder).is_success()
+    let mut rustup = command("rustup");
+    rustup.arg("--version");
+
+    rustup.allow_failure().run_always().run_capture_stdout(builder).is_success()
 }
 
 fn stage_dir_exists(stage_path: &str) -> bool {