summaryrefslogtreecommitdiffstats
path: root/src/test/ui/rfc-2005-default-binding-mode/enum.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/rfc-2005-default-binding-mode/enum.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/ui/rfc-2005-default-binding-mode/enum.rs b/src/test/ui/rfc-2005-default-binding-mode/enum.rs
new file mode 100644
index 000000000..4e57769d6
--- /dev/null
+++ b/src/test/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;
+ }
+}