diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/mut/mutable-class-fields.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/ui/mut/mutable-class-fields.rs b/src/test/ui/mut/mutable-class-fields.rs new file mode 100644 index 000000000..30768a1ec --- /dev/null +++ b/src/test/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 +} |