about summary refs log tree commit diff
path: root/tests/ui/rfc-2005-default-binding-mode/enum.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/rfc-2005-default-binding-mode/enum.rs')
-rw-r--r--tests/ui/rfc-2005-default-binding-mode/enum.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/rfc-2005-default-binding-mode/enum.rs b/tests/ui/rfc-2005-default-binding-mode/enum.rs
new file mode 100644
index 00000000000..4e57769d6e2
--- /dev/null
+++ b/tests/ui/rfc-2005-default-binding-mode/enum.rs
@@ -0,0 +1,22 @@
+enum Wrapper {
+    Wrap(i32),
+}
+
+use Wrapper::Wrap;
+
+pub fn main() {
+    let Wrap(x) = &Wrap(3);
+    *x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
+
+
+    if let Some(x) = &Some(3) {
+        *x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
+    } else {
+        panic!();
+    }
+
+    while let Some(x) = &Some(3) {
+        *x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
+        break;
+    }
+}