Handle infinite-loop poststate correctly in typestate
If control passes an infinite loop (that doesn't have non-local exits), then everything is true.
This commit is contained in:
parent
e34fad7503
commit
98260a2a22
@ -554,7 +554,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
|
||||
ret changed | set_poststate_ann(fcx.ccx, e.id, pres);
|
||||
} else {
|
||||
ret changed | set_poststate_ann(fcx.ccx, e.id,
|
||||
block_poststate(fcx.ccx, body));
|
||||
false_postcond(num_constrs));
|
||||
}
|
||||
}
|
||||
expr_for(d, index, body) {
|
||||
|
@ -11,6 +11,6 @@ fn main() {
|
||||
check (even(y));
|
||||
loop {
|
||||
print_even(y);
|
||||
loop { loop { loop { y += x; } } }
|
||||
while true { while true { while true { y += x; } } }
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user