]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0530.md
Merge commit '9809f5d21990d9e24b3e9876ea7da756fd4e9def' into libgccjit-codegen
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0530.md
1 A binding shadowed something it shouldn't.
2
3 Erroneous code example:
4
5 ```compile_fail,E0530
6 static TEST: i32 = 0;
7
8 let r: (i32, i32) = (0, 0);
9 match r {
10     TEST => {} // error: match bindings cannot shadow statics
11 }
12 ```
13
14 To fix this error, just change the binding's name in order to avoid shadowing
15 one of the following:
16
17 * struct name
18 * struct/enum variant
19 * static
20 * const
21 * associated const
22
23 Fixed example:
24
25 ```
26 static TEST: i32 = 0;
27
28 let r: (i32, i32) = (0, 0);
29 match r {
30     something => {} // ok!
31 }
32 ```