diff options
| author | Sydney Acksman <obsidianminor@gmail.com> | 2019-10-26 17:44:23 -0500 |
|---|---|---|
| committer | Sydney Acksman <obsidianminor@gmail.com> | 2019-10-26 17:44:23 -0500 |
| commit | 4b2b23cc078c144a77a34711a20aee3faebbaf0e (patch) | |
| tree | dc7d8ed736a049cccfea312fdcc50dbbd48efbff | |
| parent | 8318ef26c1ad949636a161437ec251df59cf514a (diff) | |
| download | rust-4b2b23cc078c144a77a34711a20aee3faebbaf0e.tar.gz rust-4b2b23cc078c144a77a34711a20aee3faebbaf0e.zip | |
Add detailed explaination for E0666
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..e409871c4e9 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 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 @@ 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`. |
