Code
extern crate futures;
use futures::executor::block_on;
use futures::future::join;
fn test() {
let a = async {};
let b = async { loop {} };
block_on(join(a, b));
}
Current output
warning: unreachable expression
--> src/lib.rs:5:11
|
5 | fn test() {
| ___________^
6 | | let a = async {};
7 | |
8 | | let b = async { loop {} };
9 | |
10 | | block_on(join(a, b));
| | -------------------- any code following this expression is unreachable
11 | | }
| |_^ unreachable expression
|
note: this expression has type `((), !)`, which is uninhabited
--> src/lib.rs:10:5
|
10 | block_on(join(a, b));
| ^^^^^^^^^^^^^^^^^^^^
= note: `#[warn(unreachable_code)]` (part of `#[warn(unused)]`) on by default
Desired output
Rationale and extra context
I don't think this lint should trigger at all in this case, since it's the last expression in the function. It doesn't trigger in the same way if there is anything after it, and the block_on and join seem to be load bearing.
Other cases
Rust Version
Nightly:
> rustc --version --verbose
rustc 1.93.0-nightly (518b42830 2025-11-16)
binary: rustc
commit-hash: 518b428304e0008859cb1fd81d1ac20efb2a064a
commit-date: 2025-11-16
host: x86_64-unknown-linux-gnu
release: 1.93.0-nightly
LLVM version: 21.1.5
Beta:
> rustc --version --verbose
rustc 1.92.0-beta.3 (f3f12444a 2025-11-09)
binary: rustc
commit-hash: f3f12444a017add0468f683f3a10656d29438a05
commit-date: 2025-11-09
host: x86_64-unknown-linux-gnu
release: 1.92.0-beta.3
LLVM version: 21.1.3
Anything else?
No response
Code
Current output
Desired output
Rationale and extra context
I don't think this lint should trigger at all in this case, since it's the last expression in the function. It doesn't trigger in the same way if there is anything after it, and the
block_onandjoinseem to be load bearing.Other cases
Rust Version
Anything else?
No response