diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-08-31 10:41:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-31 10:41:18 +0200 |
| commit | 5eeeb0bf3be84424066e1b4103403515d7f3c921 (patch) | |
| tree | 06ee6f7c67199eb0ac8f83ce69b9af370d9f4265 | |
| parent | cd20fbdf82d2f3caa4c8397ff62a23b5c701b4a9 (diff) | |
| parent | d7a777f034ccc985def62f6dd08d9a8e68b3b15e (diff) | |
| download | rust-5eeeb0bf3be84424066e1b4103403515d7f3c921.tar.gz rust-5eeeb0bf3be84424066e1b4103403515d7f3c921.zip | |
Rollup merge of #88406 - spastorino:tait-nest-infer-test, r=oli-obk
Tait nest infer test r? `@oli-obk` Related to #86727
3 files changed, 56 insertions, 0 deletions
diff --git a/src/test/ui/type-alias-impl-trait/nested-tait-inference.rs b/src/test/ui/type-alias-impl-trait/nested-tait-inference.rs new file mode 100644 index 00000000000..efb88dabf34 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/nested-tait-inference.rs @@ -0,0 +1,18 @@ +// check-pass + +#![feature(type_alias_impl_trait)] +#![allow(dead_code)] + +use std::fmt::Debug; + +type FooX = impl Debug; + +trait Foo<A> { } + +impl Foo<()> for () { } + +fn foo() -> impl Foo<FooX> { + () +} + +fn main() { } diff --git a/src/test/ui/type-alias-impl-trait/nested-tait-inference2.rs b/src/test/ui/type-alias-impl-trait/nested-tait-inference2.rs new file mode 100644 index 00000000000..9b26a652978 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/nested-tait-inference2.rs @@ -0,0 +1,19 @@ +#![feature(type_alias_impl_trait)] +#![allow(dead_code)] + +use std::fmt::Debug; + +type FooX = impl Debug; +//~^ ERROR: could not find defining uses + +trait Foo<A> {} + +impl Foo<()> for () {} +impl Foo<u32> for () {} + +fn foo() -> impl Foo<FooX> { + //~^ ERROR: the trait bound `(): Foo<impl Debug>` is not satisfied [E0277] + () +} + +fn main() {} diff --git a/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr b/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr new file mode 100644 index 00000000000..7e24ee644b1 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr @@ -0,0 +1,19 @@ +error[E0277]: the trait bound `(): Foo<impl Debug>` is not satisfied + --> $DIR/nested-tait-inference2.rs:14:13 + | +LL | fn foo() -> impl Foo<FooX> { + | ^^^^^^^^^^^^^^ the trait `Foo<impl Debug>` is not implemented for `()` + | + = help: the following implementations were found: + <() as Foo<()>> + <() as Foo<u32>> + +error: could not find defining uses + --> $DIR/nested-tait-inference2.rs:6:13 + | +LL | type FooX = impl Debug; + | ^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. |
