From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/mut/mutable-class-fields.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/ui/mut/mutable-class-fields.rs (limited to 'tests/ui/mut/mutable-class-fields.rs') diff --git a/tests/ui/mut/mutable-class-fields.rs b/tests/ui/mut/mutable-class-fields.rs new file mode 100644 index 000000000..30768a1ec --- /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 +} -- cgit v1.2.3