From 0190ebfe0748f28c290eb4759a03ffbd416cbeac Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Thu, 21 Apr 2011 17:39:04 -0700 Subject: Support all expression forms in typestate Added support for self_method, cont, chan, port, recv, send, be, do_while, spawn, and ext; handled break and cont correctly. (However, there are no non-xfailed test cases for ext or spawn in stage0 currently.) Although the standard library compiles and all test cases pass with typestate enabled, I left typestate checking disabled as rustc terminates abnormally when building the standard library if so, even though it does generate code correctly. --- src/test/compile-fail/break-uninit.rs | 22 ++++++++++++++++++++++ src/test/compile-fail/break-uninit2.rs | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 src/test/compile-fail/break-uninit.rs create mode 100644 src/test/compile-fail/break-uninit2.rs (limited to 'src/test') diff --git a/src/test/compile-fail/break-uninit.rs b/src/test/compile-fail/break-uninit.rs new file mode 100644 index 00000000..e9085dd2 --- /dev/null +++ b/src/test/compile-fail/break-uninit.rs @@ -0,0 +1,22 @@ +// xfail-boot +// xfail-stage0 +// error-pattern:Unsatisfied precondition + +fn foo() -> int { + let int x; + let int i; + + do { + i = 0; + break; + x = 0; + } while ((x = 0) != 0); + + log(x); + + ret 17; +} + +fn main() { + log(foo()); +} diff --git a/src/test/compile-fail/break-uninit2.rs b/src/test/compile-fail/break-uninit2.rs new file mode 100644 index 00000000..8ef83f08 --- /dev/null +++ b/src/test/compile-fail/break-uninit2.rs @@ -0,0 +1,22 @@ +// xfail-boot +// xfail-stage0 +// error-pattern:Unsatisfied precondition + +fn foo() -> int { + let int x; + let int i; + + do { + i = 0; + break; + x = 0; + } while (1 != 2); + + log(x); + + ret 17; +} + +fn main() { + log(foo()); +} -- cgit v1.2.3