diff options
Diffstat (limited to 'crates/project_model')
-rw-r--r-- | crates/project_model/src/cargo_workspace.rs | 11 | ||||
-rw-r--r-- | crates/project_model/src/workspace.rs | 2 |
2 files changed, 8 insertions, 5 deletions
diff --git a/crates/project_model/src/cargo_workspace.rs b/crates/project_model/src/cargo_workspace.rs index c0ed37fc1..a09e1a9ff 100644 --- a/crates/project_model/src/cargo_workspace.rs +++ b/crates/project_model/src/cargo_workspace.rs | |||
@@ -99,8 +99,10 @@ pub struct PackageData { | |||
99 | pub dependencies: Vec<PackageDependency>, | 99 | pub dependencies: Vec<PackageDependency>, |
100 | /// Rust edition for this package | 100 | /// Rust edition for this package |
101 | pub edition: Edition, | 101 | pub edition: Edition, |
102 | /// List of features to activate | 102 | /// Features provided by the crate, mapped to the features required by that feature. |
103 | pub features: Vec<String>, | 103 | pub features: FxHashMap<String, Vec<String>>, |
104 | /// List of features enabled on this package | ||
105 | pub active_features: Vec<String>, | ||
104 | /// List of config flags defined by this package's build script | 106 | /// List of config flags defined by this package's build script |
105 | pub cfgs: Vec<CfgFlag>, | 107 | pub cfgs: Vec<CfgFlag>, |
106 | /// List of cargo-related environment variables with their value | 108 | /// List of cargo-related environment variables with their value |
@@ -281,7 +283,8 @@ impl CargoWorkspace { | |||
281 | is_member, | 283 | is_member, |
282 | edition, | 284 | edition, |
283 | dependencies: Vec::new(), | 285 | dependencies: Vec::new(), |
284 | features: Vec::new(), | 286 | features: meta_pkg.features.into_iter().collect(), |
287 | active_features: Vec::new(), | ||
285 | cfgs: cfgs.get(&id).cloned().unwrap_or_default(), | 288 | cfgs: cfgs.get(&id).cloned().unwrap_or_default(), |
286 | envs: envs.get(&id).cloned().unwrap_or_default(), | 289 | envs: envs.get(&id).cloned().unwrap_or_default(), |
287 | out_dir: out_dir_by_id.get(&id).cloned(), | 290 | out_dir: out_dir_by_id.get(&id).cloned(), |
@@ -328,7 +331,7 @@ impl CargoWorkspace { | |||
328 | let dep = PackageDependency { name: dep_node.name, pkg }; | 331 | let dep = PackageDependency { name: dep_node.name, pkg }; |
329 | packages[source].dependencies.push(dep); | 332 | packages[source].dependencies.push(dep); |
330 | } | 333 | } |
331 | packages[source].features.extend(node.features); | 334 | packages[source].active_features.extend(node.features); |
332 | } | 335 | } |
333 | 336 | ||
334 | let workspace_root = AbsPathBuf::assert(meta.workspace_root); | 337 | let workspace_root = AbsPathBuf::assert(meta.workspace_root); |
diff --git a/crates/project_model/src/workspace.rs b/crates/project_model/src/workspace.rs index 8e0481ae9..073c48af7 100644 --- a/crates/project_model/src/workspace.rs +++ b/crates/project_model/src/workspace.rs | |||
@@ -481,7 +481,7 @@ fn add_target_crate_root( | |||
481 | let edition = pkg.edition; | 481 | let edition = pkg.edition; |
482 | let cfg_options = { | 482 | let cfg_options = { |
483 | let mut opts = cfg_options.clone(); | 483 | let mut opts = cfg_options.clone(); |
484 | for feature in pkg.features.iter() { | 484 | for feature in pkg.active_features.iter() { |
485 | opts.insert_key_value("feature".into(), feature.into()); | 485 | opts.insert_key_value("feature".into(), feature.into()); |
486 | } | 486 | } |
487 | opts.extend(pkg.cfgs.iter().cloned()); | 487 | opts.extend(pkg.cfgs.iter().cloned()); |