Skip to content

Commit 847ad6a

Browse files
Add long error explanation for E0568
1 parent 275cf4b commit 847ad6a

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
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

0 commit comments

Comments
 (0)