Skip to content

Commit b1211e8

Browse files
committed
Fix tests
1 parent 5390cf3 commit b1211e8

31 files changed

+194
-91
lines changed

src/test/mir-opt/nll/named-lifetimes-basic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn main() {
3434
// | '_#4r | Local | ['_#4r]
3535
// |
3636
// | Inferred Region Values
37-
// | '_#0r | U0 | {bb0[0..=1], '_#0r}
37+
// | '_#0r | U0 | {bb0[0..=1], '_#0r, '_#1r, '_#2r, '_#3r, '_#4r}
3838
// | '_#1r | U0 | {bb0[0..=1], '_#1r}
3939
// | '_#2r | U0 | {bb0[0..=1], '_#2r}
4040
// | '_#3r | U0 | {bb0[0..=1], '_#3r}

src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr

+11-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,15 @@ LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
66
LL | bar(foo, x) //[transmute]~ ERROR E0495
77
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
88

9-
error: aborting due to previous error
9+
error: unsatisfied lifetime constraints
10+
--> $DIR/project-fn-ret-contravariant.rs:48:4
11+
|
12+
LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
13+
| -- -- lifetime `'b` defined here
14+
| |
15+
| lifetime `'a` defined here
16+
LL | bar(foo, x) //[transmute]~ ERROR E0495
17+
| ^^^^^^^^^^^ requires that `'a` must outlive `'b`
18+
19+
error: aborting due to 2 previous errors
1020

src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr

+12-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,16 @@ LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
77
LL | bar(foo, x) //[transmute]~ ERROR E0495
88
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
99

10-
error: aborting due to previous error
10+
error: unsatisfied lifetime constraints
11+
--> $DIR/project-fn-ret-invariant.rs:58:13
12+
|
13+
LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
14+
| -- -- lifetime `'b` defined here
15+
| |
16+
| lifetime `'a` defined here
17+
...
18+
LL | bar(foo, x) //[transmute]~ ERROR E0495
19+
| ^ requires that `'a` must outlive `'b`
20+
21+
error: aborting due to 2 previous errors
1122

src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ error: unsatisfied lifetime constraints
44
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
55
| - let's call the lifetime of this reference `'1`
66
LL | self.x.iter().map(|a| a.0)
7-
| ^^^^^^^^^^^^^ requires that `'1` must outlive `'static`
7+
| ^^^^^^ cast requires that `'1` must outlive `'static`
88

99
error: unsatisfied lifetime constraints
1010
--> $DIR/static-return-lifetime-infered.rs:21:9
1111
|
1212
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
1313
| -- lifetime `'a` defined here
1414
LL | self.x.iter().map(|a| a.0)
15-
| ^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
15+
| ^^^^^^ cast requires that `'a` must outlive `'static`
1616

1717
error: aborting due to 2 previous errors
1818

src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ fn demand_y<'x, 'y>(_cell_x: &Cell<&'x u32>, _cell_y: &Cell<&'y u32>, _y: &'y u3
4343
#[rustc_regions]
4444
fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
4545
establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
46-
//~^ ERROR
46+
//~^ ERROR borrowed data escapes outside of function
47+
//~| ERROR unsatisfied lifetime constraints
4748

4849
// Only works if 'x: 'y:
4950
demand_y(x, y, x.get())

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

+17-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ note: External requirements
33
|
44
LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
55
| _______________________________________________^
6-
LL | | //~^ ERROR
6+
LL | | //~^ ERROR borrowed data escapes outside of function
7+
LL | | //~| ERROR unsatisfied lifetime constraints
78
LL | |
89
LL | | // Only works if 'x: 'y:
910
LL | | demand_y(x, y, x.get())
@@ -22,8 +23,8 @@ note: No external requirements
2223
|
2324
LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
2425
LL | | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
25-
LL | | //~^ ERROR
26-
LL | |
26+
LL | | //~^ ERROR borrowed data escapes outside of function
27+
LL | | //~| ERROR unsatisfied lifetime constraints
2728
... |
2829
LL | | });
2930
LL | | }
@@ -37,12 +38,23 @@ error: borrowed data escapes outside of function
3738
LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
3839
| ------ `cell_a` is a reference that is only valid in the function body
3940
LL | / establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
40-
LL | | //~^ ERROR
41+
LL | | //~^ ERROR borrowed data escapes outside of function
42+
LL | | //~| ERROR unsatisfied lifetime constraints
4143
LL | |
4244
LL | | // Only works if 'x: 'y:
4345
LL | | demand_y(x, y, x.get())
4446
LL | | });
4547
| |______^ `cell_a` escapes the function body here
4648

47-
error: aborting due to previous error
49+
error: unsatisfied lifetime constraints
50+
--> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:45:29
51+
|
52+
LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
53+
| -- -- lifetime `'b` defined here
54+
| |
55+
| lifetime `'a` defined here
56+
LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
57+
| ^^^^^^^ requires that `'a` must outlive `'b`
58+
59+
error: aborting due to 2 previous errors
4860

