Skip to content

Commit be17b00

Browse files
committed
Auto merge of #7131 - ehuss:remove-unused-opt-feature, r=alexcrichton
Remove unused feature filter. NOTE: Do not merge this lightly. This upended my understanding of how the resolver handles features, and I'm still not sure about it. Remove an unused check that an optional dependency is activated. This was originally added 4 years ago in #1812, during a time when this code iterated over the actual dependencies from `Package.dependencies()`. In #5415 this was refactored so that it gets the `deps` list directly from the Resolver, which AFAIK has already filtered out the features. IIUC, this filtering is done [here](https://github.com/rust-lang/cargo/blame/705009eb3828123cc9dbcf5b28988cc63f60b03b/src/cargo/core/resolver/dep_cache.rs#L270-L272).
2 parents 1760f1f + f1bf382 commit be17b00

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

src/cargo/core/compiler/context/unit_dependencies.rs

-6
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,6 @@ fn compute_deps<'a, 'cfg, 'tmp>(
162162
return false;
163163
}
164164

165-
// If the dependency is optional, then we're only activating it
166-
// if the corresponding feature was activated
167-
if dep.is_optional() && !bcx.resolve.features(id).contains(&*dep.name_in_toml()) {
168-
return false;
169-
}
170-
171165
// If we've gotten past all that, then this dependency is
172166
// actually used!
173167
true

0 commit comments

Comments
 (0)