-
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
ICE rink: higher-rank trait bound (HRTB) for<'a> ...
hits OutputTypeParameterMismatch in librustc/traits/codegen
#62529
Comments
type T: for<'a> ...
hits OutputTypeParameterMismatch in librustc/traits/codegen
type T: for<'a> ...
hits OutputTypeParameterMismatch in librustc/traits/codegentype T: for<'a> ...
hits OutputTypeParameterMismatch in librustc/traits/codegen
type T: for<'a> ...
hits OutputTypeParameterMismatch in librustc/traits/codegenT: for<'a> ...
hits OutputTypeParameterMismatch in librustc/traits/codegen
T: for<'a> ...
hits OutputTypeParameterMismatch in librustc/traits/codegenfor<'a> ...
hits OutputTypeParameterMismatch in librustc/traits/codegen
There is a good chance that all of these would be resolved by implementing lazy normalization, #60471 |
hi, I think I just go bitten by that too. Not sure if you are interested but my code is here : it's not a minimized version, sorry. i'm a bit sad, it took me so much time to write it. well, life is hard. |
Adding slightly smaller repro than any of the mentioned above (play). trait Trait<'a> {
type Out;
fn out(self) -> Self::Out;
}
impl<'a> Trait<'a> for u8 {
type Out = u8;
fn out(self) -> Self::Out {
self
}
}
fn call<F, D>(d: D, f: F) where
for<'a> D: Trait<'a>,
for<'a> F: Fn(<D as Trait<'a>>::Out),
{
f(d.out())
}
fn main() {
call(5, |_| ());
} Seems like the issue is actually triggered on Pretty-printed ICE: OutputTypeParameterMismatch(
Binder(<[closure@src/main.rs:21:13] as Fn<(<u8 as Trait<'_>>::Out)>>),
Binder(<[closure@src/main.rs:21:13] as Fn<(u8)>>),
Sorts(ExpectedFound {
expected: u8,
found: <u8 as Trait<'_>>::Out
})
) |
Heh, I just thought I can have ATC in Rust already. I have an example which doesn't work even when called through another generic function (unlike #52812 ). |
I think I hit this in Ralith/hecs#20: OutputTypeParameterMismatch(
Binder(<[closure@src/world.rs:10:5: 10:26] as std::ops::FnMut<(hecs::Entity, <hecs::query::FetchRead<bool> as hecs::Fetch<'_>>::Item)>>),
Binder(<[closure@src/world.rs:10:5: 10:26] as std::ops::FnMut<(hecs::Entity, &bool)>>),
Sorts(ExpectedFound { expected: &bool, found: <hecs::query::FetchRead<bool> as hecs::Fetch<'_>>::Item })
) selecting |
Nominating for discussion at compiler team meeting: Do we think we might try to address lazy-norm this year? |
Here's another: #86703 |
And yet another one #87531 |
I have seen many
OutputTypeParameterMismatch
ICEs filed, so I decided to try to make a single representative issue for all of them.Below are transcribed minimized versions of each of the original issues, labelled accordingly, so that we remember to double check each of their behavior before closing this issue as fixed in the future.
#60070 (play):
Click to expand the code for minimized example
#57485 (play):
Click to expand the code for minimized example
#53420 (play):
Click to expand the code for minimized example
#52812 (play):
Click to expand the code for minimized example
#50886 (play):
Click to expand the code for minimized example
#48112 (play):
Click to expand the code for minimized example
#42950 (play):
Click to expand the code for minimized example
OutputTypeParameterMismatch
#29997) are potentially different/interesting because it has the for<'a> ... on the left-hand side of a constraint, where for<'a> &'a D: Tr; most of the other examples have it on the right-hand side#33364 (play):
Click to expand the code for minimized example
#30860 (comment) (play):
Click to expand the code for minimized example
#29997 (play):
Click to expand the code for minimized #29997
#68578 (play):
Click to expand the code for minimized example
#70120
(needs its minimized example to be transcribed...)
#70243
The text was updated successfully, but these errors were encountered: