diff options
Diffstat (limited to 'src/test/ui/ret-bang.rs')
-rw-r--r-- | src/test/ui/ret-bang.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/ui/ret-bang.rs b/src/test/ui/ret-bang.rs new file mode 100644 index 000000000..6618992e0 --- /dev/null +++ b/src/test/ui/ret-bang.rs @@ -0,0 +1,13 @@ +// run-pass + +fn my_err(s: String) -> ! { println!("{}", s); panic!(); } + +fn okay(i: usize) -> isize { + if i == 3 { + my_err("I don't like three".to_string()); + } else { + return 42; + } +} + +pub fn main() { okay(4); } |