Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Long error explanation for E0531 #64455

Merged
merged 2 commits into from
Sep 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
1 change: 1 addition & 0 deletions src/test/ui/enums-pats-not-idents.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ LL | let a(1) = 13;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0531`.
3 changes: 2 additions & 1 deletion src/test/ui/issues/issue-5927.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ LL | x(1) => x(1)

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0425`.
Some errors have detailed explanations: E0425, E0531.
For more information about an error, try `rustc --explain E0425`.
1 change: 1 addition & 0 deletions src/test/ui/keyword/keyword-self-as-identifier.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ LL | let Self = 22;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0531`.
2 changes: 1 addition & 1 deletion src/test/ui/resolve/resolve-assoc-suggestions.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ LL | method;

error: aborting due to 9 previous errors

Some errors have detailed explanations: E0412, E0425.
Some errors have detailed explanations: E0412, E0425, E0531.
For more information about an error, try `rustc --explain E0412`.
3 changes: 2 additions & 1 deletion src/test/ui/self/self_type_keyword-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ LL | Foo { x: Self } => (),

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0432`.
Some errors have detailed explanations: E0432, E0531.
For more information about an error, try `rustc --explain E0432`.
3 changes: 2 additions & 1 deletion src/test/ui/self/self_type_keyword.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,5 @@ LL | struct Bar<'Self>;

error: aborting due to 12 previous errors

For more information about this error, try `rustc --explain E0392`.
Some errors have detailed explanations: E0392, E0531.
For more information about an error, try `rustc --explain E0392`.