E0230

Mutating method (var self) called on something that is not a var binding.

Machine-applicable fix: Change let to var, or self to var self.

Example

This program fails with E0230.

struct Counter { count: Int }

impl Counter {
    fn tick(var self) {
        self.count = self.count + 1
    }
}

fn main() {
    let c = Counter(count: 0)
    c.tick()
}

Fixed

The same program, fixed.

struct Counter { count: Int }

impl Counter {
    fn tick(var self) {
        self.count = self.count + 1
    }
}

fn main() {
    var c = Counter(count: 0)
    c.tick()
}

Listed in the checker notes. oskac explain E0230 prints this entry offline.

All error codes