about summary refs log tree commit diff
path: root/tests/ui/borrowck/borrowck-while-break.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/borrowck/borrowck-while-break.rs')
-rw-r--r--tests/ui/borrowck/borrowck-while-break.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ui/borrowck/borrowck-while-break.rs b/tests/ui/borrowck/borrowck-while-break.rs
new file mode 100644
index 00000000000..7100b713031
--- /dev/null
+++ b/tests/ui/borrowck/borrowck-while-break.rs
@@ -0,0 +1,12 @@
+fn test(cond: bool) {
+    let v;
+    while cond {
+        v = 3;
+        break;
+    }
+    println!("{}", v); //~ ERROR E0381
+}
+
+fn main() {
+    test(true);
+}