| 1 | //! Helper for parsing the microsyntax of the `[features]` section and computing implied features from optional dependencies. |
| 2 | |
| 3 | use craterust-analyzer cargo cargo_toml 0.22.3 crate/::{Dependencyrust-analyzer cargo cargo_toml 0.22.3 Dependency#, DepsSetrust-analyzer cargo cargo_toml 0.22.3 DepsSet#, Manifestrust-analyzer cargo cargo_toml 0.22.3 Manifest#, Productrust-analyzer cargo cargo_toml 0.22.3 Product#, TargetDepsSetrust-analyzer cargo cargo_toml 0.22.3 TargetDepsSet#}; |
| 4 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#; |
| 5 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::hash_maprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash_map/::{Entryrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/Entry#, RandomStaterust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/random/RandomState#}; |
| 6 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::{BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#, BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#, HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#}; |
| 7 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::hashrust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/::BuildHasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/BuildHasher#; |
| 8 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#; |
| 9 | |
| 10 | /// Maximum number of features and dependencies, to protect against DoS |
| 11 | /// crates.io limit is 300. |
| 12 | const MAX_ITEMSrust-analyzer cargo cargo_toml 0.22.3 features/MAX_ITEMS.: usize = 2048; |
| 13 | |
| 14 | /// Call [`features::Resolver::new()`](Resolver::new) to get started. |
| 15 | /// |
| 16 | /// The extra `Hasher` arg is for optionally using [`ahash`](https://lib.rs/ahash). |
| 17 | pub struct Resolverrust-analyzer cargo cargo_toml 0.22.3 features/Resolver#<'config, Hasher = RandomStaterust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/random/RandomState#> { |
| 18 | always_keeprust-analyzer cargo cargo_toml 0.22.3 features/Resolver#always_keep.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&'config dyn Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&str) -> bool>, |
| 19 | _hasherrust-analyzer cargo cargo_toml 0.22.3 features/Resolver#_hasher.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<fn() -> Hasher>, |
| 20 | } |
| 21 | |
| 22 | /// Parse result |
| 23 | /// |
| 24 | /// It's a temporary struct that borrows from the manifest. Copy things out of this if lifetimes get in the way. |
| 25 | /// |
| 26 | /// The extra `Hasher` arg is for optionally using [`ahash`](https://lib.rs/ahash). |
| 27 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 28 | #[non_exhaustive] |
| 29 | pub struct Featuresrust-analyzer cargo cargo_toml 0.22.3 features/Features#<'manifest, 'deps, Hasher = RandomStaterust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/random/RandomState#> { |
| 30 | /// All features, resolved and normalized |
| 31 | /// |
| 32 | /// Default features are literally under the "default" key. |
| 33 | pub featuresrust-analyzer cargo cargo_toml 0.22.3 features/Features#features.: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'manifest str, Featurerust-analyzer cargo cargo_toml 0.22.3 features/Feature#<'manifest>, Hasher>, |
| 34 | /// FYI, dependencies referenced by the features, keyed by dependencies' name/identifier in TOML (that's not always the crate name) |
| 35 | /// |
| 36 | /// This doesn't include *all* dependencies. Dependencies unaffected by any features selection are skipped. |
| 37 | pub dependenciesrust-analyzer cargo cargo_toml 0.22.3 features/Features#dependencies.: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'deps str, FeatureDependencyrust-analyzer cargo cargo_toml 0.22.3 features/FeatureDependency#<'deps>, Hasher>, |
| 38 | /// True if there were features with names staring with `_` and were inlined and merged into other features |
| 39 | /// |
| 40 | /// See arg of [`new_with_hasher_and_filter`](Resolver::new_with_hasher_and_filter) to disable removal. |
| 41 | pub removed_hidden_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Features#removed_hidden_features.: bool, |
| 42 | |
| 43 | /// A redirect from removed feature to its replacements |
| 44 | pub hidden_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Features#hidden_features.: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'manifest str, BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#<&'manifest str>, Hasher>, |
| 45 | } |
| 46 | |
| 47 | /// How an enabled feature affects the dependency |
| 48 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 49 | #[non_exhaustive] |
| 50 | pub struct DepActionrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#<'a> { |
| 51 | /// Uses `?` syntax, so it doesn't enable the depenency |
| 52 | pub is_conditionalrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#is_conditional.: bool, |
| 53 | /// Uses `dep:` or `?` syntax, so it doesn't imply a feature name |
| 54 | pub is_dep_onlyrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#is_dep_only.: bool, |
| 55 | /// Features of the dependency to enable (the text after slash, possibly aggregated from multiple items) |
| 56 | pub dep_featuresrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#dep_features.: BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#<Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'a, str>>, |
| 57 | } |
| 58 | |
| 59 | /// A feature from `[features]` with all the details |
| 60 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 61 | #[non_exhaustive] |
| 62 | pub struct Featurerust-analyzer cargo cargo_toml 0.22.3 features/Feature#<'a> { |
| 63 | /// Name of the feature |
| 64 | pub keyrust-analyzer cargo cargo_toml 0.22.3 features/Feature#key.: &'a str, |
| 65 | /// Deps this enables or modifies, by their manifest key (the key isn't always the same as the crate name) |
| 66 | /// |
| 67 | /// This set is shallow (this feature may also be enabling other features that enable more deps), see [`Feature::enables_recursive`]. |
| 68 | pub enables_depsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_deps.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<&'a str, DepActionrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#<'a>>, |
| 69 | /// Enables these explicitly named features |
| 70 | /// |
| 71 | /// This set is shallow, and the features listed here may be enabling more features, see [`Feature::enables_recursive`]. |
| 72 | /// Note that Cargo permits infinite loops (A enables B, B enables A). |
| 73 | pub enables_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_features.: BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#<&'a str>, |
| 74 | |
| 75 | /// Keys of other features that directly enable this feature (this is shallow, not recursive) |
| 76 | pub enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by.: BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#<&'a str>, |
| 77 | |
| 78 | /// Names of binaries that mention this feature in their `required-features = [this feature]` |
| 79 | /// |
| 80 | /// Name of the default unnamed binary is set to the package name, and not normalized. |
| 81 | pub required_by_binsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#required_by_bins.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&'a str>, |
| 82 | |
| 83 | /// If true, it's from `[features]`. If false, it's from `[dependencies]`. |
| 84 | /// |
| 85 | /// If it's not explicit, and `is_referenced() == true`, it's probably a mistake and wasn't supposed to be a feature. |
| 86 | /// See `is_user_facing`. |
| 87 | pub explicitrust-analyzer cargo cargo_toml 0.22.3 features/Feature#explicit.: bool, |
| 88 | } |
| 89 | |
| 90 | /// Outer key is the dependency key/name, the `Vec` contains feature names |
| 91 | pub type DependenciesEnabledByFeaturesrust-analyzer cargo cargo_toml 0.22.3 features/DependenciesEnabledByFeatures#<'a, S> = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'a str, Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(&'a str, &'a DepActionrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#<'a>)>, S>; |
| 92 | |
| 93 | impl<'a> Featurerust-analyzer cargo cargo_toml 0.22.3 features/Feature#<'a> { |
| 94 | /// Heuristic whether this feature should be shown to users |
| 95 | /// |
| 96 | /// Skips underscore-prefixed features, and possibly unintended features implied by optional dependencies |
| 97 | #[inline] |
| 98 | #[must_use] |
| 99 | pub fn is_user_facingrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Feature<'a>`]is_user_facing().(&self) -> bool { |
| 100 | (self.explicitrust-analyzer cargo cargo_toml 0.22.3 features/Feature#explicit. || !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.is_referencedrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Feature<'a>`]is_referenced().()) && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.keyrust-analyzer cargo cargo_toml 0.22.3 features/Feature#key..starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('_') |
| 101 | } |
| 102 | |
| 103 | /// Just `enabled_by` except the "default" feature |
| 104 | #[inline] |
| 105 | pub fn non_default_enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Feature<'a>`]non_default_enabled_by().(&self) -> impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = &str> { |
| 106 | self.enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]iter().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|&e| e rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne()."default") |
| 107 | } |
| 108 | |
| 109 | /// Is any other feature using this one? |
| 110 | #[inline] |
| 111 | #[must_use] |
| 112 | pub fn is_referencedrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Feature<'a>`]is_referenced().(&self) -> bool { |
| 113 | !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]is_empty().() |
| 114 | } |
| 115 | |
| 116 | /// Finds all features and dependencies that this feature enables, recursively and exhaustively |
| 117 | /// |
| 118 | /// The first `HashMap` is features by their key, the second is dependencies by their key. It includes only dependencies changed by the features, not all crate dependencies. |
| 119 | #[must_use] |
| 120 | pub fn enables_recursiverust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Feature<'a>`]enables_recursive().<S: BuildHasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/BuildHasher# + Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#>(&'a self, features: &'a HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'a str, Featurerust-analyzer cargo cargo_toml 0.22.3 features/Feature#<'a>, S>) -> (HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'a str, &'a Featurerust-analyzer cargo cargo_toml 0.22.3 features/Feature#<'a>, S>, DependenciesEnabledByFeaturesrust-analyzer cargo cargo_toml 0.22.3 features/DependenciesEnabledByFeatures#<'a, S>) { |
| 121 | let mut features_set = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::with_capacity_and_hasherrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S>`]with_capacity_and_hasher().(self.enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().self.enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]len().()/rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().2, S::defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#default().()); |
| 122 | let mut deps_set = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::with_capacity_and_hasherrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S>`]with_capacity_and_hasher().(self.enables_depsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_deps..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().self.enables_depsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_deps..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]len().()/rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().2, S::defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#default().()); |
| 123 | self.add_to_setrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Feature<'a>`]add_to_set().(features, &mut features_set, &mut deps_set); |
| 124 | (features_set, deps_set) |
| 125 | } |
| 126 | |
| 127 | #[inline(never)] |
| 128 | fn add_to_setrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Feature<'a>`]add_to_set().<S: BuildHasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/BuildHasher#>(&'a self, features: &'a HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'a str, Featurerust-analyzer cargo cargo_toml 0.22.3 features/Feature#<'a>, S>, features_set: &mut HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'a str, &'a Featurerust-analyzer cargo cargo_toml 0.22.3 features/Feature#<'a>, S>, deps_set: &mut DependenciesEnabledByFeaturesrust-analyzer cargo cargo_toml 0.22.3 features/DependenciesEnabledByFeatures#<'a, S>) { |
| 129 | if features_set.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(self.keyrust-analyzer cargo cargo_toml 0.22.3 features/Feature#key., self).is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() { |
| 130 | for (&dep_key, action) in &self.enables_depsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_deps. { |
| 131 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().action.is_conditionalrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#is_conditional. { |
| 132 | deps_set.entryrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]entry().(dep_key).or_defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`Entry<'a, K, V>`]or_default().().pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((self.keyrust-analyzer cargo cargo_toml 0.22.3 features/Feature#key., action)); |
| 133 | } |
| 134 | } |
| 135 | for &key in &self.enables_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_features. { |
| 136 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(feature) = features.getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(key) { |
| 137 | feature.add_to_setrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Feature<'a>`]add_to_set().(features, features_set, deps_set); |
| 138 | } |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)] |
| 145 | pub struct TargetKeyrust-analyzer cargo cargo_toml 0.22.3 features/TargetKey#<'a> { |
| 146 | pub kindrust-analyzer cargo cargo_toml 0.22.3 features/TargetKey#kind.: Kindrust-analyzer cargo cargo_toml 0.22.3 features/Kind#, |
| 147 | /// cfg. None for all targets. |
| 148 | pub targetrust-analyzer cargo cargo_toml 0.22.3 features/TargetKey#target.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&'a str>, |
| 149 | } |
| 150 | |
| 151 | /// A dependency referenced by a feature |
| 152 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 153 | #[non_exhaustive] |
| 154 | pub struct FeatureDependencyrust-analyzer cargo cargo_toml 0.22.3 features/FeatureDependency#<'dep> { |
| 155 | /// Actual crate of this dependency. Note that multiple dependencies can be the same crate, in different versions. |
| 156 | pub crate_namerust-analyzer cargo cargo_toml 0.22.3 features/FeatureDependency#crate_name.: &'dep str, |
| 157 | |
| 158 | /// By kind and target |
| 159 | pub targetsrust-analyzer cargo cargo_toml 0.22.3 features/FeatureDependency#targets.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<TargetKeyrust-analyzer cargo cargo_toml 0.22.3 features/TargetKey#<'dep>, &'dep Dependencyrust-analyzer cargo cargo_toml 0.22.3 Dependency#>, |
| 160 | } |
| 161 | |
| 162 | impl<'dep> FeatureDependencyrust-analyzer cargo cargo_toml 0.22.3 features/FeatureDependency#<'dep> { |
| 163 | #[inline] |
| 164 | #[must_use] |
| 165 | pub fn deprust-analyzer cargo cargo_toml 0.22.3 features/impl#[`FeatureDependency<'dep>`]dep().(&self) -> &'dep Dependencyrust-analyzer cargo cargo_toml 0.22.3 Dependency# { |
| 166 | self.detailrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`FeatureDependency<'dep>`]detail().().0 |
| 167 | } |
| 168 | |
| 169 | /// Extra metadata for the most common usage (normal > build > dev) of this dependency |
| 170 | #[inline] |
| 171 | #[must_use] |
| 172 | pub fn detailrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`FeatureDependency<'dep>`]detail().(&self) -> (&'dep Dependencyrust-analyzer cargo cargo_toml 0.22.3 Dependency#, Kindrust-analyzer cargo cargo_toml 0.22.3 features/Kind#) { |
| 173 | let (k, dep) = self.targetsrust-analyzer cargo cargo_toml 0.22.3 features/FeatureDependency#targets..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]iter().().nextrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Iter<'a, K, V>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 174 | (dep, k.kindrust-analyzer cargo cargo_toml 0.22.3 features/TargetKey#kind.) |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | impl Resolverrust-analyzer cargo cargo_toml 0.22.3 features/Resolver#<'static, RandomStaterust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/random/RandomState#> { |
| 179 | /// Next step: [`.parse(manifest)`](Resolver::parse). |
| 180 | #[inline] |
| 181 | #[must_use] |
| 182 | pub fn newrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'static>`]new().() -> Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'static>`] { |
| 183 | Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'static>`] { |
| 184 | always_keeprust-analyzer cargo cargo_toml 0.22.3 features/Resolver#always_keep.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 185 | _hasherrust-analyzer cargo cargo_toml 0.22.3 features/Resolver#_hasher.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 186 | } |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | impl<'manifest, 'config, RandomState: BuildHasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/BuildHasher# + Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#> Resolverrust-analyzer cargo cargo_toml 0.22.3 features/Resolver#<'config, RandomState> { |
| 191 | /// Use turbofish to configure `RandomState` of a hasher you want this to use. |
| 192 | /// |
| 193 | /// `should_keep_hidden_feature` is a reference to a closure that will receive feature names starting with `_`, and return whether to keep or hide them. |
| 194 | #[must_use] |
| 195 | pub fn new_with_hasher_and_filterrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'config, RandomState>`]new_with_hasher_and_filter().(should_keep_hidden_feature: &'config dyn Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&str) -> bool) -> Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'config, RandomState>`] { |
| 196 | Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'config, RandomState>`] { |
| 197 | always_keeprust-analyzer cargo cargo_toml 0.22.3 features/Resolver#always_keep.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(should_keep_hidden_feature), |
| 198 | _hasherrust-analyzer cargo cargo_toml 0.22.3 features/Resolver#_hasher.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | /// Parse features from a Cargo.toml manifest |
| 203 | pub fn parserust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'config, RandomState>`]parse().<M>(&self, manifest: &'manifest Manifestrust-analyzer cargo cargo_toml 0.22.3 Manifest#<M>) -> Featuresrust-analyzer cargo cargo_toml 0.22.3 features/Features#<'manifest, 'manifest, RandomState> { |
| 204 | let mut features = Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'config, RandomState>`]::parse_featuresrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]parse_features().( |
| 205 | manifest.featuresrust-analyzer cargo cargo_toml 0.22.3 Manifest#features..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]iter().().takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take().(MAX_ITEMSrust-analyzer cargo cargo_toml 0.22.3 features/MAX_ITEMS.), |
| 206 | manifest.featuresrust-analyzer cargo cargo_toml 0.22.3 Manifest#features..contains_keyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]contains_key().("default"), |
| 207 | ); |
| 208 | |
| 209 | let dependencies = Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'config, RandomState>`]::add_dependenciesrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]add_dependencies().( |
| 210 | &mut features, |
| 211 | &manifest.dependenciesrust-analyzer cargo cargo_toml 0.22.3 Manifest#dependencies., |
| 212 | &manifest.build_dependenciesrust-analyzer cargo cargo_toml 0.22.3 Manifest#build_dependencies., |
| 213 | &manifest.dev_dependenciesrust-analyzer cargo cargo_toml 0.22.3 Manifest#dev_dependencies., |
| 214 | &manifest.targetrust-analyzer cargo cargo_toml 0.22.3 Manifest#target., |
| 215 | ); |
| 216 | |
| 217 | Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'config, RandomState>`]::set_required_by_binsrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]set_required_by_bins().(&mut features, &manifest.binrust-analyzer cargo cargo_toml 0.22.3 Manifest#bin., manifest.packagerust-analyzer cargo cargo_toml 0.22.3 impl#[`Manifest<Metadata>`]package().().namerust-analyzer cargo cargo_toml 0.22.3 impl#[`Package<Metadata>`]name().()); |
| 218 | |
| 219 | Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'config, RandomState>`]::remove_redundant_dep_action_featuresrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]remove_redundant_dep_action_features().(&mut features, &dependencies); |
| 220 | Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'config, RandomState>`]::set_enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]set_enabled_by().(&mut features); |
| 221 | let hidden_features = self.remove_hidden_featuresrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]remove_hidden_features().(&mut features); |
| 222 | |
| 223 | Featuresrust-analyzer cargo cargo_toml 0.22.3 features/Features# { |
| 224 | featuresrust-analyzer cargo cargo_toml 0.22.3 features/Features#features., |
| 225 | dependenciesrust-analyzer cargo cargo_toml 0.22.3 features/Features#dependencies., |
| 226 | removed_hidden_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Features#removed_hidden_features.: !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().hidden_features.is_emptyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]is_empty().(), |
| 227 | hidden_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Features#hidden_features., |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | /// Instead of processing a `Cargo.toml` manifest, take bits of information directly instead |
| 232 | /// |
| 233 | /// It won't fill in `required_by_bins` fields. |
| 234 | pub fn parse_customrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'config, RandomState>`]parse_custom().<'deps, S: BuildHasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/BuildHasher#>(&self, manifest_features: &'manifest HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, S>, deps: impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#=ParseDependencyrust-analyzer cargo cargo_toml 0.22.3 features/ParseDependency#<'manifest, 'deps>>) -> Featuresrust-analyzer cargo cargo_toml 0.22.3 features/Features#<'manifest, 'deps, RandomState> where 'manifest: 'deps { |
| 235 | let mut features: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'manifest str, Featurerust-analyzer cargo cargo_toml 0.22.3 features/Feature#<'manifest>, _> = Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'config, RandomState>`]::parse_featuresrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]parse_features().( |
| 236 | manifest_features.iterrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]iter().().takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take().(MAX_ITEMSrust-analyzer cargo cargo_toml 0.22.3 features/MAX_ITEMS.), |
| 237 | manifest_features.contains_keyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]contains_key().("default"), |
| 238 | ); |
| 239 | |
| 240 | let named_using_dep_syntax = Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'config, RandomState>`]::named_using_dep_syntaxrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]named_using_dep_syntax().(&features); |
| 241 | |
| 242 | // First one wins, so order is important |
| 243 | let mut dependencies = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::<&'deps str, FeatureDependencyrust-analyzer cargo cargo_toml 0.22.3 features/FeatureDependency#<'deps>, RandomState>::defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S>`][Default]default().(); |
| 244 | for dep in deps { |
| 245 | Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'config, RandomState>`]::add_dependencyrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]add_dependency().(&mut features, &mut dependencies, named_using_dep_syntax.getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(dep.keyrust-analyzer cargo cargo_toml 0.22.3 features/ParseDependency#key.).copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<&T>`]copied().(), dep.kindrust-analyzer cargo cargo_toml 0.22.3 features/ParseDependency#kind., dep.targetrust-analyzer cargo cargo_toml 0.22.3 features/ParseDependency#target., dep.keyrust-analyzer cargo cargo_toml 0.22.3 features/ParseDependency#key., dep.deprust-analyzer cargo cargo_toml 0.22.3 features/ParseDependency#dep.); |
| 246 | } |
| 247 | |
| 248 | Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'config, RandomState>`]::remove_redundant_dep_action_featuresrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]remove_redundant_dep_action_features().(&mut features, &dependencies); |
| 249 | Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'config, RandomState>`]::set_enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]set_enabled_by().(&mut features); |
| 250 | let hidden_features = self.remove_hidden_featuresrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]remove_hidden_features().(&mut features); |
| 251 | |
| 252 | Featuresrust-analyzer cargo cargo_toml 0.22.3 features/Features# { |
| 253 | featuresrust-analyzer cargo cargo_toml 0.22.3 features/Features#features., |
| 254 | dependenciesrust-analyzer cargo cargo_toml 0.22.3 features/Features#dependencies., |
| 255 | removed_hidden_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Features#removed_hidden_features.: !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().hidden_features.is_emptyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]is_empty().(), |
| 256 | hidden_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Features#hidden_features., |
| 257 | } |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | /// For parsing in `parse_custom`. Can be constructed from the crates.io index, instead of `Cargo.toml`. |
| 262 | /// |
| 263 | /// Note about lifetimes: it's not possible to make `&Dependency` on the fly. |
| 264 | /// You will have to collect *owned* `Dependency` objects to a `Vec` or `HashMap` first. |
| 265 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 266 | pub struct ParseDependencyrust-analyzer cargo cargo_toml 0.22.3 features/ParseDependency#<'a, 'tmp> { |
| 267 | /// Name/id of the dependency, not always the crate name |
| 268 | pub keyrust-analyzer cargo cargo_toml 0.22.3 features/ParseDependency#key.: &'a str, |
| 269 | pub kindrust-analyzer cargo cargo_toml 0.22.3 features/ParseDependency#kind.: Kindrust-analyzer cargo cargo_toml 0.22.3 features/Kind#, |
| 270 | /// Name `[target."from here".dependencies]` |
| 271 | pub targetrust-analyzer cargo cargo_toml 0.22.3 features/ParseDependency#target.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&'a str>, |
| 272 | /// Possibly more detail |
| 273 | pub deprust-analyzer cargo cargo_toml 0.22.3 features/ParseDependency#dep.: &'tmp Dependencyrust-analyzer cargo cargo_toml 0.22.3 Dependency#, |
| 274 | } |
| 275 | |
| 276 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord:, PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 277 | pub enum Kindrust-analyzer cargo cargo_toml 0.22.3 features/Kind# { |
| 278 | #[defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/default:] |
| 279 | Normalrust-analyzer cargo cargo_toml 0.22.3 features/Kind#Normal#, |
| 280 | Buildrust-analyzer cargo cargo_toml 0.22.3 features/Kind#Build#, |
| 281 | Devrust-analyzer cargo cargo_toml 0.22.3 features/Kind#Dev#, |
| 282 | } |
| 283 | |
| 284 | impl<'a, 'c, S: BuildHasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/BuildHasher# + Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#> Resolverrust-analyzer cargo cargo_toml 0.22.3 features/Resolver#<'c, S> { |
| 285 | fn parse_featuresrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]parse_features().(features: impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = (&'a Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, &'a Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>)>, has_explicit_default: bool) -> HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'a str, Featurerust-analyzer cargo cargo_toml 0.22.3 features/Feature#<'a>, S> { |
| 286 | features |
| 287 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(key, f)| (key.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().(), f.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().())) |
| 288 | .chainrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#chain().(if has_explicit_default { Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# } else { Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(("default", &[][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)) }) // there must always be the default key |
| 289 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(feature_key, actions)| Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]::parse_featurerust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]parse_feature().(feature_key, actions)) |
| 290 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().() |
| 291 | } |
| 292 | |
| 293 | #[inline(never)] |
| 294 | fn parse_featurerust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]parse_feature().(feature_key: &'a str, actions: &'a [Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#]) -> (&'a str, Featurerust-analyzer cargo cargo_toml 0.22.3 features/Feature#<'a>) { |
| 295 | // coalesce dep_feature |
| 296 | let mut enables_deps = BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`]new().(); |
| 297 | let mut enables_features = BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T>`]new().(); |
| 298 | actions.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take().(MAX_ITEMSrust-analyzer cargo cargo_toml 0.22.3 features/MAX_ITEMS.).for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/take/impl#[`Take<I>`][Iterator]for_each().(|action| { |
| 299 | let mut parts = action.splitnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]splitn().(2, '/'); |
| 300 | let mut atarget = parts.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`SplitN<'a, P>`][Iterator]next().().unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().(); |
| 301 | let dep_feature = parts.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`SplitN<'a, P>`][Iterator]next().(); |
| 302 | |
| 303 | let is_dep_prefix = if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(k) = atarget.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("dep:") { atarget = k; true } else { false }; |
| 304 | let is_conditional = if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(k) = atarget.strip_suffixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_suffix().('?') { atarget = k; true } else { false }; |
| 305 | |
| 306 | // dep/feature is old, doesn't actually mean it's dep:only! |
| 307 | let is_dep_only = is_dep_prefix; |
| 308 | if is_dep_only || dep_feature.is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() { |
| 309 | let action = enables_deps.entryrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]entry().(atarget).or_insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/impl#[`Entry<'a, K, V, A>`]or_insert().(DepActionrust-analyzer cargo cargo_toml 0.22.3 features/DepAction# { |
| 310 | is_conditionalrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#is_conditional., |
| 311 | is_dep_onlyrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#is_dep_only., |
| 312 | dep_featuresrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#dep_features.: BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#::defaultrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T>`][Default]default().(), |
| 313 | }); |
| 314 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().is_conditional { action.is_conditionalrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#is_conditional. = false; } |
| 315 | if is_dep_only { action.is_dep_onlyrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#is_dep_only. = true; } |
| 316 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(df) = dep_feature { action.dep_featuresrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#dep_features..insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]insert().(Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(df)); } |
| 317 | } else { |
| 318 | // dep/foo can be both, and missing enables_deps is added later after checking all for dep: |
| 319 | enables_features.insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]insert().(atarget); |
| 320 | } |
| 321 | }); |
| 322 | |
| 323 | (feature_key, Featurerust-analyzer cargo cargo_toml 0.22.3 features/Feature# { |
| 324 | keyrust-analyzer cargo cargo_toml 0.22.3 features/Feature#key.: feature_key, |
| 325 | enables_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_features., |
| 326 | required_by_binsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#required_by_bins.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 327 | enables_depsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_deps., |
| 328 | explicitrust-analyzer cargo cargo_toml 0.22.3 features/Feature#explicit.: true, |
| 329 | enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by.: BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T>`]new().(), // fixed later |
| 330 | }) |
| 331 | } |
| 332 | |
| 333 | fn add_implied_optional_depsrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]add_implied_optional_deps().(features: &mut HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'a str, Featurerust-analyzer cargo cargo_toml 0.22.3 features/Feature#<'a>, S>, deps_for_features: &mut HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'a str, FeatureDependencyrust-analyzer cargo cargo_toml 0.22.3 features/FeatureDependency#<'a>, S>, crate_deps: &'a BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Dependencyrust-analyzer cargo cargo_toml 0.22.3 Dependency#>, named_using_dep_syntax: &HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&str, bool, S>, dep_kind: Kindrust-analyzer cargo cargo_toml 0.22.3 features/Kind#, only_for_target: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&'a str>) { |
| 334 | for (key, dep) in crate_deps.iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]iter().().takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take().(MAX_ITEMSrust-analyzer cargo cargo_toml 0.22.3 features/MAX_ITEMS.) { |
| 335 | let key = key.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().(); |
| 336 | Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]::add_dependencyrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]add_dependency().(features, deps_for_features, named_using_dep_syntax.getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(key).copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<&T>`]copied().(), dep_kind, only_for_target, key, dep); |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | #[inline(never)] |
| 341 | fn add_dependencyrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]add_dependency().<'d>(features: &mut HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'a str, Featurerust-analyzer cargo cargo_toml 0.22.3 features/Feature#<'a>, S>, deps_for_features: &mut HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'d str, FeatureDependencyrust-analyzer cargo cargo_toml 0.22.3 features/FeatureDependency#<'d>, S>, named_using_dep_syntax: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, dep_kind: Kindrust-analyzer cargo cargo_toml 0.22.3 features/Kind#, only_for_target: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&'d str>, key: &'a str, dep: &'d Dependencyrust-analyzer cargo cargo_toml 0.22.3 Dependency#) where 'a: 'd { |
| 342 | let is_optional = dep.optionalrust-analyzer cargo cargo_toml 0.22.3 impl#[Dependency]optional().(); |
| 343 | let entry = deps_for_features.entryrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]entry().(key); |
| 344 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().is_optional && named_using_dep_syntax.is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() && matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(entry, Entryrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/Entry#::Vacantrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/Entry#Vacant#(_)) { |
| 345 | return; |
| 346 | } |
| 347 | |
| 348 | let entry = entry.or_insert_withrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`Entry<'a, K, V, A>`]or_insert_with().(move || FeatureDependencyrust-analyzer cargo cargo_toml 0.22.3 features/FeatureDependency# { |
| 349 | crate_namerust-analyzer cargo cargo_toml 0.22.3 features/FeatureDependency#crate_name.: dep.packagerust-analyzer cargo cargo_toml 0.22.3 impl#[Dependency]package().().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(key), |
| 350 | targetsrust-analyzer cargo cargo_toml 0.22.3 features/FeatureDependency#targets.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`]new().(), |
| 351 | }); |
| 352 | |
| 353 | entry.targetsrust-analyzer cargo cargo_toml 0.22.3 features/FeatureDependency#targets..entryrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]entry().(TargetKeyrust-analyzer cargo cargo_toml 0.22.3 features/TargetKey# { kindrust-analyzer cargo cargo_toml 0.22.3 features/TargetKey#kind.: dep_kind, targetrust-analyzer cargo cargo_toml 0.22.3 features/TargetKey#target.: only_for_target }).or_insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/impl#[`Entry<'a, K, V, A>`]or_insert().(dep); |
| 354 | |
| 355 | // explicit features never overlap with deps, unless using "dep:" syntax. |
| 356 | |
| 357 | // We need to know about all deps referenced by features, or all optional ones. |
| 358 | // We won't see optional build or dev dep feature, if there's normal non-optional dep. Not a big deal? |
| 359 | // if we added one for normal, then keep adding build and dev. |
| 360 | if is_optional && named_using_dep_syntax rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true) { |
| 361 | features.entryrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]entry().(key).or_insert_withrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`Entry<'a, K, V, A>`]or_insert_with().(move || Featurerust-analyzer cargo cargo_toml 0.22.3 features/Feature# { |
| 362 | keyrust-analyzer cargo cargo_toml 0.22.3 features/Feature#key., |
| 363 | enables_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_features.: BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#::defaultrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T>`][Default]default().(), |
| 364 | enables_depsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_deps.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::from_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`][`FromIterator<(K, V)>`]from_iter().([(key, DepActionrust-analyzer cargo cargo_toml 0.22.3 features/DepAction# { |
| 365 | is_dep_onlyrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#is_dep_only.: false, |
| 366 | is_conditionalrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#is_conditional.: false, |
| 367 | dep_featuresrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#dep_features.: BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#::defaultrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T>`][Default]default().(), |
| 368 | })]), |
| 369 | explicitrust-analyzer cargo cargo_toml 0.22.3 features/Feature#explicit.: false, |
| 370 | enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by.: BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T>`]new().(), // will do later |
| 371 | required_by_binsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#required_by_bins.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 372 | }); |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | /// find which names are affected by use of the `dep:` syntax and supress implicit features |
| 377 | #[inline(never)] |
| 378 | fn named_using_dep_syntaxrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]named_using_dep_syntax().(features: &HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'a str, Featurerust-analyzer cargo cargo_toml 0.22.3 features/Feature#<'a>, S>) -> HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'a str, bool, S> { |
| 379 | // explicit features exist, even if their name clashes with a `dep:name`. |
| 380 | let mut named_using_dep_syntax: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<_, _, S> = features.keysrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]keys().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|&k| (k, false)).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 381 | |
| 382 | for f in features.valuesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]values().() { |
| 383 | f.enables_depsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_deps..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]iter().().for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(|(&dep_key, a)| { |
| 384 | named_using_dep_syntax.entryrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]entry().(dep_key) |
| 385 | .and_modifyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`Entry<'a, K, V, A>`]and_modify().(|v| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().v rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOrAssign<Self>`]bitor_assign().a.is_dep_onlyrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#is_dep_only.) |
| 386 | .or_insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`Entry<'a, K, V, A>`]or_insert().(a.is_dep_onlyrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#is_dep_only.); |
| 387 | }); |
| 388 | } |
| 389 | |
| 390 | named_using_dep_syntax |
| 391 | } |
| 392 | |
| 393 | fn add_dependenciesrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]add_dependencies().(features: &mut HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'a str, Featurerust-analyzer cargo cargo_toml 0.22.3 features/Feature#<'a>, S>, dependencies: &'a DepsSetrust-analyzer cargo cargo_toml 0.22.3 DepsSet#, build_dependencies: &'a DepsSetrust-analyzer cargo cargo_toml 0.22.3 DepsSet#, dev_dependencies: &'a DepsSetrust-analyzer cargo cargo_toml 0.22.3 DepsSet#, target: &'a TargetDepsSetrust-analyzer cargo cargo_toml 0.22.3 TargetDepsSet#) -> HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'a str, FeatureDependencyrust-analyzer cargo cargo_toml 0.22.3 features/FeatureDependency#<'a>, S> { |
| 394 | let named_using_dep_syntax = Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]::named_using_dep_syntaxrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]named_using_dep_syntax().(features); |
| 395 | |
| 396 | // First one wins, so order is important |
| 397 | let mut all_deps = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::<_, _, S>::defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S>`][Default]default().(); |
| 398 | Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]::add_implied_optional_depsrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]add_implied_optional_deps().(features, &mut all_deps, dependencies, &named_using_dep_syntax, Kindrust-analyzer cargo cargo_toml 0.22.3 features/Kind#::Normalrust-analyzer cargo cargo_toml 0.22.3 features/Kind#Normal#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 399 | Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]::add_implied_optional_depsrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]add_implied_optional_deps().(features, &mut all_deps, build_dependencies, &named_using_dep_syntax, Kindrust-analyzer cargo cargo_toml 0.22.3 features/Kind#::Buildrust-analyzer cargo cargo_toml 0.22.3 features/Kind#Build#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 400 | for (target_cfg, target_deps) in target { |
| 401 | Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]::add_implied_optional_depsrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]add_implied_optional_deps().(features, &mut all_deps, &target_deps.dependenciesrust-analyzer cargo cargo_toml 0.22.3 Target#dependencies., &named_using_dep_syntax, Kindrust-analyzer cargo cargo_toml 0.22.3 features/Kind#::Normalrust-analyzer cargo cargo_toml 0.22.3 features/Kind#Normal#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(target_cfg)); |
| 402 | Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]::add_implied_optional_depsrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]add_implied_optional_deps().(features, &mut all_deps, &target_deps.build_dependenciesrust-analyzer cargo cargo_toml 0.22.3 Target#build_dependencies., &named_using_dep_syntax, Kindrust-analyzer cargo cargo_toml 0.22.3 features/Kind#::Buildrust-analyzer cargo cargo_toml 0.22.3 features/Kind#Build#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(target_cfg)); |
| 403 | } |
| 404 | Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]::add_implied_optional_depsrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]add_implied_optional_deps().(features, &mut all_deps, dev_dependencies, &named_using_dep_syntax, Kindrust-analyzer cargo cargo_toml 0.22.3 features/Kind#::Devrust-analyzer cargo cargo_toml 0.22.3 features/Kind#Dev#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 405 | for (target_cfg, target_deps) in target { |
| 406 | Selfrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]::add_implied_optional_depsrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]add_implied_optional_deps().(features, &mut all_deps, &target_deps.dev_dependenciesrust-analyzer cargo cargo_toml 0.22.3 Target#dev_dependencies., &named_using_dep_syntax, Kindrust-analyzer cargo cargo_toml 0.22.3 features/Kind#::Devrust-analyzer cargo cargo_toml 0.22.3 features/Kind#Dev#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(target_cfg)); |
| 407 | } |
| 408 | all_deps |
| 409 | } |
| 410 | |
| 411 | #[inline(never)] |
| 412 | fn set_required_by_binsrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]set_required_by_bins().(features: &mut HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'a str, Featurerust-analyzer cargo cargo_toml 0.22.3 features/Feature#<'a>, S>, bin: &'a [Productrust-analyzer cargo cargo_toml 0.22.3 Product#], package_name: &'a str) { |
| 413 | for bin in bin { |
| 414 | for f in &bin.required_featuresrust-analyzer cargo cargo_toml 0.22.3 Product#required_features. { |
| 415 | let bin_name = bin.namerust-analyzer cargo cargo_toml 0.22.3 Product#name..as_derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_deref().().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(package_name); |
| 416 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(f) = features.get_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get_mut().(f.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()) { |
| 417 | // fallback to package name is not quite accurate, because Cargo normalizes exe names slightly |
| 418 | f.required_by_binsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#required_by_bins..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(bin_name); |
| 419 | } |
| 420 | } |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | #[inline(never)] |
| 425 | fn remove_redundant_dep_action_featuresrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]remove_redundant_dep_action_features().(features: &mut HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&str, Featurerust-analyzer cargo cargo_toml 0.22.3 features/Feature#<'_>, S>, dependencies: &HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&str, FeatureDependencyrust-analyzer cargo cargo_toml 0.22.3 features/FeatureDependency#<'_>, S>) { |
| 426 | features.values_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]values_mut().() |
| 427 | .flat_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#flat_map().(|f| &mut f.enables_depsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_deps.) |
| 428 | .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|(_, action)| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().action.dep_featuresrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#dep_features..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]is_empty().()) |
| 429 | .for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(|(dep_key, action)| { |
| 430 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(dep) = dependencies.getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(dep_key).and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|d| d.deprust-analyzer cargo cargo_toml 0.22.3 features/impl#[`FeatureDependency<'dep>`]dep().().detailrust-analyzer cargo cargo_toml 0.22.3 impl#[Dependency]detail().()) { |
| 431 | action.dep_featuresrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#dep_features..retainrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]retain().(move |dep_f| { |
| 432 | let dep_f = &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`][Deref]deref().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().dep_f; |
| 433 | (!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().dep.default_featuresrust-analyzer cargo cargo_toml 0.22.3 DependencyDetail#default_features. || dep_f rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne()."default") && |
| 434 | !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().dep.featuresrust-analyzer cargo cargo_toml 0.22.3 DependencyDetail#features..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]any().(|k| k rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().dep_f) |
| 435 | }); |
| 436 | } |
| 437 | }); |
| 438 | } |
| 439 | |
| 440 | #[inline(never)] |
| 441 | fn set_enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]set_enabled_by().(features: &mut HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'a str, Featurerust-analyzer cargo cargo_toml 0.22.3 features/Feature#<'a>, S>) { |
| 442 | let mut all_enabled_by = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::<_, _, S>::defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S>`][Default]default().(); |
| 443 | for (&feature_key, f) in features.iterrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]iter().() { |
| 444 | f.enables_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_features..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]iter().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(|action_key| if action_key rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().feature_key { |
| 445 | all_enabled_by.entryrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]entry().(action_key).or_insert_withrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`Entry<'a, K, V, A>`]or_insert_with().(BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T>`]new().).insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]insert().(feature_key); |
| 446 | }); |
| 447 | f.enables_depsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_deps..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]iter().().for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(|(&action_key, action)| if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().action.is_conditionalrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#is_conditional. && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().action.is_dep_onlyrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#is_dep_only. && action_key rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().feature_key { |
| 448 | all_enabled_by.entryrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]entry().(action_key).or_insert_withrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`Entry<'a, K, V, A>`]or_insert_with().(BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T>`]new().).insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]insert().(feature_key); |
| 449 | }); |
| 450 | } |
| 451 | |
| 452 | for (key, enabled_by) in all_enabled_by { |
| 453 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(f) = features.get_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get_mut().(key) { |
| 454 | f.enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by. = enabled_by; |
| 455 | } |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | /// find `__features` and inline them |
| 460 | #[inline(never)] |
| 461 | fn remove_hidden_featuresrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'c, S>`]remove_hidden_features().(&self, features: &mut HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'a str, Featurerust-analyzer cargo cargo_toml 0.22.3 features/Feature#<'a>, S>) -> HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'a str, BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#<&'a str>, S> { |
| 462 | let features_to_remove: BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#<_> = features.keysrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]keys().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|&k| { |
| 463 | k.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('_') && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.always_keeprust-analyzer cargo cargo_toml 0.22.3 features/Resolver#always_keep..is_some_andrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some_and().(|cb| (cb)(k)) // if user thinks that is useful info |
| 464 | }).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 465 | |
| 466 | let mut removed_mapping = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::<_, _, S>::defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S>`][Default]default().(); |
| 467 | |
| 468 | if features_to_remove.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]is_empty().() { |
| 469 | return removed_mapping; |
| 470 | } |
| 471 | |
| 472 | features_to_remove.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`][IntoIterator]into_iter().().for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(|key| { |
| 473 | let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(mut janky) = features.removerust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]remove().(key) else { return }; |
| 474 | |
| 475 | janky.enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]iter().().for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(|&parent_key| if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(parent) = features.get_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get_mut().(parent_key) { |
| 476 | parent.enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by..removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]remove().(janky.keyrust-analyzer cargo cargo_toml 0.22.3 features/Feature#key.); // just in case it's circular |
| 477 | |
| 478 | // the filter tries to avoid adding new redundant enables_features, but it's order-dependent |
| 479 | parent.enables_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_features..extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`][`Extend<&'a T>`]extend().(&janky.enables_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_features.); |
| 480 | parent.enables_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_features..removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]remove().(janky.keyrust-analyzer cargo cargo_toml 0.22.3 features/Feature#key.); |
| 481 | |
| 482 | janky.enables_depsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_deps..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]iter().().for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(|(&k, ja)| { |
| 483 | parent.enables_depsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_deps..entryrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]entry().(k) |
| 484 | .and_modifyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/impl#[`Entry<'a, K, V, A>`]and_modify().(|old| { |
| 485 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().ja.is_conditionalrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#is_conditional. { old.is_conditionalrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#is_conditional. = false; } |
| 486 | if ja.is_dep_onlyrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#is_dep_only. { old.is_dep_onlyrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#is_dep_only. = true; } |
| 487 | old.dep_featuresrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#dep_features..extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`][`Extend<T>`]extend().(ja.dep_featuresrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#dep_features..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().()); |
| 488 | }) |
| 489 | .or_insert_withrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/impl#[`Entry<'a, K, V, A>`]or_insert_with().(|| ja.clonerust-analyzer cargo cargo_toml 0.22.3 features/impl#[`DepAction<'a>`][Clone]clone().()); |
| 490 | }); |
| 491 | }); |
| 492 | |
| 493 | janky.enables_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_features..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]iter().().for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(|&f| { |
| 494 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(child) = features.get_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get_mut().(f) { |
| 495 | // this list is sometimes a bit redundant, |
| 496 | // but the hidden feature cleanup is not recursive, so it needs to contain all possible places |
| 497 | child.enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by..extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`][`Extend<&'a T>`]extend().(&janky.enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by.); |
| 498 | child.enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by..removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]remove().(janky.keyrust-analyzer cargo cargo_toml 0.22.3 features/Feature#key.); |
| 499 | |
| 500 | janky.required_by_binsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#required_by_bins..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take().(10).for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/take/impl#[`Take<I>`][Iterator]for_each().(|&bin| { |
| 501 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().child.required_by_binsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#required_by_bins..containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&bin) { |
| 502 | child.required_by_binsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#required_by_bins..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(bin); |
| 503 | } |
| 504 | }); |
| 505 | } |
| 506 | }); |
| 507 | |
| 508 | janky.enables_depsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_deps..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]iter().().filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|&(k, a)| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().a.is_dep_onlyrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#is_dep_only. && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().janky.enables_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_features..containsrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]contains().(k)).for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(|(&d, _)| { |
| 509 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(d) = features.get_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get_mut().(d) { |
| 510 | d.enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by..extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`][`Extend<&'a T>`]extend().(&janky.enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by.); |
| 511 | d.enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by..removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]remove().(janky.keyrust-analyzer cargo cargo_toml 0.22.3 features/Feature#key.); |
| 512 | } |
| 513 | }); |
| 514 | |
| 515 | removed_mapping.entryrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]entry().(janky.keyrust-analyzer cargo cargo_toml 0.22.3 features/Feature#key.).or_defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`Entry<'a, K, V>`]or_default().().appendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]append().(&mut janky.enables_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_features.); |
| 516 | }); |
| 517 | removed_mapping |
| 518 | } |
| 519 | } |
| 520 | |
| 521 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 522 | fn features_testrust-analyzer cargo cargo_toml 0.22.3 features/features_test().() { |
| 523 | let m = craterust-analyzer cargo cargo_toml 0.22.3 crate/::Manifestrust-analyzer cargo cargo_toml 0.22.3 Manifest#::from_strrust-analyzer cargo cargo_toml 0.22.3 impl#[Manifest]from_str().(r#" |
| 524 | [package] |
| 525 | name = "foo" |
| 526 | |
| 527 | [[bin]] |
| 528 | name = "thebin" |
| 529 | required-features = ["__hidden2", "loop3"] |
| 530 | |
| 531 | [dependencies] |
| 532 | not_optional = { path = "..", package = "actual_pkg", features = ["f1", "f2"] } |
| 533 | depend = { version = "1.0.0", package = "actual_pkg", optional = true, default-features = false } |
| 534 | implied_standalone = { version = "1.0.0", optional = true } |
| 535 | implied_referenced = { version = "1.0.0", optional = true } |
| 536 | not_relevant = "2" |
| 537 | feature_for_hidden = { version = "2", optional = true } |
| 538 | __hidden_dep = { version = "2", optional = true } |
| 539 | |
| 540 | [build-dependencies] |
| 541 | a_dep = { version = "1.0.0", optional = true } |
| 542 | |
| 543 | [features] |
| 544 | default = ["x"] |
| 545 | a = [] |
| 546 | b = ["a", "implied_referenced/with_feature", "depend/default", "depend/default"] |
| 547 | c = ["__hidden"] |
| 548 | x = ["__hidden", "c", "not_optional/f2", "not_optional/f3", "not_optional/default"] |
| 549 | __hidden = ["__hidden2"] |
| 550 | __hidden2 = ["dep:depend", "depend/with_x", "depend?/with_y", "__hidden0"] |
| 551 | __hidden0 = ["a"] |
| 552 | enables_hidden = ["__hidden0"] |
| 553 | __feature_for_hidden = ["feature_for_hidden"] |
| 554 | |
| 555 | loop1 = ["loop2"] |
| 556 | loop2 = ["loop3", "a_dep?/maybe", "a_dep?/maybe_too", "depend/with_loop"] |
| 557 | loop3 = ["loop1", "implied_referenced/from_loop_3"] |
| 558 | |
| 559 | "#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 560 | let r = Resolverrust-analyzer cargo cargo_toml 0.22.3 features/Resolver#::newrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'static>`]new().().parserust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Resolver<'config, RandomState>`]parse().(&m); |
| 561 | let f = r.featuresrust-analyzer cargo cargo_toml 0.22.3 features/Features#features.; |
| 562 | let d = r.dependenciesrust-analyzer cargo cargo_toml 0.22.3 features/Features#dependencies.; |
| 563 | |
| 564 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(r.removed_hidden_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Features#removed_hidden_features.); |
| 565 | |
| 566 | // __hidden completely removed |
| 567 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().f.iterrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]iter().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(|(&k, f)| { |
| 568 | k.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('_') || |
| 569 | f.enables_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_features..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]iter().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(|&k| k.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('_')) || |
| 570 | f.enables_depsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_deps..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]iter().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(|(&k, _)| k.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('_')) || |
| 571 | f.enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]iter().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(|&k| k.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('_')) |
| 572 | })); |
| 573 | |
| 574 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().d.keysrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]keys().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(|&k| k.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('_') && k != "__hidden_dep")); |
| 575 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().f.contains_keyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]contains_key().("__hidden_dep")); |
| 576 | |
| 577 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f.lenrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]len().(), 13); |
| 578 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().f.contains_keyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]contains_key().("depend")); |
| 579 | |
| 580 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(d.lenrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]len().(), 7); |
| 581 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().d.contains_keyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]contains_key().("not_relevant")); |
| 582 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().f.contains_keyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]contains_key().("not_relevant")); |
| 583 | |
| 584 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().f.contains_keyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]contains_key().("not_optional")); |
| 585 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(d[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."not_optional"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..crate_namerust-analyzer cargo cargo_toml 0.22.3 features/FeatureDependency#crate_name., "actual_pkg"); |
| 586 | |
| 587 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(d[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."implied_standalone"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..crate_namerust-analyzer cargo cargo_toml 0.22.3 features/FeatureDependency#crate_name., "implied_standalone"); |
| 588 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(d[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."implied_standalone"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..detailrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`FeatureDependency<'dep>`]detail().().0.optionalrust-analyzer cargo cargo_toml 0.22.3 impl#[Dependency]optional().()); |
| 589 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(d[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."a_dep"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..targetsrust-analyzer cargo cargo_toml 0.22.3 features/FeatureDependency#targets..keysrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]keys().().allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#all().(|t| t.kindrust-analyzer cargo cargo_toml 0.22.3 features/TargetKey#kind. == Kindrust-analyzer cargo cargo_toml 0.22.3 features/Kind#::Buildrust-analyzer cargo cargo_toml 0.22.3 features/Kind#Build#)); |
| 590 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."implied_standalone"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..explicitrust-analyzer cargo cargo_toml 0.22.3 features/Feature#explicit.); |
| 591 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."implied_referenced"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..explicitrust-analyzer cargo cargo_toml 0.22.3 features/Feature#explicit.); |
| 592 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."a_dep"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..explicitrust-analyzer cargo cargo_toml 0.22.3 features/Feature#explicit.); |
| 593 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."feature_for_hidden"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..is_referencedrust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Feature<'a>`]is_referenced().()); |
| 594 | |
| 595 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."x"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..enables_depsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_deps..keysrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]keys().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), &["depend", "not_optional"]); |
| 596 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."x"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..enables_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_features..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]iter().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), &["a", "c"]); |
| 597 | |
| 598 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."a"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]iter().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), &["b", "c", "enables_hidden", "x"]); |
| 599 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."a"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..enables_depsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_deps..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]is_empty().()); |
| 600 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."a"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..enables_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_features..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]is_empty().()); |
| 601 | |
| 602 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."loop1"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]iter().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), &["loop3"]); |
| 603 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."loop2"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]iter().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), &["loop1"]); |
| 604 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."loop3"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..enabled_byrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enabled_by..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]iter().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), &["loop2"]); |
| 605 | |
| 606 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."loop1"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..enables_depsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_deps..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]is_empty().()); |
| 607 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."loop2"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..enables_depsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_deps..keysrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]keys().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), &["a_dep", "depend"]); |
| 608 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."loop2"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..enables_depsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_deps.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`][`Index<&Q>`]index()."a_dep"]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`][`Index<&Q>`]index()..is_conditionalrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#is_conditional.); |
| 609 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."loop2"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..enables_depsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_deps.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`][`Index<&Q>`]index()."depend"]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`][`Index<&Q>`]index()..is_conditionalrust-analyzer cargo cargo_toml 0.22.3 features/DepAction#is_conditional.); |
| 610 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."loop3"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..enables_depsrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_deps..keysrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]keys().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), &["implied_referenced"]); |
| 611 | |
| 612 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."loop1"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..enables_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_features..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]iter().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), &["loop2"]); |
| 613 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."loop2"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..enables_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_features..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]iter().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), &["loop3"]); |
| 614 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."loop3"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..enables_featuresrust-analyzer cargo cargo_toml 0.22.3 features/Feature#enables_features..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]iter().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), &["loop1"]); |
| 615 | |
| 616 | let (rf, rd) = f[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."loop1"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..enables_recursiverust-analyzer cargo cargo_toml 0.22.3 features/impl#[`Feature<'a>`]enables_recursive().(&f); |
| 617 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(rf[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."loop1"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..keyrust-analyzer cargo cargo_toml 0.22.3 features/Feature#key., "loop1"); |
| 618 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(rf[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."loop2"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..keyrust-analyzer cargo cargo_toml 0.22.3 features/Feature#key., "loop2"); |
| 619 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(rf[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."loop3"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()..keyrust-analyzer cargo cargo_toml 0.22.3 features/Feature#key., "loop3"); |
| 620 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(rd[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."implied_referenced"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index().[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..0, "loop3"); |
| 621 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(rd[rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index()."depend"]rust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Index<&Q>`]index().[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..0, "loop2"); |
| 622 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().rd.contains_keyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]contains_key().("a_dep")); |
| 623 | } |