trait_solver: Reject invalid canonical responses - #159725
Conversation
|
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
|
r? @BoxyUwU rustbot has assigned @BoxyUwU. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
|
I think we definitely do not want to make this fallible. There's also not really enough information in your description to explain what was going wrong and why, can you please explain more in detail the issue you're fixing. Specifically, why are we getting placeholders in the response. Though, I think |
|
@BoxyUwU the placeholder is At It gets weird when this goes through the nested canonical query. Input canonicalization puts both values in the root universe, so the query no longer knows that I made response application fallible because this is the first point where the original universe mismatch becomes visible again. Returning The leak check doesn't catch this btw. Inside the nested query it only sees the canonical root-universe vars, so there's nothing for it to reject. Given the state of |
There was a problem hiding this comment.
These two `response-universe-lowering tests already pass with the next solver on night 🤔
There was a problem hiding this comment.
yeah, you're right. both of these already pass on nightly. I added them more as guard tests around the response changes, not as the reproducer for #159704. The actual regression test is canonical-response-placeholder-leak-issue-159704.rs, and that one still ICEs without the fix.
The HRTB one came from the stage2 failure I hit with the first version of the check. I was rejecting region placeholders too, which broke the IrPrint bound. imo that one is still worth keeping since it caught an actual problem in this PR.
the other one mostly makes sure type/const inference vars still get their universes lowered. tbh I'm not that attached to it. idk if you think that coverage is useful here, ltm and I can drop it or just add a comment saying why it's there.
very little for now 🤔 I don't have a lot of capacity to engage with this atm |
|
☔ The latest upstream changes (presumably #160879) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
Fixes #159704
The next solver could apply a canonical response even when a caller-side inference var couldn't name one of its placeholders. That leaked into writeback and ICEd. Proof-tree replay could hit it too, including inside a generic caller.
Response application can fail now, and relation changes commit in one pass only if the whole response works. Failed proof trees keep an identity state built from the solver's canonical vars. IMO, rejecting the response here is cleaner than carrying invalid state until an unrelated diagnostic trips over it.