diff options
Diffstat (limited to 'crates/project_model/src/lib.rs')
-rw-r--r-- | crates/project_model/src/lib.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/crates/project_model/src/lib.rs b/crates/project_model/src/lib.rs index d1e7602fc..e92cfea59 100644 --- a/crates/project_model/src/lib.rs +++ b/crates/project_model/src/lib.rs | |||
@@ -13,7 +13,7 @@ use std::{ | |||
13 | }; | 13 | }; |
14 | 14 | ||
15 | use anyhow::{bail, Context, Result}; | 15 | use anyhow::{bail, Context, Result}; |
16 | use base_db::{CrateGraph, CrateId, CrateName, Edition, Env, FileId}; | 16 | use base_db::{CrateDisplayName, CrateGraph, CrateId, CrateName, Edition, Env, FileId}; |
17 | use cfg::CfgOptions; | 17 | use cfg::CfgOptions; |
18 | use paths::{AbsPath, AbsPathBuf}; | 18 | use paths::{AbsPath, AbsPathBuf}; |
19 | use rustc_hash::{FxHashMap, FxHashSet}; | 19 | use rustc_hash::{FxHashMap, FxHashSet}; |
@@ -335,8 +335,7 @@ impl ProjectWorkspace { | |||
335 | crate_graph.add_crate_root( | 335 | crate_graph.add_crate_root( |
336 | file_id, | 336 | file_id, |
337 | krate.edition, | 337 | krate.edition, |
338 | // FIXME json definitions can store the crate name | 338 | krate.display_name.clone(), |
339 | None, | ||
340 | cfg_options, | 339 | cfg_options, |
341 | env, | 340 | env, |
342 | proc_macro.unwrap_or_default(), | 341 | proc_macro.unwrap_or_default(), |
@@ -408,10 +407,12 @@ impl ProjectWorkspace { | |||
408 | .map(|it| proc_macro_client.by_dylib_path(&it)) | 407 | .map(|it| proc_macro_client.by_dylib_path(&it)) |
409 | .unwrap_or_default(); | 408 | .unwrap_or_default(); |
410 | 409 | ||
410 | let display_name = | ||
411 | CrateDisplayName::from_canonical_name(cargo[pkg].name.clone()); | ||
411 | let crate_id = crate_graph.add_crate_root( | 412 | let crate_id = crate_graph.add_crate_root( |
412 | file_id, | 413 | file_id, |
413 | edition, | 414 | edition, |
414 | Some(CrateName::normalize_dashes(&cargo[pkg].name)), | 415 | Some(display_name), |
415 | cfg_options, | 416 | cfg_options, |
416 | env, | 417 | env, |
417 | proc_macro.clone(), | 418 | proc_macro.clone(), |
@@ -485,6 +486,11 @@ impl ProjectWorkspace { | |||
485 | } | 486 | } |
486 | } | 487 | } |
487 | } | 488 | } |
489 | if crate_graph.patch_cfg_if() { | ||
490 | log::debug!("Patched std to depend on cfg-if") | ||
491 | } else { | ||
492 | log::debug!("Did not patch std to depend on cfg-if") | ||
493 | } | ||
488 | crate_graph | 494 | crate_graph |
489 | } | 495 | } |
490 | } | 496 | } |
@@ -551,7 +557,7 @@ fn sysroot_to_crate_graph( | |||
551 | let crate_id = crate_graph.add_crate_root( | 557 | let crate_id = crate_graph.add_crate_root( |
552 | file_id, | 558 | file_id, |
553 | Edition::Edition2018, | 559 | Edition::Edition2018, |
554 | Some(name), | 560 | Some(name.into()), |
555 | cfg_options.clone(), | 561 | cfg_options.clone(), |
556 | env, | 562 | env, |
557 | proc_macro, | 563 | proc_macro, |