Skip to content

Commit f78dbd9

Browse files
committed
doc(features2): clarify some docs
1 parent 421ae05 commit f78dbd9

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/cargo/core/compiler/unit_dependencies.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,7 @@ impl<'a, 'cfg> State<'a, 'cfg> {
10311031
}
10321032
}
10331033

1034+
/// See [`ResolvedFeatures::activated_features`].
10341035
fn activated_features(
10351036
&self,
10361037
pkg_id: PackageId,
@@ -1040,6 +1041,7 @@ impl<'a, 'cfg> State<'a, 'cfg> {
10401041
features.activated_features(pkg_id, features_for)
10411042
}
10421043

1044+
/// See [`ResolvedFeatures::is_activated`].
10431045
fn is_activated(&self, pkg_id: PackageId, features_for: FeaturesFor) -> bool {
10441046
self.features().is_activated(pkg_id, features_for)
10451047
}

src/cargo/core/resolver/features.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,9 @@ type ActivateMap = HashMap<PackageFeaturesKey, BTreeSet<InternedString>>;
4949

5050
/// Set of all activated features for all packages in the resolve graph.
5151
pub struct ResolvedFeatures {
52+
/// Map of features activated for each package.
5253
activated_features: ActivateMap,
53-
/// Optional dependencies that should be built.
54-
///
55-
/// The value is the `name_in_toml` of the dependencies.
56-
activated_dependencies: ActivateMap,
54+
/// Options that change how the feature resolver operates.
5755
opts: FeatureOpts,
5856
}
5957

@@ -315,10 +313,10 @@ impl ResolvedFeatures {
315313
.expect("activated_features for invalid package")
316314
}
317315

318-
/// Returns if the given dependency should be included.
316+
/// Asks the resolved features if the given package should be included.
319317
///
320-
/// This handles dependencies disabled via `cfg` expressions and optional
321-
/// dependencies which are not enabled.
318+
/// One scenario to use this function is to deteremine a optional dependency
319+
/// should be built or not.
322320
pub fn is_activated(&self, pkg_id: PackageId, features_for: FeaturesFor) -> bool {
323321
log::trace!("is_activated {} {features_for}", pkg_id.name());
324322
self.activated_features_unverified(pkg_id, features_for.apply_opts(&self.opts))

0 commit comments

Comments
 (0)