diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-10-27 16:46:58 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-27 16:46:58 +0100 |
| commit | b5b4f9b3041ba4ec72bced538d69e4cd26a01735 (patch) | |
| tree | c0eec39d29aca5c7238bbb29faff63b7ce942240 | |
| parent | dae8ded9f5821f9dadde15ebca29543a1f20b072 (diff) | |
| parent | 16547f5025dd9420dc0a3b8bffd5a96f35e8df35 (diff) | |
| download | rust-b5b4f9b3041ba4ec72bced538d69e4cd26a01735.tar.gz rust-b5b4f9b3041ba4ec72bced538d69e4cd26a01735.zip | |
Rollup merge of #65855 - ObsidianMinor:extended_error/E0666, r=varkor
Add long error explaination for E0666 In the spirit of the month of spooks, here's a long explanation for E0666 for #61137.
4 files changed, 28 insertions, 3 deletions
diff --git a/src/librustc_passes/error_codes.rs b/src/librustc_passes/error_codes.rs index a2626617afe..e22e69a0697 100644 --- a/src/librustc_passes/error_codes.rs +++ b/src/librustc_passes/error_codes.rs @@ -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. @@ -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 diff --git a/src/test/ui/impl-trait/issues/issue-57979-deeply-nested-impl-trait-in-assoc-proj.stderr b/src/test/ui/impl-trait/issues/issue-57979-deeply-nested-impl-trait-in-assoc-proj.stderr index b9a1a4fa80a..2b6f15e6d3e 100644 --- a/src/test/ui/impl-trait/issues/issue-57979-deeply-nested-impl-trait-in-assoc-proj.stderr +++ b/src/test/ui/impl-trait/issues/issue-57979-deeply-nested-impl-trait-in-assoc-proj.stderr @@ -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`. diff --git a/src/test/ui/impl-trait/where-allowed.stderr b/src/test/ui/impl-trait/where-allowed.stderr index dfb6e6524d9..b01095f15a9 100644 --- a/src/test/ui/impl-trait/where-allowed.stderr +++ b/src/test/ui/impl-trait/where-allowed.stderr @@ -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`. diff --git a/src/test/ui/nested_impl_trait.stderr b/src/test/ui/nested_impl_trait.stderr index bf853d30fab..3749c268a68 100644 --- a/src/test/ui/nested_impl_trait.stderr +++ b/src/test/ui/nested_impl_trait.stderr @@ -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`. |
