-
Notifications
You must be signed in to change notification settings - Fork 32
/
empty-binders-err.rs
67 lines (56 loc) · 1.23 KB
/
empty-binders-err.rs
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
fn lt<'a: 'a>() -> &'a () {
&()
}
fn lt_in_fn<'a: 'a>() -> fn(&'a ()) {
|_| ()
}
struct Contra<'a>(fn(&'a ()));
fn lt_in_contra<'a: 'a>() -> Contra<'a> {
Contra(|_| ())
}
fn covariance<'a, 'b, 'upper>(v: bool)
where
'upper: 'a,
'upper: 'b,
{
let _: &'upper () = match v {
//~^ ERROR lifetime may not live long enough
//~| ERROR lifetime may not live long enough
true => lt::<'a>(),
false => lt::<'b>(),
};
}
fn contra_fn<'a, 'b, 'lower>(v: bool)
where
'a: 'lower,
'b: 'lower,
{
let _: fn(&'lower ()) = match v {
//~^ ERROR lifetime may not live long enough
true => lt_in_fn::<'a>(),
false => lt_in_fn::<'b>(),
};
}
fn contra_struct<'a, 'b, 'lower>(v: bool)
where
'a: 'lower,
'b: 'lower,
{
let _: Contra<'lower> = match v {
//~^ ERROR lifetime may not live long enough
true => lt_in_contra::<'a>(),
false => lt_in_contra::<'b>(),
};
}
fn main() {}
// ferrocene-annotations: fls_yqcygq3y6m5j
// Lifetime
//
// ferrocene-annotations: fls_jeoas4n6su4
// Trait and Lifetime Bounds
//
// ferrocene-annotations: fls_ikfvbeewame7
// Subtyping and Variance
//
// ferrocene-annotations: fls_7nv8ualeaqe3
// Where Clauses