-
Notifications
You must be signed in to change notification settings - Fork 182
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
Supports for async closures #823
Comments
There is no need to add You can simply add a single built-in implementation for each impl<F, A, Fut, O> AsyncFn<A> for F where F: Fn<A, Output = Fut>, Fut: Future<Output = O> {}
impl<F, A, Fut, O> AsyncFnMut<A> for F where F: FnMut<A, Output = Fut>, Fut: Future<Output = O> {}
impl<F, A, Fut, O> AsyncFnOnce<A> for F where F: FnOnce<A, Output = Fut>, Fut: Future<Output = O> {} |
Or if that leads to ambiguity with the blanket impls, then the impls could be restricted specifically to closures, fn pointers, and fn def self types. |
For the record, this is what I said in rust-lang/rust-analyzer#18591 (comment) |
Thanks! I'll try in that way |
@rustbot claim |
c.c rust-lang/rust-analyzer#19196
I'm afraid that implementing this on chalk and using on rust-analyzer would make currently ongoing rust-analyzer's trait solver migration more difficult but we need this to improve user experiences for Rust's shiny new async closures.
LangItem
andWellKnownTrait
forAsyncFn*
TyKind
for async closures. rustc categorizes them toCoroutineClosure
but rust-analyzer categorizes them toClosure
. I'd like to follow the rustc way for consistency but this might hinder currently ongoing trait solver migration in rust-analyzer a bitAsyncFn*
implementation supports for async closures and functions that returns futureI'm planning to start working on this tomorrow but if this is not welcomed due to next gen solver migrations or other issues, I'll gladly look for alternatives 😄
The text was updated successfully, but these errors were encountered: