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:
parent
c9b16ac4c2
commit
5cf5f5024d
6 changed files with 117 additions and 59 deletions
4
src/test/compile-fail/bang-tailexpr.rs
Normal file
4
src/test/compile-fail/bang-tailexpr.rs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
// xfail-stage0
|
||||
// error-pattern: some control paths may return
|
||||
fn f() -> ! { 3 }
|
||||
fn main(){}
|
||||
Loading…
Add table
Add a link
Reference in a new issue