Skip to content

Commit 0b53b1b

Browse files
committed
Undo a prior change to fix #10452
1 parent 92cce52 commit 0b53b1b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/cargo/core/resolver/features.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -858,12 +858,14 @@ impl<'a, 'cfg> FeatureResolver<'a, 'cfg> {
858858
// targets.
859859
// The library's feature key needs to be used alongside
860860
// the keys artifact targets.
861-
// For good measure, we always add the lib_fk as build scripts
862-
// may trigger it to be queried.
863-
Some((_, Some(mut dep_fks))) => {
861+
Some((is_lib, Some(mut dep_fks))) if is_lib => {
864862
dep_fks.push(lib_fk);
865863
dep_fks
866864
}
865+
// The artifact is not a library, but does specify
866+
// custom targets.
867+
// Use only these targets feature keys.
868+
Some((_, Some(dep_fks))) => dep_fks,
867869
// There is no artifact in the current dependency
868870
// or there is no target specified on the artifact.
869871
// Use the standard feature key without any alteration.

tests/testsuite/artifact_dep.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2155,7 +2155,6 @@ fn build_script_output_string(p: &Project, package_name: &str) -> String {
21552155
}
21562156

21572157
#[cargo_test]
2158-
#[ignore]
21592158
fn build_script_features_for_shared_dependency() {
21602159
// When a build script is built and run, its features should match. Here:
21612160
//
@@ -2252,7 +2251,7 @@ fn build_script_features_for_shared_dependency() {
22522251
assert!(var_os("CARGO_FEATURE_F2").is_some());
22532252
} else {
22542253
assert!(var_os("CARGO_FEATURE_F1").is_some());
2255-
assert!(var_os("CARGO_FEATURE_F2").is_none());
2254+
assert!(var_os("CARGO_FEATURE_F2").is_none());
22562255
}
22572256
}
22582257
"#

0 commit comments

Comments
 (0)