@@ -57,6 +57,9 @@ type ActivateMap = HashMap<PackageFeaturesKey, BTreeSet<InternedString>>;
57
57
/// Set of all activated features for all packages in the resolve graph.
58
58
pub struct ResolvedFeatures {
59
59
/// Map of features activated for each package.
60
+ ///
61
+ /// The presence of each key also means the package itself is activated,
62
+ /// even its associated set contains no features.
60
63
activated_features : ActivateMap ,
61
64
/// Options that change how the feature resolver operates.
62
65
opts : FeatureOpts ,
@@ -406,8 +409,14 @@ pub struct FeatureResolver<'a, 'cfg> {
406
409
/// Options that change how the feature resolver operates.
407
410
opts : FeatureOpts ,
408
411
/// Map of features activated for each package.
412
+ ///
413
+ /// The presence of each key also means the package itself is activated,
414
+ /// even its associated set contains no features.
409
415
activated_features : ActivateMap ,
410
416
/// Map of optional dependencies activated for each package.
417
+ ///
418
+ /// The key is the package having their dependencies activated.
419
+ /// The value comes from `dep_name` part of the feature syntax `dep:dep_name`.
411
420
activated_dependencies : ActivateMap ,
412
421
/// Keeps track of which packages have had its dependencies processed.
413
422
/// Used to avoid cycles, and to speed up processing.
@@ -497,10 +506,10 @@ impl<'a, 'cfg> FeatureResolver<'a, 'cfg> {
497
506
Ok ( ( ) )
498
507
}
499
508
500
- /// Activates [`FeatureValue`]s on the given package.
509
+ /// Activates a list of [`FeatureValue`] for a given package.
501
510
///
502
- /// This is the main entrance into the recursion of feature activation
503
- /// for a package .
511
+ /// This is the main entrance into the recursion of feature activation for a package.
512
+ /// Other `activate_*` functions would be called inside this function accordingly .
504
513
fn activate_pkg (
505
514
& mut self ,
506
515
pkg_id : PackageId ,
@@ -510,7 +519,8 @@ impl<'a, 'cfg> FeatureResolver<'a, 'cfg> {
510
519
log:: trace!( "activate_pkg {} {}" , pkg_id. name( ) , fk) ;
511
520
// Add an empty entry to ensure everything is covered. This is intended for
512
521
// finding bugs where the resolver missed something it should have visited.
513
- // Remove this in the future if `activated_features` uses an empty default.
522
+ // The presence of an (empty) set also means that the dependency is activated,
523
+ // The presence of an (empty) set also means that the dependency is activated.
514
524
self . activated_features
515
525
. entry ( ( pkg_id, fk. apply_opts ( & self . opts ) ) )
516
526
. or_insert_with ( BTreeSet :: new) ;
0 commit comments