Open
Description
Given the following code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=67b068c7dded060fd71f7e5a5ca91278
#![allow(deprecated, invalid_value)]
enum Void {}
fn main() {
if false {
unsafe { std::mem::uninitialized::<Void>(); }
}
println!();
}
The current output is:
warning: unreachable expression
--> src/main.rs:10:5
|
7 | unsafe { std::mem::uninitialized::<Void>(); }
| --------------------------------- any code following this expression is unreachable
...
10 | println!();
| ^^^^^^^^^^^ unreachable expression
|
= note: `#[warn(unreachable_code)]` on by default
note: this expression has type `Void`, which is uninhabited
--> src/main.rs:7:18
|
7 | unsafe { std::mem::uninitialized::<Void>(); }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this warning originates in the macro `$crate::format_args` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: `playground` (bin "playground") generated 1 warning
I expected no lint to trigger as the println!()
is actually reachable. This problem doesn't occur for panic!()
.