mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
25 lines
452 B
Rust
25 lines
452 B
Rust
#![deny(unreachable_code)]
|
|
#![allow(dead_code)]
|
|
|
|
#![feature(never_type)]
|
|
|
|
fn foo(x: !) -> bool {
|
|
// Explicit matches on the never type are unwarned.
|
|
match x {}
|
|
// But matches in unreachable code are warned.
|
|
match x {} //~ ERROR unreachable expression
|
|
}
|
|
|
|
fn bar() {
|
|
match (return) {
|
|
() => () //~ ERROR unreachable arm
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
return;
|
|
match () { //~ ERROR unreachable expression
|
|
() => (),
|
|
}
|
|
}
|