Skip to content

Tait nest infer test #88406

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
Aug 31, 2021
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
18 changes: 18 additions & 0 deletions src/test/ui/type-alias-impl-trait/nested-tait-inference.rs
Original file line number Diff line number Diff line change
@@ -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() { }
19 changes: 19 additions & 0 deletions src/test/ui/type-alias-impl-trait/nested-tait-inference2.rs
Original file line number Diff line number Diff line change
@@ -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() {}
19 changes: 19 additions & 0 deletions src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr
Original file line number Diff line number Diff line change
@@ -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`.