aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorTim Chevalier <[email protected]>2011-04-21 17:39:04 -0700
committerGraydon Hoare <[email protected]>2011-04-28 13:26:19 -0700
commit0190ebfe0748f28c290eb4759a03ffbd416cbeac (patch)
treea419e87e4071017aa52399f74646865f3f2c22ae /src/test
parentFurther work on typestate_check (diff)
downloadrust-0190ebfe0748f28c290eb4759a03ffbd416cbeac.tar.xz
rust-0190ebfe0748f28c290eb4759a03ffbd416cbeac.zip
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.rs22
-rw-r--r--src/test/compile-fail/break-uninit2.rs22
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 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());
+}