about summary refs log tree commit diff
path: root/src/test/compile-fail/liveness-while.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/compile-fail/liveness-while.rs')
-rw-r--r--src/test/compile-fail/liveness-while.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/test/compile-fail/liveness-while.rs b/src/test/compile-fail/liveness-while.rs
new file mode 100644
index 00000000000..b69012bc3f2
--- /dev/null
+++ b/src/test/compile-fail/liveness-while.rs
@@ -0,0 +1,7 @@
+fn f() -> int {
+    let mut x: int;
+    while 1 == 1 { x = 10; }
+    ret x; //! ERROR use of possibly uninitialized variable: `x`
+}
+
+fn main() { f(); }