Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(bindeps): target field specified and
optional = true
coexist
> Adapted from rust-lang#11183 Previously, `is_dep_activated` depends on `activated_dependencies`, which is a map of `PackageFeaturesKey` to its own activated `DepFeature`s. `PackageFeaturesKey` in feature resolver is always comprised of * A `PackageId` of a given dependency, and * A enum value that helps decoupling activated features for that dependency. Currently depending on the type of given dependency. Looking into issue 10526, it has an `activated_dependencies` of ``` { (mycrate, NormalOrDev) -> [dep:mybindep] } ``` However, this [line][1] accidentally use a parent's `pkgid` and a dependency's `FeaturesFor` to compose a key: ``` (mycrate, ArtifactDep("x86_64-unknown-linux-gnu")) ``` That is never a valid key to query features for artifacts dependency. A valid key should be comprised of components both from the parent: ``` (mycrate, NormalOrDev) ``` Or both from the dependency itself: ``` (mybindep, ArtifactDep("x86_64-unknown-linux-gnu")) ``` This `unit_for` is from parent and should already contain its own artifact dep information inside `artifact_target_for_features`, so we don't need to map any dependency artifact from `dep.artifact()`. [1]: https://github.com/rust-lang/cargo/blob/a2ea66bea6fe8156444144e98911d073d56c2c0c/src/cargo/core/compiler/unit_dependencies.rs#L1106-L1107
- Loading branch information