Skip to content

Commit b37301a

Browse files
authored
Rollup merge of rust-lang#65205 - GuillaumeGomez:long-err-explanation-E0568, r=estebank
Add long error explanation for E0568 Part of rust-lang#61137.
2 parents c4a9302 + 3c62bdc commit b37301a

5 files changed

+34
-3
lines changed

src/librustc_passes/error_codes.rs

+29-1
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,35 @@ fn main() {}
359359
```
360360
"##,
361361

362+
E0568: r##"
363+
A super trait has been added to an auto trait.
364+
365+
Erroneous code example:
366+
367+
```compile_fail,E0568
368+
#![feature(optin_builtin_traits)]
369+
370+
auto trait Bound : Copy {} // error!
371+
372+
fn main() {}
373+
```
374+
375+
Since an auto trait is implemented on all existing types, adding a super trait
376+
would filter out a lot of those types. In the current example, almost none of
377+
all the existing types could implement `Bound` because very few of them have the
378+
`Copy` trait.
379+
380+
To fix this issue, just remove the super trait:
381+
382+
```
383+
#![feature(optin_builtin_traits)]
384+
385+
auto trait Bound {} // ok!
386+
387+
fn main() {}
388+
```
389+
"##,
390+
362391
E0571: r##"
363392
A `break` statement with an argument appeared in a non-`loop` loop.
364393
@@ -576,7 +605,6 @@ Switch to the Rust 2018 edition to use `async fn`.
576605
;
577606
E0226, // only a single explicit lifetime bound is permitted
578607
E0472, // asm! is unsupported on this target
579-
E0568, // auto traits can not have super traits
580608
E0666, // nested `impl Trait` is illegal
581609
E0667, // `impl Trait` in projections
582610
E0696, // `continue` pointing to a labeled block

src/test/ui/auto-trait-validation.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ LL | auto trait MyTrait { fn foo() {} }
1818

1919
error: aborting due to 3 previous errors
2020

21-
Some errors have detailed explanations: E0380, E0567.
21+
Some errors have detailed explanations: E0380, E0567, E0568.
2222
For more information about an error, try `rustc --explain E0380`.

src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ LL | let (a, b) = copy(NoClone);
1717

1818
error: aborting due to 2 previous errors
1919

20-
For more information about this error, try `rustc --explain E0277`.
20+
Some errors have detailed explanations: E0277, E0568.
21+
For more information about an error, try `rustc --explain E0277`.

src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ LL | auto trait Magic : Sized where Option<Self> : Magic {}
66

77
error: aborting due to previous error
88

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

src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ LL | auto trait Magic: Copy {}
66

77
error: aborting due to previous error
88

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

0 commit comments

Comments
 (0)