Skip to content

Commit 3246ab2

Browse files
authored
Rollup merge of #65179 - GuillaumeGomez:long-err-explanation-E0567, r=davidtwco
Add long error explanation for E0567 Part of #61137.
2 parents 0d17de8 + 6608e4a commit 3246ab2

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

src/librustc_passes/error_codes.rs

+28-1
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,34 @@ type A3 = fn(i16); // ok!
314314
```
315315
"##,
316316

317+
E0567: r##"
318+
Generics have been used on an auto trait.
319+
320+
Erroneous code example:
321+
322+
```compile_fail,E0567
323+
#![feature(optin_builtin_traits)]
324+
325+
auto trait Generic<T> {} // error!
326+
327+
fn main() {}
328+
```
329+
330+
Since an auto trait is implemented on all existing types, the
331+
compiler would not be able to infer the types of the trait's generic
332+
parameters.
333+
334+
To fix this issue, just remove the generics:
335+
336+
```
337+
#![feature(optin_builtin_traits)]
338+
339+
auto trait Generic {} // ok!
340+
341+
fn main() {}
342+
```
343+
"##,
344+
317345
E0571: r##"
318346
A `break` statement with an argument appeared in a non-`loop` loop.
319347
@@ -531,7 +559,6 @@ Switch to the Rust 2018 edition to use `async fn`.
531559
;
532560
E0226, // only a single explicit lifetime bound is permitted
533561
E0472, // asm! is unsupported on this target
534-
E0567, // auto traits can not have generic parameters
535562
E0568, // auto traits can not have super traits
536563
E0666, // nested `impl Trait` is illegal
537564
E0667, // `impl Trait` in projections

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

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

1919
error: aborting due to 3 previous errors
2020

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

0 commit comments

Comments
 (0)