]> git.lizzy.rs Git - rust.git/commitdiff
More helpful error message if toolchain is not in PATH
authorAleksey Kladov <aleksey.kladov@gmail.com>
Fri, 24 Apr 2020 20:01:32 +0000 (22:01 +0200)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Fri, 24 Apr 2020 20:01:32 +0000 (22:01 +0200)
crates/ra_project_model/src/cargo_workspace.rs

index 84008b2e344d671759fdf4979f9eaf64c94ad95c..0613310f1f556aa88d23463db0cea9165f36c252 100644 (file)
@@ -141,6 +141,11 @@ pub fn from_cargo_metadata(
         cargo_toml: &Path,
         cargo_features: &CargoConfig,
     ) -> Result<CargoWorkspace> {
+        let _ = Command::new(cargo_binary())
+            .arg("--version")
+            .status()
+            .context("failed to run `cargo --version`, is `cargo` in PATH?")?;
+
         let mut meta = MetadataCommand::new();
         meta.manifest_path(cargo_toml);
         if cargo_features.all_features {