Skip to content

BoxFuture / LocalBoxFuture should be marked as must_use  #2017

Closed
@shepmaster

Description

@shepmaster
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions