diff options
Diffstat (limited to 'crates/ra_project_model/src')
-rw-r--r-- | crates/ra_project_model/src/cargo_workspace.rs | 5 | ||||
-rw-r--r-- | crates/ra_project_model/src/lib.rs | 12 |
2 files changed, 13 insertions, 4 deletions
diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index 84008b2e3..362ee30fe 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs | |||
@@ -141,6 +141,11 @@ impl CargoWorkspace { | |||
141 | cargo_toml: &Path, | 141 | cargo_toml: &Path, |
142 | cargo_features: &CargoConfig, | 142 | cargo_features: &CargoConfig, |
143 | ) -> Result<CargoWorkspace> { | 143 | ) -> Result<CargoWorkspace> { |
144 | let _ = Command::new(cargo_binary()) | ||
145 | .arg("--version") | ||
146 | .output() | ||
147 | .context("failed to run `cargo --version`, is `cargo` in PATH?")?; | ||
148 | |||
144 | let mut meta = MetadataCommand::new(); | 149 | let mut meta = MetadataCommand::new(); |
145 | meta.manifest_path(cargo_toml); | 150 | meta.manifest_path(cargo_toml); |
146 | if cargo_features.all_features { | 151 | if cargo_features.all_features { |
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs index 03f2629da..731cbd291 100644 --- a/crates/ra_project_model/src/lib.rs +++ b/crates/ra_project_model/src/lib.rs | |||
@@ -285,8 +285,10 @@ impl ProjectWorkspace { | |||
285 | let mut env = Env::default(); | 285 | let mut env = Env::default(); |
286 | let mut extern_source = ExternSource::default(); | 286 | let mut extern_source = ExternSource::default(); |
287 | if let Some(out_dir) = &krate.out_dir { | 287 | if let Some(out_dir) = &krate.out_dir { |
288 | // FIXME: We probably mangle non UTF-8 paths here, figure out a better solution | 288 | // NOTE: cargo and rustc seem to hide non-UTF-8 strings from env! and option_env!() |
289 | env.set("OUT_DIR", out_dir.to_string_lossy().to_string()); | 289 | if let Some(out_dir) = out_dir.to_str().map(|s| s.to_owned()) { |
290 | env.set("OUT_DIR", out_dir); | ||
291 | } | ||
290 | if let Some(&extern_source_id) = extern_source_roots.get(out_dir) { | 292 | if let Some(&extern_source_id) = extern_source_roots.get(out_dir) { |
291 | extern_source.set_extern_path(&out_dir, extern_source_id); | 293 | extern_source.set_extern_path(&out_dir, extern_source_id); |
292 | } | 294 | } |
@@ -402,8 +404,10 @@ impl ProjectWorkspace { | |||
402 | let mut env = Env::default(); | 404 | let mut env = Env::default(); |
403 | let mut extern_source = ExternSource::default(); | 405 | let mut extern_source = ExternSource::default(); |
404 | if let Some(out_dir) = &cargo[pkg].out_dir { | 406 | if let Some(out_dir) = &cargo[pkg].out_dir { |
405 | // FIXME: We probably mangle non UTF-8 paths here, figure out a better solution | 407 | // NOTE: cargo and rustc seem to hide non-UTF-8 strings from env! and option_env!() |
406 | env.set("OUT_DIR", out_dir.to_string_lossy().to_string()); | 408 | if let Some(out_dir) = out_dir.to_str().map(|s| s.to_owned()) { |
409 | env.set("OUT_DIR", out_dir); | ||
410 | } | ||
407 | if let Some(&extern_source_id) = extern_source_roots.get(out_dir) { | 411 | if let Some(&extern_source_id) = extern_source_roots.get(out_dir) { |
408 | extern_source.set_extern_path(&out_dir, extern_source_id); | 412 | extern_source.set_extern_path(&out_dir, extern_source_id); |
409 | } | 413 | } |