Tracking Issue for async_fn_in_trait, return_position_impl_trait_in_trait · Issue #91611 · rust-lang/rust (original) (raw)
- This is a tracking issue for the RFC "static async fn in traits" (Static async fn in traits rfcs#3185) and "Return position
impl Trait
in traits" (Return position impl Trait in traits rfcs#3425). - The feature gate for async fn in traits is
#![feature(async_fn_in_trait)]
. - The feature gate for return position
impl Trait
in traits is#![feature(return_position_impl_trait_in_trait)]
. - This feature is developed as part of the async fundamentals initiative -- see that website for more information!
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
- Implement the RFC
- Adjust documentation (see instructions on rustc-dev-guide)
- Stabilization PR: Stabilize async fn and return-position impl Trait in trait #115822
Unresolved Questions
Async fn in trait
Return position impl Trait in trait
- Should we stabilize this feature together with
async fn
to mitigate hazards of writing a trait that is not forwards-compatible with its desugaring? - Resolution of RPITIT is allowed to name any in-scope lifetime parameter, unlike inherent RPIT methods #112194
- Note that this might impact the desugaring, as described in this comment.
- Should we limit the legal positions for
impl Trait
to positions that are nameable using upcoming features like return-type notation (RTN)? (See this comment for an example.)
Implementation history
Async fn in trait
F-async_fn_in_trait Static async fn in traits
- Only generate closure def id for async fns with body #102244
- Split out async_fn_in_trait into a separate feature #100734
Return position impl Trait in trait
F-return_position_impl_trait_in_trait `#![feature(return_position_impl_trait_in_trait)]`
Several of these include code specific to async fn in trait.
- Initial implementation of return-position impl Trait in traits #101224
- Equate fn outputs when inferring RPITIT hidden types #101614
- Make compare_predicate_entailment no longer a query #101615
- Check that the types in return position impl Trait in traits are well-formed #101676
- Support default-body trait functions with return-position impl Trait in traits #101679
- Calculate ProjectionTy::trait_def_id for return-position impl Trait in trait correctly #102152
- Resolve async fn signature even without body (e.g., in trait) #102161
- Serialize return-position impl Trait in trait hidden values in foreign libraries #102164
- Avoid ICE in printing RPITIT type #102597
- Fix subst issues with return-position impl Trait in trait #102334
- Handle return-position impl Trait in traits properly in register_hidden_type #103355