about summary refs log tree commit diff
path: root/src/librustc_error_codes
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2019-11-18 19:03:20 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2019-11-18 23:38:25 +0100
commitc981c994d44801df0a68566467b0bf059f714c3d (patch)
treec0f38acc89108621ccb6737d473d4e52e2403212 /src/librustc_error_codes
parentcd13335ae23c115275d2c99728f3e66efc25993d (diff)
Move E0594 to new error code system
Diffstat (limited to 'src/librustc_error_codes')
-rw-r--r--src/librustc_error_codes/error_codes.rs2
-rw-r--r--src/librustc_error_codes/error_codes/E0594.md23
2 files changed, 24 insertions, 1 deletions
diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs
index 428cecf13a3..9fc375cc7b0 100644
--- a/src/librustc_error_codes/error_codes.rs
+++ b/src/librustc_error_codes/error_codes.rs
@@ -318,6 +318,7 @@ E0590: include_str!("./error_codes/E0590.md"),
 E0591: include_str!("./error_codes/E0591.md"),
 E0592: include_str!("./error_codes/E0592.md"),
 E0593: include_str!("./error_codes/E0593.md"),
+E0594: include_str!("./error_codes/E0594.md"),
 E0595: include_str!("./error_codes/E0595.md"),
 E0596: include_str!("./error_codes/E0596.md"),
 E0597: include_str!("./error_codes/E0597.md"),
@@ -566,7 +567,6 @@ E0744: include_str!("./error_codes/E0744.md"),
 //  E0563, // cannot determine a type for this `impl Trait` removed in 6383de15
 //  E0564, // only named lifetimes are allowed in `impl Trait`,
            // but `{}` was found in the type `{}`
-    E0594, // cannot assign to {}
 //  E0598, // lifetime of {} is too short to guarantee its contents can be...
 //  E0611, // merged into E0616
 //  E0612, // merged into E0609
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!
+```