Open
Description
I tried this code:
enum Void {}
fn main() {
let void: Void;
match void {
_ => (),
}
}
I expected to see this happen: the code compiler without warnings and successfully runs doing nothing.
Instead, this happened: a warning is emitted (the code compiles and runs as expected):
warning: unreachable pattern
--> src/main.rs:6:9
|
6 | _ => (),
| ^-------
| |
| matches no values because `Void` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
= note: `#[warn(unreachable_patterns)]` on by default
Meta
rustc version: 1.85.0-nightly (2024-12-23 bdc6b3de48646345549f)