2018-08-08 07:28:26 -05:00
|
|
|
error[E0594]: cannot assign to field `self.how_hungry` of immutable binding
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/mutable-class-fields-2.rs:9:5
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | pub fn eat(&self) {
|
|
|
|
| ----- use `&mut self` here to make mutable
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | self.how_hungry -= 5;
|
2018-08-08 07:28:26 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^ cannot mutably borrow field of immutable binding
|
|
|
|
|
|
|
|
error: aborting due to previous error
|
|
|
|
|