Skip to content

Commit eca3e23

Browse files
committed
Explain why we don't need to pass dep.artifact()
1 parent 5b8985a commit eca3e23

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cargo/core/compiler/unit_dependencies.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,10 @@ impl<'a, 'cfg> State<'a, 'cfg> {
11031103
// If this is an optional dependency, and the new feature resolver
11041104
// did not enable it, don't include it.
11051105
if dep.is_optional() {
1106-
let features_for = unit_for.map_to_features_for(None);
1106+
// This `unit_for` is from parent dep and *SHOULD* contains its own
1107+
// artifact dep infomration inside `artifact_target_for_features`.
1108+
// So, no need to map any artifact info from an incorrect `dep.artifact()`.
1109+
let features_for = unit_for.map_to_features_for(IS_NO_ARTIFACT_DEP);
11071110
if !self.is_dep_activated(pkg_id, features_for, dep.name_in_toml()) {
11081111
return false;
11091112
}

0 commit comments

Comments
 (0)