-
Notifications
You must be signed in to change notification settings - Fork 13.4k
ICE during async closure experiments #127331
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
Comments
Oh, here's the error message:
|
Yep, I can't fix this with no code. It's not clear what the issue is from the ICE backtrace alone. |
you could probably fix #125099 and it would fix this one as well? |
Clone the batch-channel project and check out the async-closure-autobatch:
Then cargo check the throughput benchmark:
|
Self-contained reproduction (probably can be minimized further): use std::future::Future;
trait AsyncCallback<A>: FnOnce(A) -> Self::Fut {
type Fut: Future<Output = ()>;
}
impl<A, Out: Future<Output = ()>, F: FnOnce(A) -> Out> AsyncCallback<A> for F {
type Fut = Out;
}
struct BatchSender<T>(T);
trait ChannelSender<T>: Clone + Send {
type BatchSender;
fn autobatch<F>(self, f: F) -> impl Future<Output = ()> + Send
where
F: for<'a> AsyncCallback<&'a mut Self::BatchSender>;
}
struct Sender<T>(T);
impl<T: Send> ChannelSender<T> for Sender<T> {
type BatchSender = BatchSender<T>;
fn autobatch<F>(self, f: F) -> impl Future<Output = ()> + Send
where
F: for<'a> AsyncCallback<&'a mut Self::BatchSender>,
{
async {}
}
} Error output
Notably doesn't require the async_closure feature. @rustbot label -F-async_closure |
Thanks!! |
Minimized (I can't get it smaller than this) and got rid of dependence on std: trait MyFn<T> {
type Output;
}
trait MyFnAlias<A>: MyFn<A, Output = Self::OutputAlias> {
type OutputAlias;
}
impl<A, F: MyFn<A>> MyFnAlias<A> for F {
type OutputAlias = F::Output;
}
struct Thing;
trait Trait {}
impl Trait for Thing {}
trait ChannelSender {
type Arg;
fn autobatch<F>(self) -> impl Trait
where
F: MyFnAlias<Self::Arg>;
}
struct Sender;
impl ChannelSender for Sender {
type Arg = i32;
fn autobatch<F>(self) -> impl Trait
where
F: MyFnAlias<Self::Arg>,
{
Thing
}
} I believe this code should compile. |
Oh yeah, this has nothing to do with async closures at all. This is a shortcoming of the old trait solver having to do with -- and pardon for my technical jargon -- not being able to normalize param envs correctly. I think there should be other issues like this, probably labeled fixed-by-next-solver... I'll look into the ICE though, since I think we crash the compiler when trying to report the error lol. |
…lse-positive, r=oli-obk Don't try to label `ObligationCauseCode::CompareImplItem` for an RPITIT, since it has no name The old (current) trait solver has a limitation that when a where clause in param-env must be normalized using the same where clause, then we get spurious errors in `normalize_param_env_or_error`. I don't think there's an issue tracking it, but it's the root cause for many of the "fixed-by-next-solver" labeled issues. Specifically, these errors may occur when checking predicate entailment of the GAT that comes out of desugaring RPITITs. Since we use `ObligationCauseCode::CompareImplItem` for these predicates, we try calling `item_name` on an RPITIT which fails, since the RPITIT has no name. We simply suppress this logic when we're reporting a predicate entailment error for an RPITIT. RPITITs should never have predicate entailment errors, *by construction*, but they may due to this bug in the old solver. Addresses the ICE in rust-lang#127331, though doesn't fix the underlying issue (which is fundamental to the old solver). r? types
rustc-ice-2024-07-04T18_10_25-10188.txt
Code
Minimizing the code is nontrivial. Let me know if it is required to make a branch that reproduces the issue.
Meta
Error output
See attached rust-ice.
The text was updated successfully, but these errors were encountered: