Commit 29b854f
committed
Auto merge of rust-lang#68057 - Aaron1011:fix/marker-trait-selection, r=matthewjasper
Don't discard marker trait impls when inference variables are present
Fixes rust-lang#61651
Previously, we would unconditionally discard impl candidates for marker
traits during trait selection. However, if the predicate had inference
variables, this could have the effect of constrainting inference
variables (due to a successful trait selection) when we would have
otherwise failed due to mutliple applicable impls,
This commit prevents marker trait impls from being discarded while the
obligation predicate has any inference variables, ensuring that
discarding impls will never cause us to incorrectly constraint inference
variables.File tree
4 files changed
+84
-10
lines changed- src
- librustc
- traits
- specialize
- ty
- test/ui/marker_trait_attr
4 files changed
+84
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1417 | 1417 | | |
1418 | 1418 | | |
1419 | 1419 | | |
| 1420 | + | |
| 1421 | + | |
1420 | 1422 | | |
1421 | 1423 | | |
1422 | 1424 | | |
1423 | 1425 | | |
1424 | 1426 | | |
1425 | 1427 | | |
1426 | 1428 | | |
1427 | | - | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
1428 | 1434 | | |
1429 | 1435 | | |
1430 | 1436 | | |
| |||
2258 | 2264 | | |
2259 | 2265 | | |
2260 | 2266 | | |
| 2267 | + | |
2261 | 2268 | | |
2262 | 2269 | | |
2263 | 2270 | | |
| |||
2339 | 2346 | | |
2340 | 2347 | | |
2341 | 2348 | | |
2342 | | - | |
2343 | | - | |
2344 | | - | |
2345 | | - | |
| 2349 | + | |
| 2350 | + | |
| 2351 | + | |
| 2352 | + | |
| 2353 | + | |
| 2354 | + | |
| 2355 | + | |
| 2356 | + | |
| 2357 | + | |
| 2358 | + | |
| 2359 | + | |
| 2360 | + | |
| 2361 | + | |
| 2362 | + | |
| 2363 | + | |
| 2364 | + | |
| 2365 | + | |
| 2366 | + | |
| 2367 | + | |
| 2368 | + | |
| 2369 | + | |
| 2370 | + | |
| 2371 | + | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
| 2375 | + | |
| 2376 | + | |
| 2377 | + | |
| 2378 | + | |
| 2379 | + | |
| 2380 | + | |
| 2381 | + | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
| 2394 | + | |
| 2395 | + | |
| 2396 | + | |
| 2397 | + | |
2346 | 2398 | | |
2347 | 2399 | | |
2348 | 2400 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
| 166 | + | |
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2591 | 2591 | | |
2592 | 2592 | | |
2593 | 2593 | | |
2594 | | - | |
| 2594 | + | |
| 2595 | + | |
| 2596 | + | |
| 2597 | + | |
| 2598 | + | |
| 2599 | + | |
2595 | 2600 | | |
2596 | 2601 | | |
2597 | 2602 | | |
| |||
2711 | 2716 | | |
2712 | 2717 | | |
2713 | 2718 | | |
2714 | | - | |
| 2719 | + | |
2715 | 2720 | | |
2716 | 2721 | | |
2717 | 2722 | | |
| |||
2721 | 2726 | | |
2722 | 2727 | | |
2723 | 2728 | | |
2724 | | - | |
| 2729 | + | |
2725 | 2730 | | |
2726 | 2731 | | |
2727 | 2732 | | |
| |||
2757 | 2762 | | |
2758 | 2763 | | |
2759 | 2764 | | |
2760 | | - | |
| 2765 | + | |
2761 | 2766 | | |
2762 | 2767 | | |
2763 | 2768 | | |
| |||
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
0 commit comments