Repository navigation
fix: well-formed goals for tuples, arrays, and slices in next-solver - #23490
GauravPawar101 wants to merge 0 commit into
Conversation
This comment has been minimized.
This comment has been minimized.
6dff7d3 to
58782d6
Compare
|
I suspected that you used AI tools contrary to our policy. Please read our AI policy and follow it. |
|
@ChayimFriedman2 please check and mind my english, mostly just for a valid md and spelling correction. No code gen, if any problem. Please tell |
|
https://github.com/rust-lang/rust-analyzer/blob/master/AI_POLICY.md
|
58782d6 to
591fe07
Compare
This comment has been minimized.
This comment has been minimized.
591fe07 to
1071f2b
Compare
|
check @ChayimFriedman2 |
There was a problem hiding this comment.
Besides the AI policy, I think this doesn't match with what rustc does. It creates wf goals by TypeVisitor and I think it's not that complex to be ported here. (I'm not sure on the perf effect though)
The actual behaviors don't match even for tuples and arrays. As in, if you are making wf goals for ((usize, i32), u8), rustc emits no goals, as it visits each nested scalar types inside the tuples and they are trivially wf. But your code adds Wf((usize, i32)) and Wf(u8). Of course they hold trivially but it's waste to create and evaluate them and sometimes the difference between rustc could be even observable, e.g. by hitting recursion limits for very complex types.
| } | ||
| Some(goals) | ||
| } | ||
| TyKind::Array(t, _) | TyKind::Slice(t) => Some(vec![ |
There was a problem hiding this comment.
I think we should check whether const N is usize
|
Hey, quicwk heads up:
|
|
Well, this code is just wrong and can cause other bugs or problems by itself, as I've stated above. |
|
Indeed, don't drift from rustc. We need full WF checking anyway. |
|
☔ The latest upstream changes (possibly #23181) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Yeah, drafted raising pr soon |
1071f2b to
dd5ed69
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
Moved to #23516 for cleaner discussion and commit history |
Summary
Fixes #23475
changes
crates/hir-ty/src/next_solver/wf.rs (N): WfPredicates visitor over Terms like ruswtc.solver.rs: Implimented visitor.infer/expr.rs,infer/unify.rs: register WF obligation.infer/errors.rs: error-type fallback so the server no longer crashes.dyn_compatibility.rs: region bound helper using caller’s interner.NEW
solver_errors.r,hir/src/diagnostics.rs: solver diagnosticseE0308.ide-diagnostics/src/handlers: extendedE0308handler.VALIDATION
[x]
cargo test[x]
cargo clippy,cargo fmtDisclosure
Claude was used for rustc citations and understanding.
Rustc ref
The implementation is modeled directly on:
(rustc_middle/rustc_trait_selection dyn-object bounds machinery)
Divergences
following remains unimplemented as FIXME or narrower: