diff options
| author | bors <bors@rust-lang.org> | 2019-09-28 12:06:44 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-09-28 12:06:44 +0000 |
| commit | 18f00b949615b1faa7feec95d58b087d146d3198 (patch) | |
| tree | 48eb742d39221bc0de3b3be792781ad1dcfb0ba3 | |
| parent | f3c8eba643a815d720e7f20699b3dca144c845c4 (diff) | |
| parent | 2fd38115095f199112ab1775f2d77cb99fba17d0 (diff) | |
| download | rust-18f00b949615b1faa7feec95d58b087d146d3198.tar.gz rust-18f00b949615b1faa7feec95d58b087d146d3198.zip | |
Auto merge of #64455 - GuillaumeGomez:long-error-explanation-E0531, r=Centril
Add Long error explanation for E0531 Part of #61137.
| -rw-r--r-- | src/librustc_resolve/error_codes.rs | 46 | ||||
| -rw-r--r-- | src/test/ui/enums-pats-not-idents.stderr | 1 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-5927.stderr | 3 | ||||
| -rw-r--r-- | src/test/ui/keyword/keyword-self-as-identifier.stderr | 1 | ||||
| -rw-r--r-- | src/test/ui/resolve/resolve-assoc-suggestions.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/self/self_type_keyword-2.stderr | 3 | ||||
| -rw-r--r-- | src/test/ui/self/self_type_keyword.stderr | 3 |
7 files changed, 54 insertions, 5 deletions
diff --git a/src/librustc_resolve/error_codes.rs b/src/librustc_resolve/error_codes.rs index adbff67cc8d..9a39fcf4223 100644 --- a/src/librustc_resolve/error_codes.rs +++ b/src/librustc_resolve/error_codes.rs @@ -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. @@ -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 diff --git a/src/test/ui/enums-pats-not-idents.stderr b/src/test/ui/enums-pats-not-idents.stderr index 3891d1eac48..6b1e6046260 100644 --- a/src/test/ui/enums-pats-not-idents.stderr +++ b/src/test/ui/enums-pats-not-idents.stderr @@ -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`. diff --git a/src/test/ui/issues/issue-5927.stderr b/src/test/ui/issues/issue-5927.stderr index 89f5e399ae6..3d4550ec8b2 100644 --- a/src/test/ui/issues/issue-5927.stderr +++ b/src/test/ui/issues/issue-5927.stderr @@ -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`. diff --git a/src/test/ui/keyword/keyword-self-as-identifier.stderr b/src/test/ui/keyword/keyword-self-as-identifier.stderr index 5f567910ed8..be57c6ad26f 100644 --- a/src/test/ui/keyword/keyword-self-as-identifier.stderr +++ b/src/test/ui/keyword/keyword-self-as-identifier.stderr @@ -6,3 +6,4 @@ LL | let Self = 22; error: aborting due to previous error +For more information about this error, try `rustc --explain E0531`. diff --git a/src/test/ui/resolve/resolve-assoc-suggestions.stderr b/src/test/ui/resolve/resolve-assoc-suggestions.stderr index 87040015b8d..f3b8909ab22 100644 --- a/src/test/ui/resolve/resolve-assoc-suggestions.stderr +++ b/src/test/ui/resolve/resolve-assoc-suggestions.stderr @@ -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`. diff --git a/src/test/ui/self/self_type_keyword-2.stderr b/src/test/ui/self/self_type_keyword-2.stderr index 359410bc1cd..560c6d2199c 100644 --- a/src/test/ui/self/self_type_keyword-2.stderr +++ b/src/test/ui/self/self_type_keyword-2.stderr @@ -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`. diff --git a/src/test/ui/self/self_type_keyword.stderr b/src/test/ui/self/self_type_keyword.stderr index 11b3b012c5f..6534d8c36e3 100644 --- a/src/test/ui/self/self_type_keyword.stderr +++ b/src/test/ui/self/self_type_keyword.stderr @@ -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`. |