src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ fn demand_y<'x, 'y>(_cell_x: &Cell<&'x u32>, _cell_y: &Cell<&'y u32>, _y: &'y u3
4646
#[rustc_regions]
4747
fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
4848
establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
49-
//~^ ERROR
49+
//~^ ERROR borrowed data escapes outside of function
50+
//~| ERROR unsatisfied lifetime constraints
5051
// Only works if 'x: 'y:
5152
demand_y(x, y, x.get())
5253
});

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

+18-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ note: External requirements
33
|
44
LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
55
| _______________________________________________^
6-
LL | | //~^ ERROR
6+
LL | | //~^ ERROR borrowed data escapes outside of function
7+
LL | | //~| ERROR unsatisfied lifetime constraints
78
LL | | // Only works if 'x: 'y:
89
LL | | demand_y(x, y, x.get())
910
LL | | });
@@ -21,9 +22,9 @@ note: No external requirements
2122
|
2223
LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
2324
LL | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
24-
LL | | //~^ ERROR
25-
LL | | // Only works if 'x: 'y:
26-
LL | | demand_y(x, y, x.get())
25+
LL | | //~^ ERROR borrowed data escapes outside of function
26+
LL | | //~| ERROR unsatisfied lifetime constraints
27+
... |
2728
LL | | });
2829
LL | | }
2930
| |_^
@@ -36,11 +37,22 @@ error: borrowed data escapes outside of function
3637
LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
3738
| ------ `cell_a` is a reference that is only valid in the function body
3839
LL | / establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
39-
LL | | //~^ ERROR
40+
LL | | //~^ ERROR borrowed data escapes outside of function
41+
LL | | //~| ERROR unsatisfied lifetime constraints
4042
LL | | // Only works if 'x: 'y:
4143
LL | | demand_y(x, y, x.get())
4244
LL | | });
4345
| |______^ `cell_a` escapes the function body here
4446

45-
error: aborting due to previous error
47+
error: unsatisfied lifetime constraints
48+
--> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:48:29
49+
|
50+
LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
51+
| -- -- lifetime `'b` defined here
52+
| |
53+
| lifetime `'a` defined here
54+
LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
55+
| ^^^^^^^ requires that `'a` must outlive `'b`
56+
57+
error: aborting due to 2 previous errors
4658

src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ LL | | });
1717
i32,
1818
extern "rust-call" fn((T,))
1919
]
20-
= note: number of external vids: 3
20+
= note: number of external vids: 2
2121
= note: where T: '_#1r
2222

2323
note: No external requirements

src/test/ui/nll/mir_check_cast_reify.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ fn bar<'a>(x: &'a u32) -> &'static u32 {
4444
// The MIR type checker must therefore relate `'?0` to `'?1` and `'?2`
4545
// as part of checking the `ReifyFnPointer`.
4646
let f: fn(_) -> _ = foo;
47+
//~^ ERROR unsatisfied lifetime constraints
4748
f(x)
48-
//~^ ERROR
4949
}
5050

5151
fn main() {}
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: unsatisfied lifetime constraints
2-
--> $DIR/mir_check_cast_reify.rs:47:5
2+
--> $DIR/mir_check_cast_reify.rs:46:25
33
|
44
LL | fn bar<'a>(x: &'a u32) -> &'static u32 {
55
| -- lifetime `'a` defined here
66
...
7-
LL | f(x)
8-
| ^^^^ returning this value requires that `'a` must outlive `'static`
7+
LL | let f: fn(_) -> _ = foo;
8+
| ^^^ cast requires that `'a` must outlive `'static`
99

1010
error: aborting due to previous error
1111

src/test/ui/nll/mir_check_cast_unsafe_fn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 {
1616
// Here the NLL checker must relate the types in `f` to the types
1717
// in `g`. These are related via the `UnsafeFnPointer` cast.
1818
let g: unsafe fn(_) -> _ = f;
19+
//~^ ERROR unsatisfied lifetime constraints
1920
unsafe { g(input) }
20-
//~^ ERROR
2121
}
2222

2323
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: unsatisfied lifetime constraints
2-
--> $DIR/mir_check_cast_unsafe_fn.rs:19:14
2+
--> $DIR/mir_check_cast_unsafe_fn.rs:18:32
33
|
44
LL | fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 {
55
| -- lifetime `'a` defined here
66
...
7-
LL | unsafe { g(input) }
8-
| ^^^^^^^^ returning this value requires that `'a` must outlive `'static`
7+
LL | let g: unsafe fn(_) -> _ = f;
8+
| ^ cast requires that `'a` must outlive `'static`
99

1010
error: aborting due to previous error
1111

src/test/ui/nll/mir_check_cast_unsize.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: unsatisfied lifetime constraints
44
LL | fn bar<'a>(x: &'a u32) -> &'static dyn Debug {
55
| -- lifetime `'a` defined here
66
LL | x
7-
| ^ returning this value requires that `'a` must outlive `'static`
7+
| ^ cast requires that `'a` must outlive `'static`
88

