granite-rust/src/test/ui/mut/mutable-class-fields-2.stderr

12 lines
452 B
Text
Raw Normal View History

2018-08-08 14:28:26 +02:00
error[E0594]: cannot assign to field `self.how_hungry` of immutable binding
2018-12-25 08:56:47 -07:00
--> $DIR/mutable-class-fields-2.rs:9:5
2018-08-08 14:28:26 +02:00
|
LL | pub fn eat(&self) {
| ----- use `&mut self` here to make mutable
LL | self.how_hungry -= 5; //~ ERROR cannot assign
| ^^^^^^^^^^^^^^^^^^^^ cannot mutably borrow field of immutable binding
error: aborting due to previous error
For more information about this error, try `rustc --explain E0594`.