-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
rustc ICEs, "expected a Fn(u64)
closure, found F
"
#125099
Comments
The ICE happens in diagnostics because of a lack of usable name for a suggestion, It is on stable and started appearing in 1.77, technically becoming visible in #119869 cc @oli-obk as my due diligence, but that likely just bubbled up the issue. The closure error is now emitted multiple times, but that could be the ICE messing with deduplication (the spans are different tho...). |
Fn(u64)
closure, found F
"Fn(u64)
closure, found F
"
Reduced a bit so we can see it's not related to async. pub trait ContFn<T>: Fn(T) -> Self::Future {
type Future;
}
impl<T, F> ContFn<T> for F
where
F: Fn(T),
{
type Future = ();
}
pub trait SeqHandler {
type Requires;
fn process<F: ContFn<Self::Requires>>() -> impl Sized;
}
pub struct ConvertToU64;
impl SeqHandler for ConvertToU64 {
type Requires = u64;
fn process<F: ContFn<Self::Requires>>() -> impl Sized {}
}
fn main() {} |
Should I update issue's example to this one? |
Whatever is easier for you. People looking at this issue will find it either way, don't worry :) |
searched nightlies: from nightly-2022-02-19 to nightly-2024-06-19 |
I am not sure whether it is related toAsyncAssociated-types usage in that contextMy own experiments shown that by removingFuture
usage it's possible to get rid ofICE
, however, that's not necessarily identifies the problemIt is related to diagnostic as shown by @lqd - #125099 (comment)
Also code was a lot shortened - #125099 (comment)
Original code is still available at playground for history
Future
s usage eliminates ICE: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=81a36dbd18a3e21095514160b783ae95Code
https://play.rust-lang.org/?version=beta&mode=debug&edition=2021&gist=062bfd1c3c14b4af559fa82963211f22
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: