about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorEric Holk <eholk@mozilla.com>2011-08-05 15:27:23 -0700
committerEric Holk <eholk@mozilla.com>2011-08-05 15:27:23 -0700
commit244efa6331eab49fa1bf765bfd6974d512ed6719 (patch)
tree880c3f8d01ec2d6652b78f2d65a60ce55d032cd3 /src/test
parentd65aaa933a205a694e5387d40fbea4c10cb168a8 (diff)
parent1c786bcc82424b9218f1ca52fa99a12ce353e590 (diff)
downloadrust-244efa6331eab49fa1bf765bfd6974d512ed6719.tar.gz
rust-244efa6331eab49fa1bf765bfd6974d512ed6719.zip
Merge branch 'master' of github.com:graydon/rust
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/alt-join.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/compile-fail/alt-join.rs b/src/test/compile-fail/alt-join.rs
new file mode 100644
index 00000000000..bbd4ac5c73a
--- /dev/null
+++ b/src/test/compile-fail/alt-join.rs
@@ -0,0 +1,17 @@
+// error-pattern:Unsatisfied precondition constraint
+// a good test that we merge paths correctly in the presence of a
+// variable that's used before it's declared
+// should be rejected by typestate because we use x without initializing it
+
+fn my_fail() -> ! { fail; }
+
+fn main() {
+
+    alt (true) {
+      false { my_fail(); }
+      true {}
+    }
+
+    log x;
+    let x:int;
+}
\ No newline at end of file