Test recursive TAIT declarations
This commit is contained in:
parent
7795f6233c
commit
77aacc1768
3 changed files with 80 additions and 0 deletions
|
|
@ -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() {}
|
||||
|
|
@ -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
|
||||
|
||||
|
|
@ -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() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue