Rollup merge of #88406 - spastorino:tait-nest-infer-test, r=oli-obk

Tait nest infer test

r? `@oli-obk`

Related to #86727
This commit is contained in:
Mara Bos 2021-08-31 10:41:18 +02:00 committed by GitHub
commit 5eeeb0bf3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 0 deletions

View file

@ -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() { }

View file

@ -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() {}

View file

@ -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`.