rust/tests/ui/ret-bang.rs

14 lines
236 B
Rust
Raw Normal View History

// run-pass
fn my_err(s: String) -> ! { println!("{}", s); panic!(); }
2011-05-21 02:53:50 +00:00
fn okay(i: usize) -> isize {
if i == 3 {
my_err("I don't like three".to_string());
} else {
return 42;
}
2011-05-21 02:53:50 +00:00
}
pub fn main() { okay(4); }