Skip to content

Commit

Permalink
Explain why we don't need to pass dep.artifact()
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Dec 13, 2022
1 parent 5b8985a commit eca3e23
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/cargo/core/compiler/unit_dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,10 @@ impl<'a, 'cfg> State<'a, 'cfg> {
// If this is an optional dependency, and the new feature resolver
// did not enable it, don't include it.
if dep.is_optional() {
let features_for = unit_for.map_to_features_for(None);
// This `unit_for` is from parent dep and *SHOULD* contains its own
// artifact dep infomration inside `artifact_target_for_features`.
// So, no need to map any artifact info from an incorrect `dep.artifact()`.
let features_for = unit_for.map_to_features_for(IS_NO_ARTIFACT_DEP);
if !self.is_dep_activated(pkg_id, features_for, dep.name_in_toml()) {
return false;
}
Expand Down

0 comments on commit eca3e23

Please sign in to comment.