rust/src/test/compile-fail/forgot-ret.rs
Niko Matsakis 72a3667eb3 Allow tail expressions even in no_value blocks. Type checker
will guarantee they have unit type.
2012-01-03 13:13:52 -08:00

9 lines
200 B
Rust

// -*- rust -*-
// error-pattern: not all control paths return a value
fn god_exists(a: int) -> bool { be god_exists(a); }
fn f(a: int) -> int { if god_exists(a) { ret 5; }; }
fn main() { f(12); }