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!
}
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/error_codes/E0594.html