Skip to content

Commit 0667b00

Browse files
committed
update tests + add future compat test
1 parent c7b6e1d commit 0667b00

File tree

3 files changed

+35
-19
lines changed

3 files changed

+35
-19
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// check-pass
2+
fn lt_in_fn_fn<'a: 'a>() -> fn(fn(&'a ())) {
3+
|_| ()
4+
}
5+
6+
7+
fn foo<'a, 'b, 'lower>(v: bool)
8+
where
9+
'a: 'lower,
10+
'b: 'lower,
11+
{
12+
// if we infer `x` to be higher ranked in the future,
13+
// this would cause a type error.
14+
let x = match v {
15+
true => lt_in_fn_fn::<'a>(),
16+
false => lt_in_fn_fn::<'b>(),
17+
};
18+
19+
let _: fn(fn(&'lower())) = x;
20+
}
21+
22+
fn main() {}

src/test/ui/lub-glb/empty-binders-err.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ fn lt_in_contra<'a: 'a>() -> Contra<'a> {
1111
Contra(|_| ())
1212
}
1313

14-
fn covariance<'a, 'b, 'upper, 'lower>(v: bool)
14+
fn covariance<'a, 'b, 'upper>(v: bool)
1515
where
1616
'upper: 'a,
1717
'upper: 'b,
18-
'a: 'lower,
19-
'b: 'lower,
2018

2119
{
2220
let _: &'upper () = match v {
@@ -27,10 +25,8 @@ where
2725
};
2826
}
2927

30-
fn contra_fn<'a, 'b, 'upper, 'lower>(v: bool)
28+
fn contra_fn<'a, 'b, 'lower>(v: bool)
3129
where
32-
'upper: 'a,
33-
'upper: 'b,
3430
'a: 'lower,
3531
'b: 'lower,
3632

@@ -43,10 +39,8 @@ where
4339
};
4440
}
4541

46-
fn contra_struct<'a, 'b, 'upper, 'lower>(v: bool)
42+
fn contra_struct<'a, 'b, 'lower>(v: bool)
4743
where
48-
'upper: 'a,
49-
'upper: 'b,
5044
'a: 'lower,
5145
'b: 'lower,
5246

src/test/ui/lub-glb/empty-binders-err.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: lifetime may not live long enough
2-
--> $DIR/empty-binders-err.rs:22:12
2+
--> $DIR/empty-binders-err.rs:20:12
33
|
4-
LL | fn covariance<'a, 'b, 'upper, 'lower>(v: bool)
4+
LL | fn covariance<'a, 'b, 'upper>(v: bool)
55
| -- ------ lifetime `'upper` defined here
66
| |
77
| lifetime `'a` defined here
@@ -12,9 +12,9 @@ LL | let _: &'upper () = match v {
1212
= help: consider adding the following bound: `'a: 'upper`
1313

1414
error: lifetime may not live long enough
15-
--> $DIR/empty-binders-err.rs:22:12
15+
--> $DIR/empty-binders-err.rs:20:12
1616
|
17-
LL | fn covariance<'a, 'b, 'upper, 'lower>(v: bool)
17+
LL | fn covariance<'a, 'b, 'upper>(v: bool)
1818
| -- ------ lifetime `'upper` defined here
1919
| |
2020
| lifetime `'b` defined here
@@ -30,10 +30,10 @@ help: the following changes may resolve your lifetime errors
3030
= help: add bound `'b: 'upper`
3131

3232
error: lifetime may not live long enough
33-
--> $DIR/empty-binders-err.rs:39:12
33+
--> $DIR/empty-binders-err.rs:35:12
3434
|
35-
LL | fn contra_fn<'a, 'b, 'upper, 'lower>(v: bool)
36-
| -- ------ lifetime `'lower` defined here
35+
LL | fn contra_fn<'a, 'b, 'lower>(v: bool)
36+
| -- ------ lifetime `'lower` defined here
3737
| |
3838
| lifetime `'a` defined here
3939
...
@@ -43,10 +43,10 @@ LL | let _: fn(&'lower ()) = match v {
4343
= help: consider adding the following bound: `'lower: 'a`
4444

4545
error: lifetime may not live long enough
46-
--> $DIR/empty-binders-err.rs:54:12
46+
--> $DIR/empty-binders-err.rs:48:12
4747
|
48-
LL | fn contra_struct<'a, 'b, 'upper, 'lower>(v: bool)
49-
| -- ------ lifetime `'lower` defined here
48+
LL | fn contra_struct<'a, 'b, 'lower>(v: bool)
49+
| -- ------ lifetime `'lower` defined here
5050
| |
5151
| lifetime `'a` defined here
5252
...

0 commit comments

Comments
 (0)