Fix an ICE in the vtable iteration for a trait reference in const eval when a supertrait is not implemented#156417
Conversation
…l when a supertrait not implemented compiler/rustc_trait_selection/src/traits/vtable.rs@`vtable_entries`: The impossible predicates check in `vtable_entries` used `instantiate_own` which only includes the method's own where-clauses, not the parent trait's bounds. Replace it with `instantiate_and_check_impossible_predicates` which also checks the trait ref itself, so unsatisfied supertrait bounds are caught and the method is marked `Vacant` instead of ICEing.
|
This PR changes a file inside |
|
r? @adwinwhite rustbot has assigned @adwinwhite. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
This should be sound now according to comment. So r? @lcnr or @ShoyuVanilla ? |
|
@bors r+ rollup |
…uwer Rollup of 8 pull requests Successful merges: - #156281 (Emit nofree attribute) - #157305 (Eagerly decide whether relaxed bounds are allowed or not) - #148713 (rustc_borrowck: fix async closure error note to report AsyncFn rather than Fn) - #156266 (Don't ICE in has_self_borrows when coroutine captures-by-ref ty is still inferred) - #156417 (Fix an ICE in the vtable iteration for a trait reference in const eval when a supertrait is not implemented) - #156956 (Support generic params in `Lift_Generic`) - #157140 ( rustc_target: Use rustc_abi instead of cfg_abi to detect powerpcspe ) - #157423 (Refactor/expand rustc_attr_parsing docs)
|
@rust-timer build 0465a9f |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (0465a9f): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -0.7%, secondary -1.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -3.6%, secondary -3.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.0%, secondary -0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 512.944s -> 513.337s (0.08%) |
|
Caused the perf regression in #157440 |
|
@JonathanBrouwer, oh dear, sorry about that. Should we revert the PR before I look into optimising it? |
|
Given that the perf regression is relatively minor and only in secondary benchmarks and that this PR fixes a bug I don't think reverting makes sense. If you could take a look at what causes the perf regression that would be awesome, but no hurry and if not we should just accept the minor regression :) |
This is a second incarnation of #152287, which was reverted in #152738 as it had exposed another underlying unsoundness (#153596, exhibited indirectly in #152735), which was recently fixed in #155749.
It’s the same fix and the same set of tests. Regression tests for the unsoundness itself were already added in #155749.
Closes #137190.
Closes #135470.