about summary refs log tree commit diff
path: root/src/librustc_resolve
diff options
context:
space:
mode:
authorggomez <guillaume1.gomez@gmail.com>2016-08-30 12:54:51 +0200
committerggomez <guillaume1.gomez@gmail.com>2016-08-30 18:20:14 +0200
commit150599d01d2d8f8ec410ac6509478084ee920eb4 (patch)
treeda147dac5946b00f15cad9e704d9ceea6b5195e4 /src/librustc_resolve
parentaddb7537620feb228d6c9fe149b9c069d3686199 (diff)
downloadrust-150599d01d2d8f8ec410ac6509478084ee920eb4.tar.gz
rust-150599d01d2d8f8ec410ac6509478084ee920eb4.zip
Add E0530 error explanation
Diffstat (limited to 'src/librustc_resolve')
-rw-r--r--src/librustc_resolve/diagnostics.rs38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs
index 5183d68065c..f8f90bdb4e7 100644
--- a/src/librustc_resolve/diagnostics.rs
+++ b/src/librustc_resolve/diagnostics.rs
@@ -1270,7 +1270,42 @@ trait Foo {}
 
 impl Foo for i32 {}
 ```
-"##
+"##,
+
+E0530: r##"
+A binding shadowed something it shouldn't.
+
+Erroneous code example:
+
+```compile_fail,E0530
+static TEST: i32 = 0;
+
+let r: (i32, i32) = (0, 0);
+match r {
+    TEST => {} // error: match bindings cannot shadow statics
+}
+```
+
+To fix this error, just change the binding's name in order to avoid shadowing
+one of the following:
+
+* struct name
+* struct/enum variant
+* static
+* const
+* associated const
+
+Fixed example:
+
+```
+static TEST: i32 = 0;
+
+let r: (i32, i32) = (0, 0);
+match r {
+    something => {} // ok!
+}
+```
+"##,
 
 }
 
@@ -1289,7 +1324,6 @@ register_diagnostics! {
 //  E0419, merged into 531
 //  E0420, merged into 532
 //  E0421, merged into 531
-    E0530, // X bindings cannot shadow Ys
     E0531, // unresolved pattern path kind `name`
     E0532, // expected pattern path kind, found another pattern path kind
 //  E0427, merged into 530