aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_project_model/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-04-25 11:35:14 +0100
committerGitHub <[email protected]>2020-04-25 11:35:14 +0100
commitf654f4943552888c2b8f079cf687970268d81f18 (patch)
treed0d12e63caa092d986e1ce352e6de0a2cb4cdbdd /crates/ra_project_model/src
parent29fc409e7fe5b12dcf6bfbcca622d79c4c8fcb72 (diff)
parent58dde891f87bc6131b0ef34c33f6ffb9aa0c0ec3 (diff)
Merge #4125
4125: Avoid lossy OsString conversions r=matklad a=lnicola This is a bit invasive, and perhaps for not much benefit since non-UTF-8 environment variables don't work anyway. Co-authored-by: LaurenČ›iu Nicola <[email protected]>
Diffstat (limited to 'crates/ra_project_model/src')
-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 }