rust/src/test/compile-fail/while-loop-pred-constraints.rs
Tim Chevalier 98260a2a22 Handle infinite-loop poststate correctly in typestate
If control passes an infinite loop (that doesn't have non-local
exits), then everything is true.
2012-03-10 20:15:27 -08:00

17 lines
344 B
Rust

// error-pattern:unsatisfied precondition constraint (for example, even(y
fn print_even(y: int) : even(y) { log(debug, y); }
pure fn even(y: int) -> bool { true }
fn main() {
let y: int = 42;
let x: int = 1;
check (even(y));
loop {
print_even(y);
while true { while true { while true { y += x; } } }
}
}