error not-assignable
Левая часть присваивания не является изменяемым местом.
What it means#
The left side of = or a compound assignment MUST be a mutable place: a var variable, a field of one, or an element accessed through &var (§5.1). A call result, a literal or an arithmetic expression is not a place. (Assignment to an existing immutable let binding is mutate-immutable.)
Example#
fn total() -> i32 => 10
fn main() {
total() = 5 // <- not-assignable
}error
not-assignable
How to fix#
fn main() {
var total = 10
total = 5
}Assign to a variable, field or element instead of an expression value.