diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2019-11-18 19:03:20 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2019-11-18 23:38:25 +0100 |
| commit | c981c994d44801df0a68566467b0bf059f714c3d (patch) | |
| tree | c0f38acc89108621ccb6737d473d4e52e2403212 /src/librustc_error_codes/error_codes | |
| parent | cd13335ae23c115275d2c99728f3e66efc25993d (diff) | |
| download | rust-c981c994d44801df0a68566467b0bf059f714c3d.tar.gz rust-c981c994d44801df0a68566467b0bf059f714c3d.zip | |
Move E0594 to new error code system
Diffstat (limited to 'src/librustc_error_codes/error_codes')
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0594.md | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/librustc_error_codes/error_codes/E0594.md b/src/librustc_error_codes/error_codes/E0594.md new file mode 100644 index 00000000000..ad8eb631e63 --- /dev/null +++ b/src/librustc_error_codes/error_codes/E0594.md @@ -0,0 +1,23 @@ +A non-mutable value was assigned a value. + +Erroneous code example: + +```compile_fail,E0594 +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: + +``` +struct SolarSystem { + earth: i32, +} + +let mut ss = SolarSystem { earth: 3 }; // declaring `ss` as mutable +ss.earth = 2; // ok! +``` |
