Test recursive TAIT declarations

This commit is contained in:
Oli Scherer 2022-01-26 16:33:16 +00:00
parent 7795f6233c
commit 77aacc1768
3 changed files with 80 additions and 0 deletions

View file

@ -0,0 +1,29 @@
#![feature(type_alias_impl_trait)]
mod a {
type Foo = impl PartialEq<(Foo, i32)>;
//~^ ERROR could not find defining uses
struct Bar;
impl PartialEq<(Bar, i32)> for Bar {
fn eq(&self, _other: &(Foo, i32)) -> bool {
true
}
}
}
mod b {
type Foo = impl PartialEq<(Foo, i32)>;
//~^ ERROR could not find defining uses
struct Bar;
impl PartialEq<(Foo, i32)> for Bar {
fn eq(&self, _other: &(Bar, i32)) -> bool {
true
}
}
}
fn main() {}

View file

@ -0,0 +1,14 @@
error: could not find defining uses
--> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:4:16
|
LL | type Foo = impl PartialEq<(Foo, i32)>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: could not find defining uses
--> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:17:16
|
LL | type Foo = impl PartialEq<(Foo, i32)>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -0,0 +1,37 @@
// check-pass
#![feature(type_alias_impl_trait)]
mod direct {
type Foo = impl PartialEq<(Foo, i32)>;
struct Bar;
impl PartialEq<(Foo, i32)> for Bar {
fn eq(&self, _other: &(Foo, i32)) -> bool {
true
}
}
fn foo() -> Foo {
Bar
}
}
mod indirect {
type Foo = impl PartialEq<(Foo, i32)>;
struct Bar;
impl PartialEq<(Bar, i32)> for Bar {
fn eq(&self, _other: &(Bar, i32)) -> bool {
true
}
}
fn foo() -> Foo {
Bar
}
}
fn main() {}