Skip to content

Commit

Permalink
Add long error explanation for E0531
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Sep 25, 2019
1 parent c9edc02 commit 33b89a3
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion src/librustc_resolve/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,51 @@ match r {
```
"##,

E0531: r##"
An unknown tuple struct/variant has been used.
Erroneous code example:
```compile_fail,E0531
let Type(x) = Type(12); // error!
match Bar(12) {
Bar(x) => {} // error!
_ => {}
}
```
In most cases, it's either a forgotten import or a typo. However, let's look at
how you can have such a type:
```edition2018
struct Type(u32); // this is a tuple struct
enum Foo {
Bar(u32), // this is a tuple variant
}
use Foo::*; // To use Foo's variant directly, we need to import them in
// the scope.
```
Either way, it should work fine with our previous code:
```edition2018
struct Type(u32);
enum Foo {
Bar(u32),
}
use Foo::*;
let Type(x) = Type(12); // ok!
match Type(12) {
Type(x) => {} // ok!
_ => {}
}
```
"##,

E0532: r##"
Pattern arm did not match expected kind.
Expand Down Expand Up @@ -1675,7 +1720,6 @@ fn const_id<T, const N: T>() -> T { // error: const parameter
// E0419, merged into 531
// E0420, merged into 532
// E0421, merged into 531
E0531, // unresolved pattern path kind `name`
// E0427, merged into 530
// E0467, removed
// E0470, removed
Expand Down

0 comments on commit 33b89a3

Please sign in to comment.