aboutsummaryrefslogtreecommitdiff
path: root/crates/project_model
diff options
context:
space:
mode:
Diffstat (limited to 'crates/project_model')
-rw-r--r--crates/project_model/src/workspace.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/project_model/src/workspace.rs b/crates/project_model/src/workspace.rs
index d8217f714..e67ba2bd9 100644
--- a/crates/project_model/src/workspace.rs
+++ b/crates/project_model/src/workspace.rs
@@ -384,6 +384,7 @@ fn project_json_to_crate_graph(
384 file_id, 384 file_id,
385 krate.edition, 385 krate.edition,
386 krate.display_name.clone(), 386 krate.display_name.clone(),
387 cfg_options.clone(),
387 cfg_options, 388 cfg_options,
388 env, 389 env,
389 proc_macro.unwrap_or_default(), 390 proc_macro.unwrap_or_default(),
@@ -580,6 +581,7 @@ fn detached_files_to_crate_graph(
580 Edition::Edition2018, 581 Edition::Edition2018,
581 display_name, 582 display_name,
582 cfg_options.clone(), 583 cfg_options.clone(),
584 cfg_options.clone(),
583 Env::default(), 585 Env::default(),
584 Vec::new(), 586 Vec::new(),
585 ); 587 );
@@ -719,11 +721,19 @@ fn add_target_crate_root(
719 .unwrap_or_default(); 721 .unwrap_or_default();
720 722
721 let display_name = CrateDisplayName::from_canonical_name(cargo_name.to_string()); 723 let display_name = CrateDisplayName::from_canonical_name(cargo_name.to_string());
724 let mut potential_cfg_options = cfg_options.clone();
725 potential_cfg_options.extend(
726 pkg.features
727 .iter()
728 .map(|feat| CfgFlag::KeyValue { key: "feature".into(), value: feat.0.into() }),
729 );
730
722 let crate_id = crate_graph.add_crate_root( 731 let crate_id = crate_graph.add_crate_root(
723 file_id, 732 file_id,
724 edition, 733 edition,
725 Some(display_name), 734 Some(display_name),
726 cfg_options, 735 cfg_options,
736 potential_cfg_options,
727 env, 737 env,
728 proc_macro, 738 proc_macro,
729 ); 739 );
@@ -753,6 +763,7 @@ fn sysroot_to_crate_graph(
753 Edition::Edition2018, 763 Edition::Edition2018,
754 Some(display_name), 764 Some(display_name),
755 cfg_options.clone(), 765 cfg_options.clone(),
766 cfg_options.clone(),
756 env, 767 env,
757 proc_macro, 768 proc_macro,
758 ); 769 );