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

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

Closed
yoav-lavi opened this issue May 1, 2022 · 1 comment
Closed
Labels
C-bug Category: This is a bug.

Comments

@yoav-lavi
Copy link
Contributor

yoav-lavi commented May 1, 2022

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

@yoav-lavi yoav-lavi added the C-bug Category: This is a bug. label May 1, 2022
@yoav-lavi yoav-lavi changed the title The unused_must_use lint does not apply to cases of BoxFuture The unused_must_use lint does not apply to BoxFuture May 1, 2022
@yoav-lavi yoav-lavi changed the title The unused_must_use lint does not apply to BoxFuture Functions returning BoxFuture have no warning when unused May 1, 2022
@yoav-lavi yoav-lavi changed the title Functions returning BoxFuture have no warning when unused Functions returning BoxFuture have no warning when the future is unused May 1, 2022
@yoav-lavi
Copy link
Contributor Author

Apparently this is a duplicate of #67387, closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

1 participant