]> git.lizzy.rs Git - rust.git/blob - tests/ui/mut/mutable-class-fields-2.rs
Rollup merge of #107190 - fmease:fix-81698, r=compiler-errors
[rust.git] / tests / ui / mut / mutable-class-fields-2.rs
1 struct Cat {
2   meows : usize,
3
4   how_hungry : isize,
5 }
6
7 impl Cat {
8   pub fn eat(&self) {
9     self.how_hungry -= 5; //~ ERROR cannot assign
10   }
11
12 }
13
14 fn cat(in_x : usize, in_y : isize) -> Cat {
15     Cat {
16         meows: in_x,
17         how_hungry: in_y
18     }
19 }
20
21 fn main() {
22   let nyan : Cat = cat(52, 99);
23   nyan.eat();
24 }