2018-10-16 13:56:39 +00:00
|
|
|
#![deny(unreachable_code)]
|
|
|
|
#![allow(dead_code)]
|
|
|
|
|
2019-12-11 14:51:28 +00:00
|
|
|
#![feature(never_type)]
|
|
|
|
|
2018-10-16 13:56:39 +00: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 23:05:19 +00:00
|
|
|
match x {} //~ ERROR unreachable expression
|
|
|
|
}
|
|
|
|
|
|
|
|
fn bar() {
|
|
|
|
match (return) {
|
|
|
|
() => () //~ ERROR unreachable arm
|
|
|
|
}
|
2018-10-16 13:56:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
return;
|
2018-10-17 23:05:19 +00:00
|
|
|
match () { //~ ERROR unreachable expression
|
2018-10-16 13:56:39 +00:00
|
|
|
() => (),
|
|
|
|
}
|
|
|
|
}
|