Skip to content

Constrain Future::Output in supertrait of TryFuture #2763

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

hlbarber
Copy link

@hlbarber hlbarber commented Jul 19, 2023

The obstruction to

trait TryFuture: Future<Output = Result<Self::Ok, Self::Error>> {
    type Ok;
    type Error;
}

originally stated in #1776 (comment) no longer exists.

This PR provides an insight into what taking such a change now would look like now.

In addition to the minimal change to the TryFuture trait seen in a88e110, we additionally:

  • Remove IntoFuture from the trait bounds as it's no longer needed 60bcaed
  • Remove try_poll as it's now redundant 75e53ff
  • Remove IntoFuture entirely 4587897
  • Remove sealing from TryFuture as any attempted implementation would be met with a conflicting implementation from the blanket implementation 9e15e25

@hlbarber
Copy link
Author

A corresponding change can be made to TryStream.

@taiki-e
Copy link
Member

taiki-e commented Jul 19, 2023

See #2508 for the previous discussion.

@hlbarber
Copy link
Author

hlbarber commented Jul 19, 2023

This would require an MSRV bump to rustc version 1.52.

Failing 1.51
Passing 1.52

@taiki-e
Copy link
Member

taiki-e commented Jul 19, 2023

As mentioned in #2508 (comment), #2344 will unblock this.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-blocked Status: Blocked on something else
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants