Переглянути джерело

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

Amr Bashir 2 роки тому
батько
коміт
7aab3e2076

+ 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')