Skip to content

Tracking Issue for async_fn_in_trait, return_position_impl_trait_in_trait #91611

Description

@nikomatsakis

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

Unresolved Questions

Async fn in trait

Return position impl Trait in trait

Implementation history

Async fn in trait

F-async_fn_in_trait Static async fn in traits

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.

Activity

  1. added
    T-langRelevant to the language team
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    on Dec 6, 2021
  2. HTGAzureX1212 commented on Feb 5, 2022

    @HTGAzureX1212
    Contributor

    May I take a go at this?

  3. LeSeulArtichaut commented on Mar 23, 2022

    @LeSeulArtichaut
    Contributor

    Currently trying to take a stab at this. @rustbot claim

  4. nikomatsakis commented on Mar 24, 2022

    @nikomatsakis
    ContributorAuthor

    @LeSeulArtichaut actually, @spastorino has been looking into doing various refactorings to make this easier, you should probably synchronize with him, I'm not sure what state we are in.

  5. spastorino commented on Mar 24, 2022

    @spastorino
    Member

    Ohh, unsure why I've never assigned this to myself. I've been working on this since a while, and I've implemented RPITIT and async fns in traits support partially. At some point, we've realized that we wanted to change the design of the solution and started doing some refactors on RPITs.
    Anyway, I've already talked with @LeSeulArtichaut, and I'd be happy to share some work with them about this feature or about any other feature ❤️

  6. LeSeulArtichaut commented on Mar 24, 2022

    @LeSeulArtichaut
  7. self-assigned this
    on Mar 24, 2022
  8. fakedrake commented on Sep 12, 2022

    @fakedrake

    It seems this has been asleep for a while, is it blocked? is it dead? Does it need more love?

  9. spastorino commented on Sep 13, 2022

    @spastorino
    Member

    @fakedrake we are working on this thing, there's some support work being done by my RPIT Refactor and by RPITIT PR that just landed. You can see discussions on https://rust-lang.zulipchat.com/#narrow/stream/330606-wg-async.2Fasync-fn-in-trait-impl

  10. 30 remaining items

  11. changed the title [-]Tracking Issue for return_position_impl_trait_in_trait, async_fn_in_trait[/-] [+]Tracking Issue for async_fn_in_trait, return_position_impl_trait_in_trait[/+] on Jun 14, 2023
  12. rakshith-ravi commented on Aug 20, 2023

    @rakshith-ravi
    Contributor

    Is this still on track for 1.74, as mentioned by the blog post that had come out earlier?

  13. zachs18 commented on Sep 13, 2023

    @zachs18
    Contributor

    Currently (on stable), anywhere you see an async fn1, you know that it does no "work"2 when called, and only does work when .awaited or .poll()ed3. If it is allowed to manually desugar async fn in a trait definition as fn() -> impl Future in a trait impl, then this becomes no longer true, as one can insert computation into the function defintion, e.g.

    trait Trait {
      async fn foo();
    }
    impl Trait for () {
      fn foo -> impl Future<Output = ()> {
        println!("Doing stuff!");
        async {}
      }
    }

    I don't think this is a "blocker" but perhaps that section of the async book and the reference could be updated to reflect this change.

    Footnotes

    1. outside of a macro ↩

    2. For some defintion of "work" including anything but copying parameters into the return value ↩

    3. This is my understanding at least, and it is somewhat supported by the async book and the Rust Reference: "The value returned by async fn is a Future. For anything to happen, the Future needs to be run on an executor." (emphasis mine) from the async book, and "Async functions do no work when called: instead, they capture their arguments into a future. When polled, that future will execute the function's body" (emphasis mine) from the Rust Reference ↩

  14. compiler-errors commented on Sep 14, 2023

    @compiler-errors
    Contributor

    For the record, a stabilization PR has been opened over at: #115822.

    #91611 (comment): @zachs18: Yeah, I think the async book should be adjusted to mention something along the lines of "future isn't, in general, gonna to be run to completion unless it is awaited" -- the point, afaict, is more to make sure folks know .await needs to be called on the future unlike other langs which spawn tasks and kick them off immediately as a part of their async desugaring or something.

  15. added a commit that references this issue on Oct 14, 2023
    481d45a
  16. added a commit that references this issue on Dec 9, 2023
  17. added a commit that references this issue on Jan 21, 2025
  18. added a commit that references this issue on Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCF-async_fn_in_traitStatic async fn in traitsF-return_position_impl_trait_in_trait`#![feature(return_position_impl_trait_in_trait)]`S-tracking-impl-incompleteStatus: The implementation is incomplete.T-langRelevant to the language team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions