E0594 - Error codes index
Description: Book listing all Rust error codes

## Keyboard shortcuts

Press `←` or `→` to navigate between chapters

Press `S` or `/` to search in the book

Press `?` to show this help

Press `Esc` to hide this help

# 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!
    }