Skip to content

Commit 615d765

Browse files
bless more tests
1 parent fdbad90 commit 615d765

9 files changed

Lines changed: 47 additions & 8 deletions

tests/ui/implied-bounds/hrlt-implied-trait-bounds-roundtrip.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@ check-pass
21
struct Foo<'a>(&'a ())
32
where
43
(): Trait<'a>;
@@ -21,7 +20,7 @@ where
2120
}
2221

2322
fn main() {
24-
let bar: for<'a, 'b> fn(Foo<'a>, &'b ()) = |_, _| {};
23+
let bar: for<'a, 'b> fn(Foo<'a>, &'b ()) = |_, _| {}; //~ ERROR: lifetime may not live long enough
2524

2625
// If `could_use_implied_bounds` were to use implied bounds,
2726
// keeping 'a late-bound, then we could assign that function
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/hrlt-implied-trait-bounds-roundtrip.rs:23:49
3+
|
4+
LL | let bar: for<'a, 'b> fn(Foo<'a>, &'b ()) = |_, _| {};
5+
| ^
6+
| |
7+
| has type `Foo<'1>`
8+
| requires that `'1` must outlive `'static`
9+
10+
error: aborting due to 1 previous error
11+

tests/ui/nll/closure-requirements/escape-argument-callee.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ LL | let mut closure = expect_sig(|p, y| *p = y);
2020
| - - ^^^^^^ assignment requires that `'1` must outlive `'2`
2121
| | |
2222
| | has type `&'1 i32`
23-
| has type `&'?1 mut &'2 i32`
23+
| has type `&'2 mut &'?2 i32`
2424

2525
note: no external requirements
2626
--> $DIR/escape-argument-callee.rs:20:1

tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y
1919
= note: late-bound region is '?4
2020
= note: number of external vids: 5
2121
= note: where '?1: '?2
22+
= note: where '?1: '?2
23+
= note: where '?1: '?2
2224

2325
note: no external requirements
2426
--> $DIR/propagate-approximated-ref.rs:42:1

tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
1818
= note: late-bound region is '?3
1919
= note: number of external vids: 4
2020
= note: where '?1: '?0
21+
= note: where '?1: '?0
2122

2223
note: no external requirements
2324
--> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:31:1

tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y
1818
= note: late-bound region is '?3
1919
= note: late-bound region is '?4
2020
= note: number of external vids: 5
21+
= note: where '?1: '?2
22+
= note: where '?1: '?2
23+
= note: where '?1: '?0
2124
= note: where '?1: '?0
2225

2326
note: no external requirements

tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ error: lifetime may not live long enough
2323
LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
2424
| --------- - has type `&'?6 Cell<&'1 u32>`
2525
| |
26-
| has type `&'?4 Cell<&'2 &'?1 u32>`
26+
| has type `&'2 Cell<&'?5 &'?1 u32>`
2727
LL | // Only works if 'x: 'y:
2828
LL | demand_y(x, y, x.get())
2929
| ^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`

tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn demand_y<'x, 'y>(_cell_x: &Cell<&'x u32>, _cell_y: &Cell<&'y u32>, _y: &'y u3
3636

3737
#[rustc_regions]
3838
fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
39-
establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
39+
establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { //~ ERROR: lifetime may not live long enough
4040
// Only works if 'x: 'y:
4141
demand_y(x, y, x.get())
4242
//~^ ERROR

tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
note: no external requirements
1+
note: external requirements
22
--> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:39:47
33
|
44
LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
@@ -17,12 +17,16 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y
1717
= note: late-bound region is '?10
1818
= note: late-bound region is '?3
1919
= note: late-bound region is '?4
20+
= note: number of external vids: 5
21+
= note: where '?1: '?2
22+
= note: where '?1: '?2
23+
= note: where '?1: '?2
2024

2125
error: lifetime may not live long enough
2226
--> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:41:9
2327
|
2428
LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
25-
| ---------- ---------- has type `&'?7 Cell<&'2 &'?2 u32>`
29+
| ---------- ---------- has type `&'2 Cell<&'?8 &'?2 u32>`
2630
| |
2731
| has type `&'?5 Cell<&'1 &'?1 u32>`
2832
LL | // Only works if 'x: 'y:
@@ -41,5 +45,24 @@ LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
4145
|
4246
= note: defining type: supply
4347

44-
error: aborting due to 1 previous error
48+
error: lifetime may not live long enough
49+
--> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:39:5
50+
|
51+
LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
52+
| -- -- lifetime `'b` defined here
53+
| |
54+
| lifetime `'a` defined here
55+
LL | / establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
56+
LL | | // Only works if 'x: 'y:
57+
LL | | demand_y(x, y, x.get())
58+
LL | |
59+
LL | | });
60+
| |______^ argument requires that `'a` must outlive `'b`
61+
|
62+
= help: consider adding the following bound: `'a: 'b`
63+
= note: requirement occurs because of the type `Cell<&'?11 u32>`, which makes the generic argument `&'?11 u32` invariant
64+
= note: the struct `Cell<T>` is invariant over the parameter `T`
65+
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
66+
67+
error: aborting due to 2 previous errors
4568

0 commit comments

Comments
 (0)