From 5cf5f5024d5efcbb0b399433fa2117e1146292c2 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Mon, 1 Aug 2011 20:55:04 -0700 Subject: 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/test/compile-fail/bang-tailexpr.rs | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/test/compile-fail/bang-tailexpr.rs (limited to 'src/test') diff --git a/src/test/compile-fail/bang-tailexpr.rs b/src/test/compile-fail/bang-tailexpr.rs new file mode 100644 index 00000000000..946a39b6802 --- /dev/null +++ b/src/test/compile-fail/bang-tailexpr.rs @@ -0,0 +1,4 @@ +// xfail-stage0 +// error-pattern: some control paths may return +fn f() -> ! { 3 } +fn main(){} -- cgit 1.4.1-3-g733a5