about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2019-02-25 23:07:12 +0000
committervarkor <github@varkor.com>2019-03-12 18:34:42 +0000
commit5c563f98b89434eb0aada9a65f256df74d63befc (patch)
tree6172294c38a68b291ffbaf9fdd060cc323392c7c
parent8f4c226fc5b3b0c0d120bb3117089557ef35acc1 (diff)
downloadrust-5c563f98b89434eb0aada9a65f256df74d63befc.tar.gz
rust-5c563f98b89434eb0aada9a65f256df74d63befc.zip
Add a test for #10876
-rw-r--r--src/test/ui/borrowck/issue-10876.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ui/borrowck/issue-10876.rs b/src/test/ui/borrowck/issue-10876.rs
new file mode 100644
index 00000000000..d8fff5f1776
--- /dev/null
+++ b/src/test/ui/borrowck/issue-10876.rs
@@ -0,0 +1,19 @@
+// run-pass
+
+#![feature(nll)]
+
+enum Nat {
+    S(Box<Nat>),
+    Z
+}
+fn test(x: &mut Nat) {
+    let mut p = &mut *x;
+    loop {
+        match p {
+            &mut Nat::Z => break,
+            &mut Nat::S(ref mut n) => p = &mut *n
+        }
+    }
+}
+
+fn main() {}