99
error: aborting due to previous error
1010

src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ LL | with_signature(x, |mut y| Box::new(y.next()))
1010
i32,
1111
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#2r)>
1212
]
13-
= note: number of external vids: 4
13+
= note: number of external vids: 3
1414
= note: where <T as std::iter::Iterator>::Item: '_#2r
1515

1616
note: No external requirements
@@ -50,7 +50,7 @@ LL | with_signature(x, |mut y| Box::new(y.next()))
5050
i32,
5151
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#2r)>
5252
]
53-
= note: number of external vids: 4
53+
= note: number of external vids: 3
5454
= note: where <T as std::iter::Iterator>::Item: '_#2r
5555

5656
note: No external requirements
@@ -82,7 +82,7 @@ LL | with_signature(x, |mut y| Box::new(y.next()))
8282
i32,
8383
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#3r)>
8484
]
85-
= note: number of external vids: 5
85+
= note: number of external vids: 4
8686
= note: where <T as std::iter::Iterator>::Item: '_#3r
8787

8888
note: No external requirements
@@ -124,7 +124,7 @@ LL | with_signature(x, |mut y| Box::new(y.next()))
124124
i32,
125125
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#3r)>
126126
]
127-
= note: number of external vids: 5
127+
= note: number of external vids: 4
128128
= note: where <T as std::iter::Iterator>::Item: '_#3r
129129

130130
note: No external requirements

src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
1010
i32,
1111
extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T))
1212
]
13-
= note: number of external vids: 5
13+
= note: number of external vids: 4
1414
= note: where T: '_#2r
1515
= note: where '_#1r: '_#2r
1616

@@ -63,7 +63,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
6363
i32,
6464
extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T))
6565
]
66-
= note: number of external vids: 5
66+
= note: number of external vids: 4
6767
= note: where T: '_#3r
6868
= note: where '_#2r: '_#3r
6969

@@ -117,7 +117,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
117117
i32,
118118
extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T))
119119
]
120-
= note: number of external vids: 5
120+
= note: number of external vids: 4
121121
= note: where T: '_#3r
122122
= note: where '_#2r: '_#3r
123123

@@ -171,7 +171,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
171171
i32,
172172
extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T))
173173
]
174-
= note: number of external vids: 5
174+
= note: number of external vids: 4
175175
= note: where T: '_#3r
176176
= note: where '_#2r: '_#3r
177177

src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
1010
i32,
1111
extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T))
1212
]
13-
= note: number of external vids: 5
13+
= note: number of external vids: 4
1414
= note: where '_#1r: '_#2r
1515

1616
note: No external requirements
@@ -54,7 +54,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
5454
i32,
5555
extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T))
5656
]
57-
= note: number of external vids: 5
57+
= note: number of external vids: 4
5858
= note: where '_#2r: '_#3r
5959

6060
note: No external requirements
@@ -99,7 +99,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
9999
i32,
100100
extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T))
101101
]
102-
= note: number of external vids: 5
102+
= note: number of external vids: 4
103103
= note: where '_#2r: '_#3r
104104

105105
note: No external requirements
@@ -144,7 +144,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
144144
i32,
145145
extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T))
146146
]
147-
= note: number of external vids: 5
147+
= note: number of external vids: 4
148148
= note: where '_#2r: '_#3r
149149

150150
note: No external requirements
@@ -177,7 +177,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
177177
i32,
178178
extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T))
179179
]
180-
= note: number of external vids: 4
180+
= note: number of external vids: 3
181181
= note: where '_#1r: '_#2r
182182

183183
note: No external requirements

src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ where
4646
T: Anything<'b, 'c>,
4747
{
4848
with_signature(cell, t, |cell, t| require(cell, t));
49-
//~^ ERROR associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough
49+
//~^ ERROR associated type `<T as Anything<'_#5r, '_#6r>>::AssocType` may not live long enough
5050
}
5151

5252
#[rustc_regions]
@@ -56,7 +56,7 @@ where
5656
'a: 'a,
5757
{
5858
with_signature(cell, t, |cell, t| require(cell, t));
59-
//~^ ERROR associated type `<T as Anything<'_#7r, '_#8r>>::AssocType` may not live long enough
59+
//~^ ERROR associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough
6060
}
6161

6262
#[rustc_regions]
@@ -76,7 +76,7 @@ where
7676
// can do better here with a more involved verification step.
7777

7878
with_signature(cell, t, |cell, t| require(cell, t));
79-
//~^ ERROR associated type `<T as Anything<'_#7r, '_#8r>>::AssocType` may not live long enough
79+
//~^ ERROR associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough
8080
}
8181

8282
#[rustc_regions]
@@ -103,7 +103,7 @@ where
103103
T: Anything<'b, 'b>,
104104
{
105105
with_signature(cell, t, |cell, t| require(cell, t));
106-
//~^ ERROR
106+
//~^ ERROR unsatisfied lifetime constraints
107107
}
108108

109109
#[rustc_regions]

0 commit comments

Comments
 (0)