]> git.lizzy.rs Git - rust.git/commitdiff
Added error explanation for E0384.
authorAgoston Szepessy <agszepp@gmail.com>
Sun, 2 Aug 2015 19:30:06 +0000 (15:30 -0400)
committerAgoston Szepessy <agszepp@gmail.com>
Sun, 2 Aug 2015 19:30:06 +0000 (15:30 -0400)
src/librustc_borrowck/diagnostics.rs

index 4f90a287cb999f43ac249b5cb14c0b92a212195a..24bbd4fcb7eefcee57e562be4de13c215cc8c02e 100644 (file)
@@ -73,6 +73,28 @@ fn main() {
 
 To fix this, ensure that any declared variables are initialized before being
 used.
+"##,
+
+E0384: r##"
+This error occurs when an attempt is made to reassign an immutable variable.
+For example:
+
+```
+fn main(){
+    let x = 3;
+    x = 5; // error, reassignment of immutable variable
+}
+```
+
+By default, variables in Rust are immutable. To fix this error, add the keyword
+`mut` after the keyword `let` when declaring the variable. For example:
+
+```
+fn main(){
+    let mut x = 3;
+    x = 5;
+}
+```
 "##
 
 }
@@ -80,7 +102,6 @@ fn main() {
 register_diagnostics! {
     E0382, // use of partially/collaterally moved value
     E0383, // partial reinitialization of uninitialized structure
-    E0384, // reassignment of immutable variable
     E0385, // {} in an aliasable location
     E0386, // {} in an immutable container
     E0387, // {} in a captured outer variable in an `Fn` closure