-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Inference failure with type_changing_struct_update
#101970
Comments
Just creating an issue for easier tracking. cc #86555 |
We certainly knew this was a possibility when authoring the RFC -- based on the Zulip conversation, I believe that there were a number of inference failures of this kind, right? The options on the table that I see are:
My sense was that there was a significant amount of breakage, making the first not an option. In that case, if we want to proceed, we should probably do the work to plan how we can make this an edition change (in particular, can we do migration?). I think we should be able to. I'm going to nominate this issue to make the @rust-lang/lang team aware, but I'd appreciate it @crlf0710 if you or perhaps @compiler-errors could drop in more details about the scale of breakage found on crater. |
This comment was marked as outdated.
This comment was marked as outdated.
@rustbot label +I-lang-nominated |
For some context, there is a zulip thread about finishing work on type-changing struct update. And here is a MRE of this particular problem: #![feature(type_changing_struct_update)]
#[derive(Default)]
struct Struct<T>(T);
fn _f() { Struct { 0: (), ..Default::default() }; } If I understood correctly, @compiler-errors has an idea how we can hack inference to allow such examples. It's a hack though, so we may prefer to just do an editional breakage... |
For context, here's the experimentation I have done:
But even with those inference hacks there are still cases where we get failures. The inference hack is in a6e4db2 but it's very much a hack. |
I understood the cause of the problem to some extent and should be able to submit a PR soon to fix it |
@rustbot claim |
We discussed this in the lang meeting this week. I don't think we had agreement on what the way forward should be, but we had consensus that
@rustbot label -I-lang-nominated |
I came up with my solution, but it looks like the language team wants a different approach. So unassigned myself. |
Are there plans for trying to get this in to the 2024 edition? |
I don't think so. The inference fallout is really dramatic without hacks, and (speaking as an individual contributor, and not for the whole types team) I don't believe there is really a good, principled hack to implement here that would make the types team happy. |
In the crater run #98456,
fajita
crate regression exhibited inference failure. Here's a minimal repro:// when feature gate is enabled below, the compilation fails.
The text was updated successfully, but these errors were encountered: