Hi,
the following program builds without warnings on stable and nightly, but prints an (IMHO incorrect) warning on beta:
fn foo() -> (Result<u8, ()>, &'static [u8]) {
(Err(()), b"1")
}
fn main() {
match foo() {
(Ok(_), _) => panic!("1"),
(Err(_), b"") => panic!("2"),
(Err(_), _) => panic!("3"),
}
}
(Playground)
Errors:
Compiling playground v0.0.1 (/playground)
warning: unreachable pattern
--> src/main.rs:9:9
|
9 | (Err(_), _) => panic!("3"),
| ^^^^^^^^^^^
|
= note: `#[warn(unreachable_patterns)]` on by default
warning: 1 warning emitted
Finished dev [unoptimized + debuginfo] target(s) in 1.46s
Running `target/debug/playground`
thread 'main' panicked at '3', src/main.rs:9:24
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
The panic shows that the supposedly unreachable pattern was, well, reached.
Originally discovered in psychon/x11rb#561 and surprisingly my attempt at reducing the example succeeded on the first try.
Hi,
the following program builds without warnings on stable and nightly, but prints an (IMHO incorrect) warning on beta:
(Playground)
Errors:
The panic shows that the supposedly unreachable pattern was, well, reached.
Originally discovered in psychon/x11rb#561 and surprisingly my attempt at reducing the example succeeded on the first try.