diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2011-04-21 17:39:04 -0700 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2011-04-28 13:26:19 -0700 |
| commit | 0190ebfe0748f28c290eb4759a03ffbd416cbeac (patch) | |
| tree | a419e87e4071017aa52399f74646865f3f2c22ae /src/test | |
| parent | 7c4f8cb45924326e21547d19cbed683115657616 (diff) | |
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.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/break-uninit.rs | 22 | ||||
| -rw-r--r-- | src/test/compile-fail/break-uninit2.rs | 22 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/test/compile-fail/break-uninit.rs b/src/test/compile-fail/break-uninit.rs new file mode 100644 index 00000000000..e9085dd25e8 --- /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 00000000000..8ef83f08cf5 --- /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()); +} |
