Skip to content
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

Bring the Async Rust experience closer to parity with sync Rust #105

Open
17 of 40 tasks
nikomatsakis opened this issue Jul 22, 2024 · 9 comments
Open
17 of 40 tasks

Comments

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Jul 22, 2024

Metadata
Owner(s) @tmandry, @nikomatsakis
Team(s) compiler, lang, libs, libs-api
Goal document 2024h2/async

Summary

Over the next six months, we will deliver several critical async Rust building block features

Tasks and status

@nikomatsakis
Copy link
Contributor Author

This issue is intended for status updates only.

For general questions or comments, please contact the owner(s) directly.

@tmandry
Copy link
Member

tmandry commented Jul 30, 2024

Status update: July 30, 2024

Key developments

Blockers

We are able to make some progress in each area, but the biggest upcoming blocker we can see is:

  • Lang team deciding on final syntax for async closure bounds

Help wanted

There will be a call for testing async closures on the Inside Rust blog soon. Please check it out and give them a try in your own async code!

We'd like to see an updated RFC for implementable trait aliases that follows the guidelines laid out in this comment.

@nikomatsakis
Copy link
Contributor Author

nikomatsakis commented Sep 19, 2024

Executive summary.

We are generally on track with our marquee features: (1) Support for async closures is available on Nightly and the lang team arrived at a tentative consensus to keep the existing syntax (written rationale and formal decision are in progress). We issued a call for testing as well which has so far uncovered no issues. (2) Partial support for Return Type Notation is available on Nightly with the remainder under review. In addition, dynamic dispatch for async functions and experimental async drop work both made implementation progress. Async WG reorganization has made no progress.

Detailed updates

For this year's goal we are focused on three items:

  • Stabilizing async closures:
    • The Async Closures RFC has been accepted and the feature is available for use on Nightly under the async_closure feature gate. We put out a call for testing; so far, no problems have been reported. Stabilization stalled because of a need to resolve the syntax. Lang team has reached a tentative internal consensus in favor of the syntax as implemented (impl async Fn). Next steps are (1) lang team to write up rationale and finalizing syntax decision; (2) author stabilization report.
  • Resolving "Send Bounds" via Return Type Notation:
    • The Return Type Notation RFC has been accepted and partially implemented under the feature gate return_type_notation. Bounds like Trait<method(): Send> are available on Nightly; bounds like Trait::method(): Send will be available once PR #129629 is merged. Next steps are to (1) merge PR #129629; (2) call for testing; and (3) author stabilization report.
  • Dyn dispatch for async functions in traits:
    • Async functions in traits were stabilized last year without support for dynamic dispatch. For this year we plan to release a procedural macro that can help users workaround this limitation; native support is planned for future years. The all important task of selecting a crate name was completed, with dynosaur being chosen. Basic support is now implemented (see this example). Next steps are polish and putting out a call for testing.
  • Async drop experiments:
    • PRs with experimental implementation work for async drop are ready and awaiting review (PR list).

We have not made progress on Async WG reorganization.

@nikomatsakis
Copy link
Contributor Author

Updates:

  • Stabilizing async closures:
    • Lang team discussed syntax and reached preliminary consensus on async Fn, subject to also agreeing to include some of "async type" syntax. The rationale was documented in RFC: introduce the flavor syntactic design pattern rfcs#3710, which is now open and receiving feedback.
    • Next steps are for lang team to accept the RFC and to author stabilization report.
  • Resolving "Send Bounds" via Return Type Notation:
  • Dyn dispatch for async functions in traits:
    • Preliminary implementation work on the dynosaur crate was done. Polish and public call for testing remain the next steps.
  • Async drop experiments
    • There is a PR with pending work awaiting review. @nikomatsakis has agreed to review.
  • Async WG reorganization.
    • No progress. A meeting was scheduled but deferred.

@tmandry
Copy link
Member

tmandry commented Oct 11, 2024

Preliminary implementation work on the dynosaur crate was done. Polish and public call for testing remain the next steps.

The first version of dynosaur was published: https://docs.rs/dynosaur/latest/dynosaur/attr.dynosaur.html

@nikomatsakis
Copy link
Contributor Author

Updates:

  • Stabilizing async closures: The lang team held a design meeting reviewing the Flavor RFC. Conclusion was that @nikomatsakis will make some edits clarifying the RFC's limited intent (e.g., that is defines a namespacing mechanism and not something more involved) and weakening the language around the term "flavor".
  • Resolving send bounds via RTN: No progress.
  • Async drop experiments: @nikomatsakis performed initial review and is continuing to read into the code.
  • Async WG reorganizaiton: @tmandry is drafting an initial proposal.

Next steps:

@nikomatsakis
Copy link
Contributor Author

nikomatsakis commented Nov 6, 2024

Update:

  • Upon further discussion the lang team decided to close the flavor RFC (RFC: introduce the flavor syntactic design pattern rfcs#3710) and instead to pursue async closure stabilization with the name AsyncFn. The premise for the RFC was that we only wanted to commit to async Fn if we were ready to commit to at least the syntax of async Trait being used more broadly for other traits. There were enough questions raised during discussion to give some members pause as to whether we had worked out enough of the design space to commit to that, and so we decided to opt for a less ambitious stabilization instead to give more time for discussion.

Next steps:

@compiler-errors
Copy link
Member

That stabilization report is up: rust-lang/rust#132706

@nikomatsakis
Copy link
Contributor Author

With respect to return-type notation, the current status is that we landed an extension of return-type notation to cover Self::foo(..): Send in rust-lang/rust#129629 and we are now shaking out the bugs on that. More testing would be helpful, as would reviews on the PRs we've opened already (e.g., rust-lang/rust#132047).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants