Skip to content

Commit 086a5c7

Browse files
Add E0413 error explanation
1 parent 5429c9b commit 086a5c7

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

src/librustc_resolve/diagnostics.rs

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,39 @@ impl Bar {
397397
```
398398
"##,
399399

400+
E0413: r##"
401+
A declaration shadows an enum variant or unit-like struct in scope.
402+
Example of erroneous code:
403+
404+
```
405+
struct Foo;
406+
407+
let Foo = 12i32; // error: declaration of `Foo` shadows an enum variant or
408+
// unit-like struct in scope
409+
```
410+
411+
412+
To fix this error, you have to change the name of the declaration of the
413+
shadowed object. Please also verify that neither name was misspelled.
414+
Example:
415+
416+
```
417+
struct Foo;
418+
419+
let foo = 12i32; // ok!
420+
```
421+
422+
Or:
423+
424+
```
425+
struct FooStruct;
426+
427+
let Foo = 12i32; // ok!
428+
```
429+
430+
The goal here is to avoid a conflict of names.
431+
"##,
432+
400433
E0417: r##"
401434
A static variable was referenced in a pattern. Example of erroneous code:
402435
@@ -425,7 +458,7 @@ match 0 {
425458
```
426459
"##,
427460

428-
E0424: r##"
461+
E0423: r##"
429462
A `struct` variant name was used like a function name. Example of
430463
erroneous code:
431464
@@ -673,8 +706,6 @@ register_diagnostics! {
673706
E0410, // variable from pattern is not bound in pattern 1
674707
E0411, // use of `Self` outside of an impl or trait
675708
E0412, // use of undeclared
676-
E0413, // declaration of shadows an enum variant or unit-like struct in
677-
// scope
678709
E0414, // only irrefutable patterns allowed here
679710
E0415, // identifier is bound more than once in this parameter list
680711
E0416, // identifier is bound more than once in the same pattern

0 commit comments

Comments
 (0)