]> git.lizzy.rs Git - rust.git/blob - tests/ui/never_type/return-never-coerce.rs
Rollup merge of #106605 - notriddle:notriddle/outdated-rustbook, r=GuillaumeGomez
[rust.git] / tests / ui / never_type / return-never-coerce.rs
1 // Test that ! coerces to other types.
2
3 // run-fail
4 // error-pattern:aah!
5 // ignore-emscripten no processes
6
7 fn call_another_fn<T, F: FnOnce() -> T>(f: F) -> T {
8     f()
9 }
10
11 fn wub() -> ! {
12     panic!("aah!");
13 }
14
15 fn main() {
16     let x: i32 = call_another_fn(wub);
17     let y: u32 = wub();
18 }