rust/src/test/compile-fail/issue-2817-2.rs

16 lines
501 B
Rust
Raw Normal View History

fn not_bool(f: fn(int) -> ~str) {}
fn main() {
for uint::range(0, 100000) |_i| { //~ ERROR A for-loop body must return (), but
false
};
for not_bool |_i| { //~ ERROR a `loop` function's last argument should return `bool`
//~^ ERROR A for-loop body must return (), but
~"hi"
};
for uint::range(0, 100000) |_i| { //~ ERROR A for-loop body must return (), but
~"hi"
};
for not_bool() |_i| { //~ ERROR a `loop` function's last argument
};
}