summaryrefslogtreecommitdiffstats
path: root/tests/ui/mir/field-ty-ascription.rs
blob: 178c7916bc59fe9215672c29fa266918d40ff940 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// build-pass

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

struct Bar<T> {
    x: T,
} // `T` is covariant.

fn bar<'b>(x: Bar<for<'a> fn(&'a ())>) {
    let Bar { x }: Bar<fn(&'b ())> = x;
}

fn bar_nested<'b>(x: Bar<Bar<for<'a> fn(&'a ())>>) {
    let Bar { x: Bar { x } }: Bar<Bar<fn(&'b ())>> = x;
}

fn bar_foo_nested<'b>(x: Bar<Foo<for<'a> fn(&'a ())>>) {
    let Bar { x: Foo ( x ) }: Bar<Foo<fn(&'b ())>> = x;
}

fn foo<'b>(x: Foo<for<'a> fn(&'a ())>) {
    let Foo(y): Foo<fn(&'b ())> = x;
}

fn foo_nested<'b>(x: Foo<Foo<for<'a> fn(&'a ())>>) {
    let Foo(Foo(y)): Foo<Foo<fn(&'b ())>> = x;
}

fn tuple<'b>(x: (u32, for<'a> fn(&'a ()))) {
    let (_, y): (u32, fn(&'b ())) = x;
}

fn tuple_nested<'b>(x: (u32, (u32, for<'a> fn(&'a ())))) {
    let (_, (_, y)): (u32, (u32, fn(&'b ()))) = x;
}

fn main() {}