Uh oh!
There was an error while loading. Please reload this page.
fallback to resolve infer generics in type-changing-struct-update - #102129
fallback to resolve infer generics in type-changing-struct-update#102129SparrowLii wants to merge 4 commits into
Conversation
rust-highfive
commented
Sep 22, 2022
r? @estebank (rust-highfive has picked a reviewer for you, use r? to override) |
SparrowLii
commented
Sep 22, 2022
bors
commented
Sep 27, 2022
☔ The latest upstream changes (presumably #102306) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Why are you throwing this result away?
There was a problem hiding this comment.
The purpose of this code is to instantiate the uninstantiated infer generic created for base_expr in check_expr_struct_fields by calling the relate_generic_arg function. If Err is returned, the generic type has been instantiated by the type of base_expr itself and is not constrained by the created struct (constrained ones hav been checked in check_expr_struct_fields).
There was a problem hiding this comment.
Perhaps we can have a more accurate approach, such as maintaining a non-constrained generic indexes list for base_expr.
There was a problem hiding this comment.
Given that this is purely for diagnostics, this approach might be fine, but including what you wrote above as a comment would be welcome.
There was a problem hiding this comment.
Given that this is purely for diagnostics
I'm confused by this comment. This isn't purely diagnostic, I thought? My understanding is that this function affects type inference -- notably, relate_generic_arg is also not an atomic operation, so even if it returns Err, it can still partially constrain inference variables inside of that.
I'm not convinced that this approach is completely sound. I would be comfortable with something more along the lines of:
such as maintaining a non-constrained generic indexes list for base_expr.
At least in that case it's easier to reason about when we're allowed to unify unconstrained inference variables and when we expect to raise errors.
2ffc007 to
ae5c596Comparebors
commented
Oct 7, 2022
☔ The latest upstream changes (presumably #101632) made this pull request unmergeable. Please resolve the merge conflicts. |
fee1-dead
commented
Nov 4, 2022
Can we do a crater run to see if this will fix all breakages? On the issue the lang team expressed that this could be done via an edition change, but wouldn't it just work as good if this would resolve them? cc @scottmcm |
estebank
commented
Nov 10, 2022
@bors try @craterbot run |
craterbot
commented
Nov 10, 2022
🚨 Error: missing start toolchain 🆘 If you have any trouble with Crater please ping |
bors
commented
Nov 10, 2022
🔒 Merge conflict This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again. How do I rebase?Assuming
You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial. Please avoid the "Resolve conflicts" button on GitHub. It uses Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Error message |
fee1-dead
commented
Nov 11, 2022
@rustbot author |
ae5c596 to
61fd9d5Comparefee1-dead
commented
Nov 11, 2022
@bors try |
bors
commented
Nov 11, 2022
⌛ Trying commit 61fd9d5 with merge cbe8532756bbbc4b7f32dda40d05981c8aeffd80... |
SparrowLii
commented
Nov 11, 2022
Just rebased the PR. We can have a crate run first |
bors
commented
Nov 11, 2022
☀️ Try build successful - checks-actions |
fee1-dead
commented
Nov 11, 2022
@craterbot run |
craterbot
commented
Nov 11, 2022
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
fee1-dead
commented
Nov 11, 2022
@craterbot abort |
craterbot
commented
Nov 11, 2022
🗑️ Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
fee1-dead
commented
Nov 11, 2022
@craterbot check |
craterbot
commented
Nov 11, 2022
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
craterbot
commented
Nov 11, 2022
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
craterbot
commented
Nov 12, 2022
🎉 Experiment
|
estebank
commented
Nov 22, 2022
I'm going to reroll, I don't have the bandwidth for this PR at the moment. r? compiler |
compiler-errors
commented
Nov 22, 2022
This still seems to leave some regressions according to the crater run. This definitely needs further discussion discussion on the changes to inference here, and I still have some concerns (#102129 (comment)) on the exact implementation that we're doing here. |
JohnCSimon
commented
Apr 30, 2023
@SparrowLii @rustbot label: +S-inactive |
Fixes#101970
When creating a struct with a base struct, we store the base struct's type which has infer generics. And then unify it with the created struct's generics through a function-body-scoped fallback during typeck.
cc #86555