From ae823aa23f1c4fa55e71dd972d0b10c69148b0b4 Mon Sep 17 00:00:00 2001 From: Jamie Cunliffe Date: Mon, 31 May 2021 20:45:01 +0100 Subject: Move features into potential_cfg_options --- crates/base_db/src/fixture.rs | 5 +++-- crates/base_db/src/input.rs | 26 +++++++++++++------------- 2 files changed, 16 insertions(+), 15 deletions(-) (limited to 'crates/base_db') diff --git a/crates/base_db/src/fixture.rs b/crates/base_db/src/fixture.rs index 6d3b1266e..7d5d12e63 100644 --- a/crates/base_db/src/fixture.rs +++ b/crates/base_db/src/fixture.rs @@ -128,10 +128,10 @@ impl ChangeFixture { file_id, meta.edition, Some(crate_name.clone().into()), + meta.cfg.clone(), meta.cfg, meta.env, Default::default(), - Default::default(), ); let prev = crates.insert(crate_name.clone(), crate_id); assert!(prev.is_none()); @@ -158,10 +158,10 @@ impl ChangeFixture { crate_root, Edition::Edition2018, Some(CrateName::new("test").unwrap().into()), + default_cfg.clone(), default_cfg, Env::default(), Default::default(), - Default::default(), ); } else { for (from, to) in crate_deps { @@ -188,6 +188,7 @@ impl ChangeFixture { Edition::Edition2021, Some(CrateDisplayName::from_canonical_name("core".to_string())), CfgOptions::default(), + CfgOptions::default(), Env::default(), Vec::new(), ); diff --git a/crates/base_db/src/input.rs b/crates/base_db/src/input.rs index d99388f71..0c51a59a0 100644 --- a/crates/base_db/src/input.rs +++ b/crates/base_db/src/input.rs @@ -189,10 +189,10 @@ pub struct CrateData { /// `Dependency` matters), this name should only be used for UI. pub display_name: Option, pub cfg_options: CfgOptions, + pub potential_cfg_options: CfgOptions, pub env: Env, pub dependencies: Vec, pub proc_macro: Vec, - pub features: FxHashMap>, } #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] @@ -220,19 +220,19 @@ impl CrateGraph { edition: Edition, display_name: Option, cfg_options: CfgOptions, + potential_cfg_options: CfgOptions, env: Env, proc_macro: Vec, - features: FxHashMap>, ) -> CrateId { let data = CrateData { root_file_id: file_id, edition, display_name, cfg_options, + potential_cfg_options, env, proc_macro, dependencies: Vec::new(), - features, }; let crate_id = CrateId(self.arena.len() as u32); let prev = self.arena.insert(crate_id, data); @@ -507,27 +507,27 @@ mod tests { Edition2018, None, CfgOptions::default(), + CfgOptions::default(), Env::default(), Default::default(), - Default::default(), ); let crate2 = graph.add_crate_root( FileId(2u32), Edition2018, None, CfgOptions::default(), + CfgOptions::default(), Env::default(), Default::default(), - Default::default(), ); let crate3 = graph.add_crate_root( FileId(3u32), Edition2018, None, CfgOptions::default(), + CfgOptions::default(), Env::default(), Default::default(), - Default::default(), ); assert!(graph.add_dep(crate1, CrateName::new("crate2").unwrap(), crate2).is_ok()); assert!(graph.add_dep(crate2, CrateName::new("crate3").unwrap(), crate3).is_ok()); @@ -542,18 +542,18 @@ mod tests { Edition2018, None, CfgOptions::default(), + CfgOptions::default(), Env::default(), Default::default(), - Default::default(), ); let crate2 = graph.add_crate_root( FileId(2u32), Edition2018, None, CfgOptions::default(), + CfgOptions::default(), Env::default(), Default::default(), - Default::default(), ); assert!(graph.add_dep(crate1, CrateName::new("crate2").unwrap(), crate2).is_ok()); assert!(graph.add_dep(crate2, CrateName::new("crate2").unwrap(), crate2).is_err()); @@ -567,27 +567,27 @@ mod tests { Edition2018, None, CfgOptions::default(), + CfgOptions::default(), Env::default(), Default::default(), - Default::default(), ); let crate2 = graph.add_crate_root( FileId(2u32), Edition2018, None, CfgOptions::default(), + CfgOptions::default(), Env::default(), Default::default(), - Default::default(), ); let crate3 = graph.add_crate_root( FileId(3u32), Edition2018, None, CfgOptions::default(), + CfgOptions::default(), Env::default(), Default::default(), - Default::default(), ); assert!(graph.add_dep(crate1, CrateName::new("crate2").unwrap(), crate2).is_ok()); assert!(graph.add_dep(crate2, CrateName::new("crate3").unwrap(), crate3).is_ok()); @@ -601,18 +601,18 @@ mod tests { Edition2018, None, CfgOptions::default(), + CfgOptions::default(), Env::default(), Default::default(), - Default::default(), ); let crate2 = graph.add_crate_root( FileId(2u32), Edition2018, None, CfgOptions::default(), + CfgOptions::default(), Env::default(), Default::default(), - Default::default(), ); assert!(graph .add_dep(crate1, CrateName::normalize_dashes("crate-name-with-dashes"), crate2) -- cgit v1.2.3