2018-10-16 08:56:39 -05:00
|
|
|
#![deny(unreachable_code)]
|
|
|
|
#![allow(dead_code)]
|
|
|
|
|
2019-12-11 08:51:28 -06:00
|
|
|
#![feature(never_type)]
|
|
|
|
|
2018-10-16 08:56:39 -05:00
|
|
|
fn foo(x: !) -> bool {
|
|
|
|
// Explicit matches on the never type are unwarned.
|
|
|
|
match x {}
|
|
|
|
// But matches in unreachable code are warned.
|
2018-10-17 18:05:19 -05:00
|
|
|
match x {} //~ ERROR unreachable expression
|
|
|
|
}
|
|
|
|
|
|
|
|
fn bar() {
|
|
|
|
match (return) {
|
|
|
|
() => () //~ ERROR unreachable arm
|
|
|
|
}
|
2018-10-16 08:56:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
return;
|
2018-10-17 18:05:19 -05:00
|
|
|
match () { //~ ERROR unreachable expression
|
2018-10-16 08:56:39 -05:00
|
|
|
() => (),
|
|
|
|
}
|
|
|
|
}
|