Skip to content

Commit 2ef8308

Browse files
committed
add more tests
1 parent f015842 commit 2ef8308

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// build-pass
2+
3+
enum Foo<T> {
4+
Var(T),
5+
} // `T` is covariant.
6+
7+
fn foo<'b>(x: Foo<for<'a> fn(&'a ())>) {
8+
let Foo::Var(x): Foo<fn(&'b ())> = x;
9+
}
10+
11+
fn foo_nested<'b>(x: Foo<Foo<for<'a> fn(&'a ())>>) {
12+
let Foo::Var(Foo::Var(x)): Foo<Foo<fn(&'b ())>> = x;
13+
}
14+
15+
fn main() {}

src/test/ui/mir/field-ty-ascription.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22

33
struct Foo<T>(T); // `T` is covariant.
44

5+
struct Bar<T> {
6+
x: T,
7+
} // `T` is covariant.
8+
9+
fn bar<'b>(x: Bar<for<'a> fn(&'a ())>) {
10+
let Bar { x }: Bar<fn(&'b ())> = x;
11+
}
12+
13+
fn bar_nested<'b>(x: Bar<Bar<for<'a> fn(&'a ())>>) {
14+
let Bar { x: Bar { x } }: Bar<Bar<fn(&'b ())>> = x;
15+
}
16+
17+
fn bar_foo_nested<'b>(x: Bar<Foo<for<'a> fn(&'a ())>>) {
18+
let Bar { x: Foo ( x ) }: Bar<Foo<fn(&'b ())>> = x;
19+
}
20+
521
fn foo<'b>(x: Foo<for<'a> fn(&'a ())>) {
622
let Foo(y): Foo<fn(&'b ())> = x;
723
}

0 commit comments

Comments
 (0)