about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAgoston Szepessy <agszepp@gmail.com>2015-08-02 15:30:06 -0400
committerAgoston Szepessy <agszepp@gmail.com>2015-08-02 15:30:06 -0400
commit74787b98badd43eb069349e30d56b28f8f13be0f (patch)
tree09f4035c85e1f7d2dcd422ad255e98079daa9340
parent832e5a02cd41b3a20d1142b47867da4aa5033f03 (diff)
downloadrust-74787b98badd43eb069349e30d56b28f8f13be0f.tar.gz
rust-74787b98badd43eb069349e30d56b28f8f13be0f.zip
Added error explanation for E0384.
-rw-r--r--src/librustc_borrowck/diagnostics.rs23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/librustc_borrowck/diagnostics.rs b/src/librustc_borrowck/diagnostics.rs
index 4f90a287cb9..24bbd4fcb7e 100644
--- a/src/librustc_borrowck/diagnostics.rs
+++ b/src/librustc_borrowck/diagnostics.rs
@@ -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 @@ used.
 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