rust/src/test/ui/unreachable/unreachable-in-call.rs

23 lines
351 B
Rust
Raw Normal View History

#![allow(dead_code)]
#![deny(unreachable_code)]
fn diverge() -> ! { panic!() }
fn get_u8() -> u8 {
1
}
fn call(_: u8, _: u8) {
}
fn diverge_first() {
call(diverge(),
get_u8()); //~ ERROR unreachable expression
}
fn diverge_second() {
call( //~ ERROR unreachable expression
get_u8(),
diverge());
}
fn main() {}