Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Bug in impl FusedFuture for futures::future::Map #2213

Closed
Nemo157 opened this issue Sep 14, 2020 · 2 comments
Closed

Bug in impl FusedFuture for futures::future::Map #2213

Nemo157 opened this issue Sep 14, 2020 · 2 comments
Labels
A-future Area: futures::future bug

Comments

@Nemo157
Copy link
Member

Nemo157 commented Sep 14, 2020

It doesn't correctly propagate the termination of the underlying future

use futures::future::FusedFuture;
use futures::future::FutureExt;

fn main() {
    assert!(futures::future::pending::<()>().is_terminated());
    assert!(futures::future::pending::<()>().map(|()| ()).is_terminated());
}
> cargo run
thread 'main' panicked at 'assertion failed: futures::future::pending::<()>().map(|()| ()).is_terminated()', src/main.rs:6:5

This should be delegating through to the inner future:

Map::Incomplete { .. } => false,

@taiki-e
Copy link
Member

taiki-e commented Sep 14, 2020

Right. Also some Fused{Future, Stream} impls, including Fuse, should have similar issues.
And, this is one of the reasons I'd like to remove Fused{Future, Stream} (#2111 (comment)).

@taiki-e taiki-e added the bug label Sep 14, 2020
@taiki-e taiki-e added the A-future Area: futures::future label Dec 17, 2020
@taiki-e
Copy link
Member

taiki-e commented Jun 18, 2023

As said in #2207 (comment), the current implementation is correct if the underlying types do not implement FusedFuture, but is incorrect if it is implemented.

Closing in favor of #2207, which propose the removal of FusedFuture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-future Area: futures::future bug
Projects
None yet
Development

No branches or pull requests

2 participants