Add detailed explaination for E0666
This commit is contained in:
parent
8318ef26c1
commit
4b2b23cc07
@ -552,6 +552,30 @@ trait Foo {
|
||||
```
|
||||
"##,
|
||||
|
||||
E0666: r##"
|
||||
`impl Trait` types cannot appear nested in the
|
||||
generic types of other `impl Trait` types.
|
||||
|
||||
Example of erroneous code:
|
||||
|
||||
```compile_fail,E0666
|
||||
trait MyGenericTrait<T> {}
|
||||
trait MyInnerTrait {}
|
||||
|
||||
fn foo(bar: impl MyGenericTrait<impl MyInnerTrait>) {}
|
||||
```
|
||||
|
||||
Type parameters for `impl Trait` types must be
|
||||
explicitly defined as named generic parameters:
|
||||
|
||||
```
|
||||
trait MyGenericTrait<T> {}
|
||||
trait MyInnerTrait {}
|
||||
|
||||
fn foo<T: MyInnerTrait>(bar: impl MyGenericTrait<T>) {}
|
||||
```
|
||||
"##,
|
||||
|
||||
E0695: r##"
|
||||
A `break` statement without a label appeared inside a labeled block.
|
||||
|
||||
@ -605,7 +629,6 @@ async fn foo() {}
|
||||
;
|
||||
E0226, // only a single explicit lifetime bound is permitted
|
||||
E0472, // asm! is unsupported on this target
|
||||
E0666, // nested `impl Trait` is illegal
|
||||
E0667, // `impl Trait` in projections
|
||||
E0696, // `continue` pointing to a labeled block
|
||||
E0706, // `async fn` in trait
|
||||
|
@ -27,3 +27,4 @@ LL | pub fn demo(_: impl Quux<Assoc=super::Deeper<impl Foo<impl Bar>>>) { }
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0666`.
|
||||
|
@ -272,5 +272,5 @@ LL | type Out = impl Debug;
|
||||
|
||||
error: aborting due to 43 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0282, E0562, E0658.
|
||||
Some errors have detailed explanations: E0282, E0562, E0658, E0666.
|
||||
For more information about an error, try `rustc --explain E0282`.
|
||||
|
@ -48,4 +48,5 @@ LL | fn allowed_in_ret_type() -> impl Fn() -> impl Into<u32> {
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0562`.
|
||||
Some errors have detailed explanations: E0562, E0666.
|
||||
For more information about an error, try `rustc --explain E0562`.
|
||||
|
Loading…
Reference in New Issue
Block a user