Error code E0594

A non-mutable value was assigned a value.

Erroneous code example:

#![allow(unused)]
fn main() {
struct SolarSystem {
    earth: i32,
}

let ss = SolarSystem { earth: 3 };
ss.earth = 2; // error!
}

To fix this error, declare ss as mutable by using the mut keyword:

#![allow(unused)]
fn main() {
struct SolarSystem {
    earth: i32,
}

let mut ss = SolarSystem { earth: 3 }; // declaring `ss` as mutable
ss.earth = 2; // ok!
}