about summary refs log tree commit diff
path: root/src/test/compile-fail/mutable-class-fields.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/compile-fail/mutable-class-fields.rs')
-rw-r--r--src/test/compile-fail/mutable-class-fields.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/compile-fail/mutable-class-fields.rs b/src/test/compile-fail/mutable-class-fields.rs
new file mode 100644
index 00000000000..b345c0c80f1
--- /dev/null
+++ b/src/test/compile-fail/mutable-class-fields.rs
@@ -0,0 +1,15 @@
+// error-pattern:assigning to immutable field
+class cat {
+  priv {
+    let mutable meows : uint;
+  }
+
+  let how_hungry : int;
+
+  new(in_x : uint, in_y : int) { meows = in_x; how_hungry = in_y; }
+}
+
+fn main() {
+  let nyan : cat = cat(52u, 99);
+  nyan.how_hungry = 0;
+}