Look at FeaturesFor:: to decide if a dependency participates in feature resolution

Fixes #10431.
This commit is contained in:
Sebastian Thiel 2022-02-28 11:28:01 +08:00
parent ac6427f755
commit 1190f5fea2
No known key found for this signature in database
GPG Key ID: 9CB5EE7895E8268B
2 changed files with 6 additions and 1 deletions

View File

@ -769,6 +769,12 @@ impl<'a, 'cfg> FeatureResolver<'a, 'cfg> {
.target_data
.dep_platform_activated(dep, CompileKind::Host);
}
// We always count platforms as activated if the target stems from an artifact
// dependency's target specification. This triggers in conjunction with
// `[target.'cfg(…)'.dependencies]` manifest sections.
if matches!(fk, FeaturesFor::NormalOrDevOrArtifactTarget(Some(_))) {
return true;
}
// Not a build dependency, and not for a build script, so must be Target.
self.requested_targets
.iter()

View File

@ -426,7 +426,6 @@ fn features_are_not_unified_among_lib_and_bin_dep_of_different_target() {
}
#[cargo_test]
#[ignore]
fn feature_resolution_works_for_cfg_target_specification() {
if cross_compile::disabled() {
return;