Closed
Description
- 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 positionimpl 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-positionimpl 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
- 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
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-positionimpl 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 inregister_hidden_type
ย #103355