about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTyler Mandry <tmandry@gmail.com>2019-10-11 15:09:48 -0700
committerGitHub <noreply@github.com>2019-10-11 15:09:48 -0700
commit7a2bb04eb5b67294a50e68393a4cede0e5b642cc (patch)
tree56696dd2a8899347326ab283f5e7f3c1b8c67fce
parent6687edcbef063cb2a6ff414cfa3754139905b79e (diff)
parent3c62bdcf6b370460db9dceb0cffef06b2558e0b0 (diff)
downloadrust-7a2bb04eb5b67294a50e68393a4cede0e5b642cc.tar.gz
rust-7a2bb04eb5b67294a50e68393a4cede0e5b642cc.zip
Rollup merge of #65205 - GuillaumeGomez:long-err-explanation-E0568, r=estebank
Add long error explanation for E0568

Part of #61137.
-rw-r--r--src/librustc_passes/error_codes.rs30
-rw-r--r--src/test/ui/auto-trait-validation.stderr2
-rw-r--r--src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr3
-rw-r--r--src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr1
-rw-r--r--src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr1
5 files changed, 34 insertions, 3 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
diff --git a/src/test/ui/auto-trait-validation.stderr b/src/test/ui/auto-trait-validation.stderr
index d797f30a2fc..51422fab81f 100644
--- a/src/test/ui/auto-trait-validation.stderr
+++ b/src/test/ui/auto-trait-validation.stderr
@@ -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`.
diff --git a/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr b/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr
index 40c2c2e4c9d..63182a6bd95 100644
--- a/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr
+++ b/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr
@@ -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`.
diff --git a/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr b/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr
index 1184e30749f..8755bcded9d 100644
--- a/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr
+++ b/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr
@@ -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`.
diff --git a/src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr b/src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr
index 7b45ca07b35..5a388834909 100644
--- a/src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr
+++ b/src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr
@@ -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`.