E3011

E3011#

The assignment contains an invalid left-hand-side (LHS) expression, such as a constant or a constructor.

Erroneous example#

const N = 4

fn main {
  N = 5 // Error: Invalid left value for assignment.
}

Suggestion#

Change the LHS to a valid mutable memory location, such as a mutable variable or a mutable field:

fn main {
  let mut n = 4
  n = 5
}