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
This commit is contained in:
Tim Chevalier 2011-08-01 20:55:04 -07:00
parent c9b16ac4c2
commit 5cf5f5024d
6 changed files with 117 additions and 59 deletions

View file

@ -0,0 +1,4 @@
// xfail-stage0
// error-pattern: some control paths may return
fn f() -> ! { 3 }
fn main(){}