Diagnostics ICE when replaying proof trees with next-solver#154329
Diagnostics ICE when replaying proof trees with next-solver#154329VicenteGusmao wants to merge 1 commit intorust-lang:mainfrom
Conversation
|
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
|
r? @TaKO8Ki rustbot has assigned @TaKO8Ki. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
When diagnostics replay proof tree state, rebuilding a canonical state can fail to match the current inference state. With -Znext-solver=globally, this could panic while reporting an error. Make proof tree replay fallible in diagnostics and fall back to the current obligation when replay fails. Add a regression test for the higher-ranked PartialEq and PartialOrd case. Signed-off-by: Vicente Gusmão <vicente.gusmao@tecnico.ulisboa.pt>
8c7b38e to
30c3bd2
Compare
|
r? lcnr |
|
this is a surprising failure, while revisiting goals can get different results with proof trees, instantiating the response generally shouldn't fail 🤔 can you provide some more detail how this test ends up returning some canonical state we cannot instantiate. What is the constraint we get when replying the proof tree but not while actually proving the goal please generally move fix #issuenum into the PR description instead of the title |
|
@rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
|
The failure is not in the original proof of the goal, but in the diagnostics-only replay of a stored We save a canonical state while proving the goal, and later try to replay that state after more trait solving has happened in the same For this testcase, the ICE only happens with I have not yet isolated the exact replay mismatch for this testcase, i.e. the specific constraint that is present during replay but not during the original proof, but I can instrument that next if that would be useful. I have also moved the #issuenum from the title to the PR description. |
|
@rustbot ready |
This is a bit incorrect. We usually unify the What happens in the problematic code is the following: We have a failed root goal But as there aren't any orig value for rust/compiler/rustc_next_trait_solver/src/canonical/mod.rs Lines 323 to 336 in c753cef But this inserts a new ty var in the infcx's current universe rather than the universe of var kind bound to that canonical var value, which is a HR as being in rust/compiler/rustc_trait_selection/src/solve/delegate.rs Lines 158 to 167 in c753cef So, the error is created while trying to unify the ty var from root universe to the binder's universe and I guess we should fix |
When diagnostics replay proof tree state, rebuilding a canonical state can fail to match the current inference state. With -Znext-solver=globally, this could panic while reporting an error, avoiding the panic.
Make proof tree replay fallible in diagnostics and fall back to the current obligation when replay fails. Add a regression test for the higher-ranked PartialEq and PartialOrd case. Fixes #151304.