diff options
author | Jamie Cunliffe <[email protected]> | 2021-05-31 20:45:01 +0100 |
---|---|---|
committer | Jamie Cunliffe <[email protected]> | 2021-06-21 17:54:05 +0100 |
commit | ae823aa23f1c4fa55e71dd972d0b10c69148b0b4 (patch) | |
tree | 9c39a29bdee4f45dcbd497c25350cbfbb0c5e9c3 /crates/project_model/src | |
parent | 284483b347d15bee3a7bf293d33e5f19a9740102 (diff) |
Move features into potential_cfg_options
Diffstat (limited to 'crates/project_model/src')
-rw-r--r-- | crates/project_model/src/workspace.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/crates/project_model/src/workspace.rs b/crates/project_model/src/workspace.rs index 9ee3fc1a3..e67ba2bd9 100644 --- a/crates/project_model/src/workspace.rs +++ b/crates/project_model/src/workspace.rs | |||
@@ -384,10 +384,10 @@ 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(), |
390 | Default::default(), | ||
391 | ), | 391 | ), |
392 | ) | 392 | ) |
393 | }) | 393 | }) |
@@ -581,9 +581,9 @@ fn detached_files_to_crate_graph( | |||
581 | Edition::Edition2018, | 581 | Edition::Edition2018, |
582 | display_name, | 582 | display_name, |
583 | cfg_options.clone(), | 583 | cfg_options.clone(), |
584 | cfg_options.clone(), | ||
584 | Env::default(), | 585 | Env::default(), |
585 | Vec::new(), | 586 | Vec::new(), |
586 | Default::default(), | ||
587 | ); | 587 | ); |
588 | 588 | ||
589 | for (name, krate) in public_deps.iter() { | 589 | for (name, krate) in public_deps.iter() { |
@@ -721,14 +721,21 @@ fn add_target_crate_root( | |||
721 | .unwrap_or_default(); | 721 | .unwrap_or_default(); |
722 | 722 | ||
723 | 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 | |||
724 | let crate_id = crate_graph.add_crate_root( | 731 | let crate_id = crate_graph.add_crate_root( |
725 | file_id, | 732 | file_id, |
726 | edition, | 733 | edition, |
727 | Some(display_name), | 734 | Some(display_name), |
728 | cfg_options, | 735 | cfg_options, |
736 | potential_cfg_options, | ||
729 | env, | 737 | env, |
730 | proc_macro, | 738 | proc_macro, |
731 | pkg.features.clone(), | ||
732 | ); | 739 | ); |
733 | 740 | ||
734 | crate_id | 741 | crate_id |
@@ -756,9 +763,9 @@ fn sysroot_to_crate_graph( | |||
756 | Edition::Edition2018, | 763 | Edition::Edition2018, |
757 | Some(display_name), | 764 | Some(display_name), |
758 | cfg_options.clone(), | 765 | cfg_options.clone(), |
766 | cfg_options.clone(), | ||
759 | env, | 767 | env, |
760 | proc_macro, | 768 | proc_macro, |
761 | Default::default(), | ||
762 | ); | 769 | ); |
763 | Some((krate, crate_id)) | 770 | Some((krate, crate_id)) |
764 | }) | 771 | }) |