Skip to content

Async closures#3668

Merged
traviscross merged 25 commits intorust-lang:masterfrom
compiler-errors:async-closure-redux
Aug 3, 2024
Merged

Async closures#3668
traviscross merged 25 commits intorust-lang:masterfrom
compiler-errors:async-closure-redux

Conversation

@compiler-errors
Copy link
Copy Markdown
Contributor

@compiler-errors compiler-errors commented Jul 1, 2024

This RFC adds an async bound modifier to the Fn family of trait bounds. The combination desugars to a set of perma-unstable AsyncFn{,Mut,Once} traits that parallel the current Fn{,Mut,Once} traits.

These traits give users the ability to express bounds for async callable types that are higher-ranked, and allow async closures to return futures which borrow from the closure's captures.

This RFC also connects these traits to the async || {} closure syntax, as originally laid out in RFC 2394, and confirms the necessity of a first-class async closure syntax.

Rendered

For additional background, see this blog post (which is referenced in the RFC):

Tracking:

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-async-await Proposals re. async / await A-closures Proposals relating to closures / lambdas. disposition-merge This RFC is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this RFC. T-lang Relevant to the language team, which will review and decide on the RFC. to-announce WG-async Relevant to the async working group.

Projects

None yet

Development

Successfully merging this pull request may close these issues.