Skip to content

Fix an ICE in the vtable iteration for a trait reference in const eval when a supertrait is not implemented#156417

Open
jakubadamw wants to merge 2 commits into
rust-lang:mainfrom
jakubadamw:issue-137190-reapplied
Open

Fix an ICE in the vtable iteration for a trait reference in const eval when a supertrait is not implemented#156417
jakubadamw wants to merge 2 commits into
rust-lang:mainfrom
jakubadamw:issue-137190-reapplied

Conversation

@jakubadamw
Copy link
Copy Markdown
Contributor

@jakubadamw jakubadamw commented May 10, 2026

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.

…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.
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 10, 2026

This PR changes a file inside tests/crashes. If a crash was fixed, please move into the corresponding ui subdir and add 'Fixes #' to the PR description to autoclose the issue upon merge.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 10, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 10, 2026

r? @adwinwhite

rustbot has assigned @adwinwhite.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 18 candidates

@adwinwhite
Copy link
Copy Markdown
Contributor

This should be sound now according to comment.
But I'm not familiar with the cause of the previous revert.

So r? @lcnr or @ShoyuVanilla ?

@rustbot rustbot assigned lcnr and unassigned adwinwhite May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ICE: Failed to resolve instance for <() as Supertrait<()>>::method ICE: invalid CoerceUnsized impl_source: Err(FulfillmentError)

4 participants