]> git.lizzy.rs Git - rust.git/blob - tests/ui/reachable/unwarned-match-on-never.rs
Rollup merge of #106701 - ibraheemdev:sync-sender-spin, r=Amanieu
[rust.git] / tests / ui / reachable / unwarned-match-on-never.rs
1 #![deny(unreachable_code)]
2 #![allow(dead_code)]
3
4 #![feature(never_type)]
5
6 fn foo(x: !) -> bool {
7     // Explicit matches on the never type are unwarned.
8     match x {}
9     // But matches in unreachable code are warned.
10     match x {} //~ ERROR unreachable expression
11 }
12
13 fn bar() {
14     match (return) {
15         () => () //~ ERROR unreachable arm
16     }
17 }
18
19 fn main() {
20     return;
21     match () { //~ ERROR unreachable expression
22         () => (),
23     }
24 }