aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_project_model
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_project_model')
-rw-r--r--crates/ra_project_model/src/lib.rs12
1 files changed, 8 insertions, 4 deletions
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 }