Skip to content

Functions returning BoxFuture have no warning when the future is unused #96618

Closed
@yoav-lavi

Description

@yoav-lavi

I tried this code:

use sqlx::sqlite::Sqlite;

const DB_URI: &str = "sqlite://data/db.sqlite";

async fn test() {
   // this returns a futures_core::future::BoxFuture, which does not warn upon compilation if unused
   Sqlite::create_database(DB_URI);
}

I expected to see this happen:

Normally, the unused_must_use lint would warn regarding the unused future. In this case there's no warning (perhaps because the original function has no warning, but since there's a blanket warning for async functions I'd expect one here).

Instead, this happened:

No warning was emitted

Meta

rustc --version --verbose:

rustc 1.60.0 (7737e0b5c 2022-04-04)
binary: rustc
commit-hash: 7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c
commit-date: 2022-04-04
host: aarch64-apple-darwin
release: 1.60.0
LLVM version: 14.0.0

See playground here

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions