about summary refs log tree commit diff
path: root/tests/ui/mut/mutable-class-fields.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/mut/mutable-class-fields.rs')
-rw-r--r--tests/ui/mut/mutable-class-fields.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/mut/mutable-class-fields.rs b/tests/ui/mut/mutable-class-fields.rs
new file mode 100644
index 00000000000..30768a1ec9b
--- /dev/null
+++ b/tests/ui/mut/mutable-class-fields.rs
@@ -0,0 +1,16 @@
+struct Cat {
+  meows : usize,
+  how_hungry : isize,
+}
+
+fn cat(in_x : usize, in_y : isize) -> Cat {
+    Cat {
+        meows: in_x,
+        how_hungry: in_y
+    }
+}
+
+fn main() {
+  let nyan : Cat = cat(52, 99);
+  nyan.how_hungry = 0; //~ ERROR cannot assign
+}