summaryrefslogtreecommitdiffstats
path: root/tests/ui/never_type/return-never-coerce.rs
blob: d615940eff1f0bd0dfda84ca6071b008601173a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Test that ! coerces to other types.

// run-fail
// error-pattern:aah!
// ignore-emscripten no processes

fn call_another_fn<T, F: FnOnce() -> T>(f: F) -> T {
    f()
}

fn wub() -> ! {
    panic!("aah!");
}

fn main() {
    let x: i32 = call_another_fn(wub);
    let y: u32 = wub();
}