]> git.lizzy.rs Git - rust.git/commit
Handle bang functions correctly in typestate
authorTim Chevalier <chevalier@alum.wellesley.edu>
Tue, 2 Aug 2011 03:55:04 +0000 (20:55 -0700)
committerTim Chevalier <chevalier@alum.wellesley.edu>
Tue, 2 Aug 2011 03:58:16 +0000 (20:58 -0700)
commit5cf5f5024d5efcbb0b399433fa2117e1146292c2
tree0e3d8a5834748c401ab5d7f67eb76f3ca52e5c0c
parentc9b16ac4c28ab5696d318dc7e414c73e27f9d631
Handle bang functions correctly in typestate

The logic for how the "returns" constraint was handled was always
dodgy, for reasons explained in the comments I added to
auxiliary::fn_info in this commit. Fixed it by adding distinct
"returns" and "diverges" constraints for each function, which
are both handled positively (that is: for a ! function, the
"diverges" constraint must be true on every exit path; for
any other function, the "returns" constraint must be true
on every exit path).

Closes #779
src/comp/middle/tstate/auxiliary.rs
src/comp/middle/tstate/ck.rs
src/comp/middle/tstate/collect_locals.rs
src/comp/middle/tstate/pre_post_conditions.rs
src/comp/middle/tstate/states.rs
src/test/compile-fail/bang-tailexpr.rs [new file with mode: 0644]