about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2019-10-08 13:51:44 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2019-10-10 15:56:59 +0200
commit847ad6a2ee8088dc802460e6497d1c5c96de823b (patch)
treeda65fa2b533c75c486b4069f226305b09377a796
parent275cf4bcacad3fbe5539ecd5840462793ae46eec (diff)
Add long error explanation for E0568
-rw-r--r--src/librustc_passes/error_codes.rs30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/librustc_passes/error_codes.rs b/src/librustc_passes/error_codes.rs
index e460e9813b3..a2626617afe 100644
--- a/src/librustc_passes/error_codes.rs
+++ b/src/librustc_passes/error_codes.rs
@@ -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.
 
@@ -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