Commit 7d8d028
committed
Auto merge of #11331 - weihanglo:revert-11183, r=ehuss
Revert #11183
This reverts commit d4c38af, reversing changes made to 92d8826.
Fixes #11330
---
The root cause is that [`map_to_features_for`] takes care of `unit_for.host_features` from parent unit, but [here] we only want to know whether the dependency is for host or not.
We could have an ad-hoc `FeaturesFor` construction there, but I'd rather revert it at this moment. The interaction between `UnitFor` and `FeaturesFor` bites me every time 😭.
After this revert, if we want to resolve #10526 again. The fastest way is doing the following:
```diff
diff --git a/src/cargo/core/compiler/unit_dependencies.rs b/src/cargo/core/compiler/unit_dependencies.rs
index 9319a19..14cc84941 100644
--- a/src/cargo/core/compiler/unit_dependencies.rs
+++ b/src/cargo/core/compiler/unit_dependencies.rs
`@@` -1103,7 +1103,7 `@@` 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(dep.artifact());
+ let features_for = FeaturesFor::from_for_host(unit_for.is_for_host());
if !self.is_dep_activated(pkg_id, features_for, dep.name_in_toml()) {
return false;
}
```
[`map_to_features_for`]: https://github.com/rust-lang/cargo/blob/810cbad9a123ad4ee0a55a96171b8f8478ff1c03/src/cargo/core/profiles.rs#L1043
[here]: https://github.com/rust-lang/cargo/blob/810cbad9a123ad4ee0a55a96171b8f8478ff1c03/src/cargo/core/compiler/unit_dependencies.rs#L1102File tree
4 files changed
+43
-94
lines changed- src/cargo
- core
- compiler
- resolver
- ops/tree
- tests/testsuite
4 files changed
+43
-94
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1040 | 1040 | | |
1041 | 1041 | | |
1042 | 1042 | | |
1043 | | - | |
1044 | 1043 | | |
1045 | 1044 | | |
1046 | 1045 | | |
| |||
1050 | 1049 | | |
1051 | 1050 | | |
1052 | 1051 | | |
1053 | | - | |
1054 | | - | |
1055 | | - | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
1056 | 1060 | | |
1057 | 1061 | | |
1058 | 1062 | | |
| |||
1067 | 1071 | | |
1068 | 1072 | | |
1069 | 1073 | | |
1070 | | - | |
| 1074 | + | |
1071 | 1075 | | |
1072 | 1076 | | |
1073 | 1077 | | |
| |||
1099 | 1103 | | |
1100 | 1104 | | |
1101 | 1105 | | |
1102 | | - | |
1103 | | - | |
| 1106 | + | |
| 1107 | + | |
1104 | 1108 | | |
1105 | 1109 | | |
1106 | 1110 | | |
| |||
1113 | 1117 | | |
1114 | 1118 | | |
1115 | 1119 | | |
1116 | | - | |
| 1120 | + | |
1117 | 1121 | | |
1118 | 1122 | | |
1119 | 1123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | 59 | | |
64 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
65 | 64 | | |
66 | 65 | | |
67 | 66 | | |
| |||
322 | 321 | | |
323 | 322 | | |
324 | 323 | | |
325 | | - | |
| 324 | + | |
326 | 325 | | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
333 | 339 | | |
334 | 340 | | |
335 | 341 | | |
| |||
409 | 415 | | |
410 | 416 | | |
411 | 417 | | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | 418 | | |
416 | 419 | | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | 420 | | |
421 | 421 | | |
422 | 422 | | |
| |||
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
| 478 | + | |
478 | 479 | | |
479 | 480 | | |
480 | 481 | | |
| |||
506 | 507 | | |
507 | 508 | | |
508 | 509 | | |
509 | | - | |
| 510 | + | |
510 | 511 | | |
511 | | - | |
512 | | - | |
| 512 | + | |
| 513 | + | |
513 | 514 | | |
514 | 515 | | |
515 | 516 | | |
516 | 517 | | |
517 | 518 | | |
518 | 519 | | |
519 | 520 | | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
527 | 524 | | |
528 | 525 | | |
529 | 526 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | | - | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
369 | 373 | | |
370 | 374 | | |
371 | 375 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
2276 | 2276 | | |
2277 | 2277 | | |
2278 | 2278 | | |
2279 | | - | |
2280 | | - | |
2281 | | - | |
2282 | | - | |
2283 | | - | |
2284 | | - | |
2285 | | - | |
2286 | | - | |
2287 | | - | |
2288 | | - | |
2289 | | - | |
2290 | | - | |
2291 | | - | |
2292 | | - | |
2293 | | - | |
2294 | | - | |
2295 | | - | |
2296 | | - | |
2297 | | - | |
2298 | | - | |
2299 | | - | |
2300 | | - | |
2301 | | - | |
2302 | | - | |
2303 | | - | |
2304 | | - | |
2305 | | - | |
2306 | | - | |
2307 | | - | |
2308 | | - | |
2309 | | - | |
2310 | | - | |
2311 | | - | |
2312 | | - | |
2313 | | - | |
2314 | | - | |
2315 | | - | |
2316 | | - | |
2317 | | - | |
2318 | | - | |
2319 | | - | |
2320 | | - | |
2321 | | - | |
2322 | | - | |
2323 | | - | |
2324 | | - | |
2325 | | - | |
2326 | | - | |
2327 | | - | |
2328 | | - | |
2329 | | - | |
2330 | | - | |
2331 | | - | |
2332 | | - | |
2333 | | - | |
2334 | | - | |
0 commit comments