Skip to content

Commit 4d00026

Browse files
committed
add invariance test
1 parent 4040734 commit 4d00026

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// build-pass
2+
struct Inv<'a>(&'a mut &'a ());
3+
enum Foo<T> {
4+
Bar,
5+
Var(T),
6+
}
7+
type Supertype = Foo<for<'a> fn(Inv<'a>, Inv<'a>)>;
8+
9+
fn foo(x: Foo<for<'a, 'b> fn(Inv<'a>, Inv<'b>)>) {
10+
match x {
11+
Supertype::Bar => {}
12+
Supertype::Var(x) => {}
13+
}
14+
}
15+
16+
fn foo_nested(x: Foo<Foo<for<'a, 'b> fn(Inv<'a>, Inv<'b>)>>) {
17+
match x {
18+
Foo::Bar => {}
19+
Foo::Var(Supertype::Bar) => {}
20+
Foo::Var(Supertype::Var(x)) => {}
21+
}
22+
}
23+
24+
fn main() {}

0 commit comments

Comments
 (0)