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 E0568 #65205

Merged
merged 2 commits into from
Oct 12, 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
30 changes: 29 additions & 1 deletion src/librustc_passes/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,35 @@ fn main() {}
```
"##,

E0568: r##"
A super trait has been added to an auto trait.

Erroneous code example:

```compile_fail,E0568
#![feature(optin_builtin_traits)]

auto trait Bound : Copy {} // error!

fn main() {}
```

Since an auto trait is implemented on all existing types, adding a super trait
would filter out a lot of those types. In the current example, almost none of
all the existing types could implement `Bound` because very few of them have the
`Copy` trait.

To fix this issue, just remove the super trait:

```
#![feature(optin_builtin_traits)]

auto trait Bound {} // ok!

fn main() {}
```
"##,

E0571: r##"
A `break` statement with an argument appeared in a non-`loop` loop.

Expand Down Expand Up @@ -576,7 +605,6 @@ Switch to the Rust 2018 edition to use `async fn`.
;
E0226, // only a single explicit lifetime bound is permitted
E0472, // asm! is unsupported on this target
E0568, // auto traits can not have super traits
E0666, // nested `impl Trait` is illegal
E0667, // `impl Trait` in projections
E0696, // `continue` pointing to a labeled block
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/auto-trait-validation.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ LL | auto trait MyTrait { fn foo() {} }

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0380, E0567.
Some errors have detailed explanations: E0380, E0567, E0568.
For more information about an error, try `rustc --explain E0380`.
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ LL | let (a, b) = copy(NoClone);

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.
Some errors have detailed explanations: E0277, E0568.
For more information about an error, try `rustc --explain E0277`.
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ LL | auto trait Magic : Sized where Option<Self> : Magic {}

error: aborting due to previous error

For more information about this error, try `rustc --explain E0568`.
1 change: 1 addition & 0 deletions src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ LL | auto trait Magic: Copy {}

error: aborting due to previous error

For more information about this error, try `rustc --explain E0568`.