Skip to content

Commit 77aacc1

Browse files
committed
Test recursive TAIT declarations
1 parent 7795f62 commit 77aacc1

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#![feature(type_alias_impl_trait)]
2+
3+
mod a {
4+
type Foo = impl PartialEq<(Foo, i32)>;
5+
//~^ ERROR could not find defining uses
6+
7+
struct Bar;
8+
9+
impl PartialEq<(Bar, i32)> for Bar {
10+
fn eq(&self, _other: &(Foo, i32)) -> bool {
11+
true
12+
}
13+
}
14+
}
15+
16+
mod b {
17+
type Foo = impl PartialEq<(Foo, i32)>;
18+
//~^ ERROR could not find defining uses
19+
20+
struct Bar;
21+
22+
impl PartialEq<(Foo, i32)> for Bar {
23+
fn eq(&self, _other: &(Bar, i32)) -> bool {
24+
true
25+
}
26+
}
27+
}
28+
29+
fn main() {}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: could not find defining uses
2+
--> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:4:16
3+
|
4+
LL | type Foo = impl PartialEq<(Foo, i32)>;
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
error: could not find defining uses
8+
--> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:17:16
9+
|
10+
LL | type Foo = impl PartialEq<(Foo, i32)>;
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error: aborting due to 2 previous errors
14+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// check-pass
2+
3+
#![feature(type_alias_impl_trait)]
4+
5+
mod direct {
6+
type Foo = impl PartialEq<(Foo, i32)>;
7+
8+
struct Bar;
9+
10+
impl PartialEq<(Foo, i32)> for Bar {
11+
fn eq(&self, _other: &(Foo, i32)) -> bool {
12+
true
13+
}
14+
}
15+
16+
fn foo() -> Foo {
17+
Bar
18+
}
19+
}
20+
21+
mod indirect {
22+
type Foo = impl PartialEq<(Foo, i32)>;
23+
24+
struct Bar;
25+
26+
impl PartialEq<(Bar, i32)> for Bar {
27+
fn eq(&self, _other: &(Bar, i32)) -> bool {
28+
true
29+
}
30+
}
31+
32+
fn foo() -> Foo {
33+
Bar
34+
}
35+
}
36+
37+
fn main() {}

0 commit comments

Comments
 (0)