Skip to content

BoxFuture / LocalBoxFuture should be marked as must_use #2017

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

Closed
shepmaster opened this issue Dec 30, 2019 · 3 comments
Closed

BoxFuture / LocalBoxFuture should be marked as must_use #2017

shepmaster opened this issue Dec 30, 2019 · 3 comments

Comments

@shepmaster
Copy link
Member

use futures::future::{FutureExt, LocalBoxFuture}; // 0.3.1

async fn plain() {}

fn boxed() -> LocalBoxFuture<'static, ()> {
    async {}.boxed_local()
}

pub async fn example() {
    plain();

    boxed();
}
warning: unused implementer of `core::future::future::Future` that must be used
  --> src/lib.rs:10:5
   |
10 |     plain();
   |     ^^^^^^^^
   |
   = note: `#[warn(unused_must_use)]` on by default
   = note: futures do nothing unless you `.await` or poll them

Sadly, there's no error for the unused result of boxed, which has already caused me a few minutes of head-scratching and debugging.

@taiki-e
Copy link
Member

taiki-e commented Dec 31, 2019

related: #1691

@shepmaster
Copy link
Member Author

Oh, those are type aliases... hmm.

@taiki-e
Copy link
Member

taiki-e commented Sep 5, 2020

Closing in favor of upstream issues: rust-lang/rust#67387, rust-lang/rust#73417

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants