Commit 64c5f5f
committed
fix(bindeps): target field specified and
> 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` should already contain its own artifact dep
information inside `artifact_target_for_features`,
so we don't need to map any `dep.artifact()` here.
[1]: https://github.com/rust-lang/cargo/blob/a2ea66bea6fe8156444144e98911d073d56c2c0c/src/cargo/core/compiler/unit_dependencies.rs#L1106-L1107optional = true coexist1 parent 6200218 commit 64c5f5f
File tree
2 files changed
+7
-5
lines changed- src/cargo/core/compiler
- tests/testsuite
2 files changed
+7
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1103 | 1103 | | |
1104 | 1104 | | |
1105 | 1105 | | |
1106 | | - | |
| 1106 | + | |
1107 | 1107 | | |
1108 | 1108 | | |
1109 | 1109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2345 | 2345 | | |
2346 | 2346 | | |
2347 | 2347 | | |
2348 | | - | |
2349 | 2348 | | |
2350 | 2349 | | |
2351 | 2350 | | |
| |||
2386 | 2385 | | |
2387 | 2386 | | |
2388 | 2387 | | |
2389 | | - | |
| 2388 | + | |
2390 | 2389 | | |
2391 | | - | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
| 2394 | + | |
2392 | 2395 | | |
2393 | 2396 | | |
2394 | | - | |
2395 | 2397 | | |
2396 | 2398 | | |
0 commit comments