Skip to content

Commit

Permalink
Look at FeaturesFor:: to decide if a dependency participates in featu…
Browse files Browse the repository at this point in the history
…re resolution

Fixes #10431.
  • Loading branch information
Byron committed Feb 28, 2022
1 parent ac6427f commit 1190f5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/cargo/core/resolver/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 0 additions & 1 deletion tests/testsuite/artifact_dep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1190f5f

Please sign in to comment.