E0021
Assignment to something that is not a place
ErrorThe left side of = or of a compound assignment such as += must be a variable, a field, or an element of an array.
Why
An assignment stores a value in a place. A sum or a call result is a value without a place, so nothing can hold what you assign to it.
Broken
fn main() {
let mut x = 1
x + 1 = 3
print(x)
}
What sisu says
error[E0021]: cannot assign to this expression --> E0021.sisu:3:5 | 3 | x + 1 = 3 | ^^^^^ sisu: 1 error sisu: for more on a code, run `sisu explain <code>`: E0021
Fixed
fn main() {
let mut x = 1
x = 3
print(x)
}
Sisu