about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-10-08 15:45:34 +0200
committerGitHub <noreply@github.com>2019-10-08 15:45:34 +0200
commit3246ab2427494abb59ecf3718f4dec83a0de406e (patch)
tree4755b09d812151dba2bc13ef8691054c6e4aa46f /src
parent0d17de89bac0aed983298f0e6f6b93eab2c5b833 (diff)
parent6608e4af1bd80f096f1f52c118e856d23498c787 (diff)
downloadrust-3246ab2427494abb59ecf3718f4dec83a0de406e.tar.gz
rust-3246ab2427494abb59ecf3718f4dec83a0de406e.zip
Rollup merge of #65179 - GuillaumeGomez:long-err-explanation-E0567, r=davidtwco
Add long error explanation for E0567

Part of #61137.
Diffstat (limited to 'src')
-rw-r--r--src/librustc_passes/error_codes.rs29
-rw-r--r--src/test/ui/auto-trait-validation.stderr3
2 files changed, 30 insertions, 2 deletions
diff --git a/src/librustc_passes/error_codes.rs b/src/librustc_passes/error_codes.rs
index a3c46f7a6fc..fbd06c34800 100644
--- a/src/librustc_passes/error_codes.rs
+++ b/src/librustc_passes/error_codes.rs
@@ -314,6 +314,34 @@ type A3 = fn(i16); // ok!
 ```
 "##,
 
+E0567: r##"
+Generics have been used on an auto trait.
+
+Erroneous code example:
+
+```compile_fail,E0567
+#![feature(optin_builtin_traits)]
+
+auto trait Generic<T> {} // error!
+
+fn main() {}
+```
+
+Since an auto trait is implemented on all existing types, the
+compiler would not be able to infer the types of the trait's generic
+parameters.
+
+To fix this issue, just remove the generics:
+
+```
+#![feature(optin_builtin_traits)]
+
+auto trait Generic {} // ok!
+
+fn main() {}
+```
+"##,
+
 E0571: r##"
 A `break` statement with an argument appeared in a non-`loop` loop.
 
@@ -531,7 +559,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
-    E0567, // auto traits can not have generic parameters
     E0568, // auto traits can not have super traits
     E0666, // nested `impl Trait` is illegal
     E0667, // `impl Trait` in projections
diff --git a/src/test/ui/auto-trait-validation.stderr b/src/test/ui/auto-trait-validation.stderr
index ae21984c06d..d797f30a2fc 100644
--- a/src/test/ui/auto-trait-validation.stderr
+++ b/src/test/ui/auto-trait-validation.stderr
@@ -18,4 +18,5 @@ LL | auto trait MyTrait { fn foo() {} }
 
 error: aborting due to 3 previous errors
 
-For more information about this error, try `rustc --explain E0380`.
+Some errors have detailed explanations: E0380, E0567.
+For more information about an error, try `rustc --explain E0380`.