diff options
author | Aleksey Kladov <[email protected]> | 2020-06-11 10:04:09 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-06-23 16:51:06 +0100 |
commit | dad1333b48c38bc7a5628fc0ff5304d003776a85 (patch) | |
tree | 29be52a980b4cae72f46a48c48135a15e31641e0 /crates/ra_project_model | |
parent | 7aa66371ee3e8b31217513204c8b4f683584419d (diff) |
New VFS
Diffstat (limited to 'crates/ra_project_model')
-rw-r--r-- | crates/ra_project_model/src/lib.rs | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs index 9541362f5..fe3e81689 100644 --- a/crates/ra_project_model/src/lib.rs +++ b/crates/ra_project_model/src/lib.rs | |||
@@ -13,7 +13,7 @@ use std::{ | |||
13 | 13 | ||
14 | use anyhow::{bail, Context, Result}; | 14 | use anyhow::{bail, Context, Result}; |
15 | use ra_cfg::CfgOptions; | 15 | use ra_cfg::CfgOptions; |
16 | use ra_db::{CrateGraph, CrateName, Edition, Env, ExternSource, ExternSourceId, FileId}; | 16 | use ra_db::{CrateGraph, CrateName, Edition, Env, FileId}; |
17 | use rustc_hash::{FxHashMap, FxHashSet}; | 17 | use rustc_hash::{FxHashMap, FxHashSet}; |
18 | use serde_json::from_reader; | 18 | use serde_json::from_reader; |
19 | 19 | ||
@@ -246,7 +246,6 @@ impl ProjectWorkspace { | |||
246 | pub fn to_crate_graph( | 246 | pub fn to_crate_graph( |
247 | &self, | 247 | &self, |
248 | target: Option<&str>, | 248 | target: Option<&str>, |
249 | extern_source_roots: &FxHashMap<PathBuf, ExternSourceId>, | ||
250 | proc_macro_client: &ProcMacroClient, | 249 | proc_macro_client: &ProcMacroClient, |
251 | load: &mut dyn FnMut(&Path) -> Option<FileId>, | 250 | load: &mut dyn FnMut(&Path) -> Option<FileId>, |
252 | ) -> CrateGraph { | 251 | ) -> CrateGraph { |
@@ -280,15 +279,11 @@ impl ProjectWorkspace { | |||
280 | }; | 279 | }; |
281 | 280 | ||
282 | let mut env = Env::default(); | 281 | let mut env = Env::default(); |
283 | let mut extern_source = ExternSource::default(); | ||
284 | if let Some(out_dir) = &krate.out_dir { | 282 | if let Some(out_dir) = &krate.out_dir { |
285 | // NOTE: cargo and rustc seem to hide non-UTF-8 strings from env! and option_env!() | 283 | // NOTE: cargo and rustc seem to hide non-UTF-8 strings from env! and option_env!() |
286 | if let Some(out_dir) = out_dir.to_str().map(|s| s.to_owned()) { | 284 | if let Some(out_dir) = out_dir.to_str().map(|s| s.to_owned()) { |
287 | env.set("OUT_DIR", out_dir); | 285 | env.set("OUT_DIR", out_dir); |
288 | } | 286 | } |
289 | if let Some(&extern_source_id) = extern_source_roots.get(out_dir) { | ||
290 | extern_source.set_extern_path(&out_dir, extern_source_id); | ||
291 | } | ||
292 | } | 287 | } |
293 | let proc_macro = krate | 288 | let proc_macro = krate |
294 | .proc_macro_dylib_path | 289 | .proc_macro_dylib_path |
@@ -304,7 +299,6 @@ impl ProjectWorkspace { | |||
304 | None, | 299 | None, |
305 | cfg_options, | 300 | cfg_options, |
306 | env, | 301 | env, |
307 | extern_source, | ||
308 | proc_macro.unwrap_or_default(), | 302 | proc_macro.unwrap_or_default(), |
309 | ), | 303 | ), |
310 | )) | 304 | )) |
@@ -341,7 +335,6 @@ impl ProjectWorkspace { | |||
341 | let file_id = load(&sysroot[krate].root)?; | 335 | let file_id = load(&sysroot[krate].root)?; |
342 | 336 | ||
343 | let env = Env::default(); | 337 | let env = Env::default(); |
344 | let extern_source = ExternSource::default(); | ||
345 | let proc_macro = vec![]; | 338 | let proc_macro = vec![]; |
346 | let crate_name = CrateName::new(&sysroot[krate].name) | 339 | let crate_name = CrateName::new(&sysroot[krate].name) |
347 | .expect("Sysroot crate names should not contain dashes"); | 340 | .expect("Sysroot crate names should not contain dashes"); |
@@ -352,7 +345,6 @@ impl ProjectWorkspace { | |||
352 | Some(crate_name), | 345 | Some(crate_name), |
353 | cfg_options.clone(), | 346 | cfg_options.clone(), |
354 | env, | 347 | env, |
355 | extern_source, | ||
356 | proc_macro, | 348 | proc_macro, |
357 | ); | 349 | ); |
358 | Some((krate, crate_id)) | 350 | Some((krate, crate_id)) |
@@ -409,15 +401,11 @@ impl ProjectWorkspace { | |||
409 | opts | 401 | opts |
410 | }; | 402 | }; |
411 | let mut env = Env::default(); | 403 | let mut env = Env::default(); |
412 | let mut extern_source = ExternSource::default(); | ||
413 | if let Some(out_dir) = &cargo[pkg].out_dir { | 404 | if let Some(out_dir) = &cargo[pkg].out_dir { |
414 | // NOTE: cargo and rustc seem to hide non-UTF-8 strings from env! and option_env!() | 405 | // NOTE: cargo and rustc seem to hide non-UTF-8 strings from env! and option_env!() |
415 | if let Some(out_dir) = out_dir.to_str().map(|s| s.to_owned()) { | 406 | if let Some(out_dir) = out_dir.to_str().map(|s| s.to_owned()) { |
416 | env.set("OUT_DIR", out_dir); | 407 | env.set("OUT_DIR", out_dir); |
417 | } | 408 | } |
418 | if let Some(&extern_source_id) = extern_source_roots.get(out_dir) { | ||
419 | extern_source.set_extern_path(&out_dir, extern_source_id); | ||
420 | } | ||
421 | } | 409 | } |
422 | let proc_macro = cargo[pkg] | 410 | let proc_macro = cargo[pkg] |
423 | .proc_macro_dylib_path | 411 | .proc_macro_dylib_path |
@@ -431,7 +419,6 @@ impl ProjectWorkspace { | |||
431 | Some(CrateName::normalize_dashes(&cargo[pkg].name)), | 419 | Some(CrateName::normalize_dashes(&cargo[pkg].name)), |
432 | cfg_options, | 420 | cfg_options, |
433 | env, | 421 | env, |
434 | extern_source, | ||
435 | proc_macro.clone(), | 422 | proc_macro.clone(), |
436 | ); | 423 | ); |
437 | if cargo[tgt].kind == TargetKind::Lib { | 424 | if cargo[tgt].kind == TargetKind::Lib { |