-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eagerly instantiate Fn
-like obligations in old solver
#108918
Eagerly instantiate Fn
-like obligations in old solver
#108918
Conversation
r? @eholk (rustbot has picked a reviewer for you, use r? to override) |
I guess I could crater run this to see if any GAT usages in production have fallout... @bors try |
r? @jackh726 |
⌛ Trying commit d2087a9 with merge 34cf026bde0f1d85725f44f69476992693389da0... |
☀️ Try build successful - checks-actions |
1 similar comment
☀️ Try build successful - checks-actions |
@craterbot check |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🎉 Experiment
|
Crater results look boring. I'd inclined to say that the only UI test that fails (the GATs example) really shouldn't have ever compiled, since if it didn't have escaping bound vars, we would've normalized it to an inference variable. |
"Shouldn't have compiled" and "managed to compile because it didn't hit any known bugs" are two different things, and that issue seems to fall in the latter. I've looked over this, but I need a little bit more time to really think about this. |
Yeah, and I think that test shouldn't have compiled. A corresponding projection test without lifetimes (link) doesn't compile, and I think that, while unfortunate, that is correct behavior. The fact that we eagerly relate projections via substs when they have escaping bound vars is not correct, imo, and this test breaks with the current implementation of lazy norm as well (link). |
@compiler-errors I need to look at this more and think harder about it, but in the meantime, can you add a test that compiles now and fails with this PR? |
Switching to waiting on author after the previous comment. Michael, feel free to request a review with @rustbot author |
don't have time to continue working on this, sorry 😅 |
Alternative approach to (actually) fixing #108832. Mostly just up for demonstration, probably needs some cleaning + re-consolidation into a helper fn like the one I removed.
cc @jackh726's comment #108834 (comment) -- was this what you were asking for?
The only problem with this approach is that you can construct higher-ranked
Fn
obligations with GATs that relies on the "don't normalize GATs with escaping bound vars" behavior to fall back to relating projections via substs. See testtests/ui/generic-associated-types/issue-93340.rs
(#93340) which fails to compile, so this would need a types FCP to confirm we're ok with the breakage :)