Jelajahi Sumber

fix(cli.rs): improve `rustc` not found error msg (#6021)

Amr Bashir 2 tahun lalu
induk
melakukan
7aab3e2076
2 mengubah file dengan 9 tambahan dan 1 penghapusan
  1. 5 0
      .changes/cli-rustc-not-found-msg.md
  2. 4 1
      tooling/cli/src/interface/rust.rs

+ 5 - 0
.changes/cli-rustc-not-found-msg.md

@@ -0,0 +1,5 @@
+---
+"cli.rs": "patch"
+---
+
+Improve the error message when `rustc` couldn't be found.

+ 4 - 1
tooling/cli/src/interface/rust.rs

@@ -827,7 +827,10 @@ impl RustAppSettings {
         .target()
         .map(|t| t.to_string())
         .unwrap_or_else(|| {
-          let output = Command::new("rustc").args(["-vV"]).output().unwrap();
+          let output = Command::new("rustc")
+            .args(["-vV"])
+            .output()
+            .expect("\"rustc\" could not be found, did you install Rust?");
           let stdout = String::from_utf8_lossy(&output.stdout);
           stdout
             .split('\n')