Skip to content

Add long error explaination for E0666 #65855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion src/librustc_passes/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,30 @@ trait Foo {
```
"##,

E0666: r##"
`impl Trait` types cannot appear nested in the
generic arguments 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.

Expand Down Expand Up @@ -605,7 +629,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
E0666, // nested `impl Trait` is illegal
E0667, // `impl Trait` in projections
E0696, // `continue` pointing to a labeled block
E0706, // `async fn` in trait
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
2 changes: 1 addition & 1 deletion src/test/ui/impl-trait/where-allowed.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
3 changes: 2 additions & 1 deletion src/test/ui/nested_impl_trait.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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`.