Bring the Async Rust experience closer to parity with sync Rust (original) (raw)

Metadata
Short title Async
Point of contact Tyler Mandry
Teams compiler, lang, libs-api, spec, types
Task owners Michael Goulet, Eric Holk, Niko Matsakis, Santiago Pastorino, Tyler Mandry, TBD (Michael Goulet, or Niko Matsakis)
Status Proposed for flagship
Tracking issue rust-lang/rust-project-goals#105
Zulip channel #wg-async

Summary

Over the next six months, we will continue bringing Async Rust up to par with "sync Rust" by doing the following:

Motivation

This goal represents the next step on a multi-year program aiming to raise the experience of authoring "async Rust" to the same level of quality as "sync Rust". Async Rust is a crucial growth area, with 52% of the respondents in the 2023 Rust survey indicating that they use Rust to build server-side or backend applications.

The status quo

Async Rust is the most common Rust application area according to our 2023 Rust survey. Rust is a great fit for networked systems, especially in the extremes:

Despite async Rust's popularity, using async I/O makes Rust significantly harder to use. As one Rust user memorably put it, "Async Rust is Rust on hard mode." Several years back the async working group collected a number of "status quo" stories as part of authoring an async vision doc. These stories reveal a number of characteristic challenges:

The next 6 months

Tell a complete story for async fn in traits

Improve ergonomics around Pin

Work toward asynchronous generators

In H2 we hope to tackle the following:

The "shiny future" we are working towards

Writing async code in Rust should feel just as expressive, reliable, and productive as writing sync code in Rust. Our eventual goal is to provide Rust users building on async with

Design axioms

Ownership and team asks

This section defines the specific work items that are planned and who is expected to do them. It should also include what will be needed from Rust teams. The overall owner of the effort is Tyler Mandry. We have identified owners for subitems below; these may change over time.

Overall program management

Task Owner(s) or team(s) Notes
AFIT story blog post Tyler Mandry

Return type notation

Unsafe binders

Implementable trait aliases

async fn in dyn Trait

Pin ergonomics

Trait for generators (sync)

Dynosaur 1.0

Definitions

Definitions for terms used above:

Frequently asked questions

Why work on synchronous generators if your goal is to support async?

There are three features we want that all interact quite heavily with each other:

Of the three, we think we are the closest to ratifying an RFC for synchronous generators. This should help clarify one of the major outstanding questions for the other two items; namely, the relation to pinning. With that out of the way, we should better be able to focus on the iteration trait and how well it works with async generators.

Focusing on pinning first also synergizes well with the efforts to improve the ergonomics of pinning.