Skip to content

Are blanket Future impls necessary? #60645

@ghost

Description

We currently have the following blanket impls:

impl<F: ?Sized + Future + Unpin> Future for &mut F
{ ... }

impl<F: ?Sized + Future + Unpin> Future for Box<F>
{ ... }

impl<F: Future> Future for AssertUnwindSafe<F>
{ ... }

impl<P> Future for Pin<P>
where
    P: Unpin + ops::DerefMut,
    P::Target: Future,
{ ... }

All of these blanket impls are on types that deref to something that implements Future. But then there are similar types that don't have a blanket Future implementation - for example, MutexGuard.

I wonder if these impls are necessary in practice if fut.await will auto-deref fut to a value that implements Future. I'm opening this issue just to double-check whether we really want to stabilize those blanket impls.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-async-awaitArea: Async & AwaitT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions