diff options
Diffstat (limited to 'tests/ui/expr/if/expr-if-panic-fn.rs')
-rw-r--r-- | tests/ui/expr/if/expr-if-panic-fn.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/ui/expr/if/expr-if-panic-fn.rs b/tests/ui/expr/if/expr-if-panic-fn.rs new file mode 100644 index 000000000..36e49785a --- /dev/null +++ b/tests/ui/expr/if/expr-if-panic-fn.rs @@ -0,0 +1,20 @@ +// run-fail +// error-pattern:explicit panic +// ignore-emscripten no processes + +fn f() -> ! { + panic!() +} + +fn g() -> isize { + let x = if true { + f() + } else { + 10 + }; + return x; +} + +fn main() { + g(); +} |