Skip to content

Commit 871ee6c

Browse files
committed
Update tests
1 parent a2a6d23 commit 871ee6c

13 files changed

+124
-231
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
2-
--> $DIR/issue-63388-1.rs:12:10
3-
|
4-
LL | ) -> &dyn Foo
5-
| ^^^^^^^^
6-
|
7-
= note: hidden type `impl std::future::Future` captures lifetime '_#22r
8-
91
error: lifetime may not live long enough
102
--> $DIR/issue-63388-1.rs:13:5
113
|
@@ -19,6 +11,5 @@ LL | | foo
1911
LL | | }
2012
| |_____^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
2113

22-
error: aborting due to 2 previous errors
14+
error: aborting due to previous error
2315

24-
For more information about this error, try `rustc --explain E0700`.

src/test/ui/impl-trait/auto-trait-leak.stderr

+60-10
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ note: ...which requires processing `cycle2::{{opaque}}#0`...
4141
LL | fn cycle2() -> impl Clone {
4242
| ^^^^^^^^^^
4343
note: ...which requires borrow-checking `cycle2`...
44-
--> $DIR/auto-trait-leak.rs:21:1
44+
--> $DIR/auto-trait-leak.rs:22:1
4545
|
4646
LL | fn cycle2() -> impl Clone {
4747
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -51,22 +51,22 @@ note: ...which requires processing `cycle2`...
5151
LL | fn cycle2() -> impl Clone {
5252
| ^^^^^^^^^^^^^^^^^^^^^^^^^
5353
note: ...which requires processing `cycle2`...
54-
--> $DIR/auto-trait-leak.rs:21:1
54+
--> $DIR/auto-trait-leak.rs:22:1
5555
|
5656
LL | fn cycle2() -> impl Clone {
5757
| ^^^^^^^^^^^^^^^^^^^^^^^^^
5858
note: ...which requires unsafety-checking `cycle2`...
59-
--> $DIR/auto-trait-leak.rs:21:1
59+
--> $DIR/auto-trait-leak.rs:22:1
6060
|
6161
LL | fn cycle2() -> impl Clone {
6262
| ^^^^^^^^^^^^^^^^^^^^^^^^^
6363
note: ...which requires building MIR for...
64-
--> $DIR/auto-trait-leak.rs:21:1
64+
--> $DIR/auto-trait-leak.rs:22:1
6565
|
6666
LL | fn cycle2() -> impl Clone {
6767
| ^^^^^^^^^^^^^^^^^^^^^^^^^
6868
note: ...which requires type-checking `cycle2`...
69-
--> $DIR/auto-trait-leak.rs:21:1
69+
--> $DIR/auto-trait-leak.rs:22:1
7070
|
7171
LL | fn cycle2() -> impl Clone {
7272
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -127,13 +127,33 @@ note: ...which requires processing `cycle2::{{opaque}}#0`...
127127
LL | fn cycle2() -> impl Clone {
128128
| ^^^^^^^^^^
129129
note: ...which requires borrow-checking `cycle2`...
130-
--> $DIR/auto-trait-leak.rs:21:1
130+
--> $DIR/auto-trait-leak.rs:22:1
131131
|
132132
LL | fn cycle2() -> impl Clone {
133133
| ^^^^^^^^^^^^^^^^^^^^^^^^^
134134
note: ...which requires processing `cycle2`...
135135
--> $DIR/auto-trait-leak.rs:22:1
136136
|
137+
LL | fn cycle2() -> impl Clone {
138+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
139+
note: ...which requires processing `cycle2`...
140+
--> $DIR/auto-trait-leak.rs:22:1
141+
|
142+
LL | fn cycle2() -> impl Clone {
143+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
144+
note: ...which requires unsafety-checking `cycle2`...
145+
--> $DIR/auto-trait-leak.rs:22:1
146+
|
147+
LL | fn cycle2() -> impl Clone {
148+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
149+
note: ...which requires building MIR for...
150+
--> $DIR/auto-trait-leak.rs:22:1
151+
|
152+
LL | fn cycle2() -> impl Clone {
153+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
154+
note: ...which requires type-checking `cycle2`...
155+
--> $DIR/auto-trait-leak.rs:22:1
156+
|
137157
LL | fn cycle2() -> impl Clone {
138158
| ^^^^^^^^^^^^^^^^^^^^^^^^^
139159
= note: ...which again requires processing `cycle1::{{opaque}}#0`, completing the cycle
@@ -155,9 +175,34 @@ error[E0391]: cycle detected when processing `cycle1::{{opaque}}#0`
155175
LL | fn cycle1() -> impl Clone {
156176
| ^^^^^^^^^^
157177
|
178+
note: ...which requires borrow-checking `cycle1`...
179+
--> $DIR/auto-trait-leak.rs:12:1
180+
|
181+
LL | fn cycle1() -> impl Clone {
182+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
183+
note: ...which requires processing `cycle1`...
184+
--> $DIR/auto-trait-leak.rs:12:1
185+
|
186+
LL | fn cycle1() -> impl Clone {
187+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
158188
note: ...which requires processing `cycle1`...
159189
--> $DIR/auto-trait-leak.rs:12:1
160190
|
191+
LL | fn cycle1() -> impl Clone {
192+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
193+
note: ...which requires unsafety-checking `cycle1`...
194+
--> $DIR/auto-trait-leak.rs:12:1
195+
|
196+
LL | fn cycle1() -> impl Clone {
197+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
198+
note: ...which requires building MIR for...
199+
--> $DIR/auto-trait-leak.rs:12:1
200+
|
201+
LL | fn cycle1() -> impl Clone {
202+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
203+
note: ...which requires type-checking `cycle1`...
204+
--> $DIR/auto-trait-leak.rs:12:1
205+
|
161206
LL | fn cycle1() -> impl Clone {
162207
| ^^^^^^^^^^^^^^^^^^^^^^^^^
163208
= note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
@@ -166,28 +211,33 @@ note: ...which requires processing `cycle2::{{opaque}}#0`...
166211
|
167212
LL | fn cycle2() -> impl Clone {
168213
| ^^^^^^^^^^
214+
note: ...which requires borrow-checking `cycle2`...
215+
--> $DIR/auto-trait-leak.rs:22:1
216+
|
217+
LL | fn cycle2() -> impl Clone {
218+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
169219
note: ...which requires processing `cycle2`...
170220
--> $DIR/auto-trait-leak.rs:22:1
171221
|
172222
LL | fn cycle2() -> impl Clone {
173223
| ^^^^^^^^^^^^^^^^^^^^^^^^^
174224
note: ...which requires processing `cycle2`...
175-
--> $DIR/auto-trait-leak.rs:21:1
225+
--> $DIR/auto-trait-leak.rs:22:1
176226
|
177227
LL | fn cycle2() -> impl Clone {
178228
| ^^^^^^^^^^^^^^^^^^^^^^^^^
179229
note: ...which requires unsafety-checking `cycle2`...
180-
--> $DIR/auto-trait-leak.rs:21:1
230+
--> $DIR/auto-trait-leak.rs:22:1
181231
|
182232
LL | fn cycle2() -> impl Clone {
183233
| ^^^^^^^^^^^^^^^^^^^^^^^^^
184234
note: ...which requires building MIR for...
185-
--> $DIR/auto-trait-leak.rs:21:1
235+
--> $DIR/auto-trait-leak.rs:22:1
186236
|
187237
LL | fn cycle2() -> impl Clone {
188238
| ^^^^^^^^^^^^^^^^^^^^^^^^^
189239
note: ...which requires type-checking `cycle2`...
190-
--> $DIR/auto-trait-leak.rs:21:1
240+
--> $DIR/auto-trait-leak.rs:22:1
191241
|
192242
LL | fn cycle2() -> impl Clone {
193243
| ^^^^^^^^^^^^^^^^^^^^^^^^^
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// compile-flags:-Zborrowck=mir
2+
3+
#![feature(member_constraints)]
4+
#![feature(type_alias_impl_trait)]
5+
6+
#[derive(Clone)]
7+
struct CopyIfEq<T, U>(T, U);
8+
9+
impl<T: Copy> Copy for CopyIfEq<T, T> {}
10+
11+
type E<'a, 'b> = impl Sized;
12+
13+
fn foo<'a: 'b, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
14+
//~^ ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds
15+
let v = CopyIfEq::<*mut _, *mut _>(&mut { x }, &mut y);
16+
17+
// This assignment requires that `x` and `y` have the same type due to the
18+
// `Copy` impl. The reason why we are using a copy to create a constraint
19+
// is that only borrow checking (not regionck in type checking) enforces
20+
// this bound.
21+
let u = v;
22+
let _: *mut &'a i32 = u.1;
23+
unsafe {
24+
let _: &'b i32 = *u.0;
25+
}
26+
u.0
27+
}
28+
29+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
2+
--> $DIR/error-handling-2.rs:13:60
3+
|
4+
LL | fn foo<'a: 'b, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
5+
| ^^^^^^^^^
6+
|
7+
note: hidden type `*mut &'a i32` captures the lifetime `'a` as defined on the function body at 13:8
8+
--> $DIR/error-handling-2.rs:13:8
9+
|
10+
LL | fn foo<'a: 'b, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
11+
| ^^
12+
13+
error: aborting due to previous error
14+
15+
For more information about this error, try `rustc --explain E0700`.

src/test/ui/impl-trait/multiple-lifetimes/error-handling.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ impl<T: Copy> Copy for CopyIfEq<T, T> {}
1111
type E<'a, 'b> = impl Sized;
1212

1313
fn foo<'a, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
14-
//~^ ERROR lifetime may not live long enough
1514
let v = CopyIfEq::<*mut _, *mut _>(&mut { x }, &mut y);
1615

1716
// This assignment requires that `x` and `y` have the same type due to the
@@ -22,6 +21,7 @@ fn foo<'a, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
2221
let _: *mut &'a i32 = u.1;
2322
unsafe {
2423
let _: &'b i32 = *u.0;
24+
//~^ ERROR lifetime may not live long enough
2525
}
2626
u.0
2727
}
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
error: lifetime may not live long enough
2-
--> $DIR/error-handling.rs:13:56
2+
--> $DIR/error-handling.rs:23:16
33
|
44
LL | fn foo<'a, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
5-
| -- lifetime `'a` defined here ^^^^^^^^^ opaque type requires that `'a` must outlive `'static`
6-
|
7-
= help: consider replacing `'a` with `'static`
8-
help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a bound
9-
|
10-
LL | type E<'a, 'b> = impl Sized + 'a;
11-
|
5+
| -- -- lifetime `'b` defined here
6+
| |
7+
| lifetime `'a` defined here
8+
...
9+
LL | let _: &'b i32 = *u.0;
10+
| ^^^^^^^ type annotation requires that `'a` must outlive `'b`
11+
|
12+
= help: consider adding the following bound: `'a: 'b`
1213

1314
error: aborting due to previous error
1415

src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.nll.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea
33
|
44
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e>
55
| ^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: hidden type `Ordinary<'_>` captures lifetime '_#8r
68

79
error: aborting due to previous error
810

src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.nll.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea
33
|
44
LL | fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b>
55
| ^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: hidden type `Ordinary<'_>` captures lifetime '_#5r
68

79
error: aborting due to previous error
810

Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
2-
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:8:45
3-
|
4-
LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
5-
| ^^^^
6-
|
7-
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
8-
91
error: lifetime may not live long enough
102
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:8:52
113
|
@@ -24,14 +16,6 @@ LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (
2416
| | let's call the lifetime of this reference `'1`
2517
| let's call the lifetime of this reference `'2`
2618

27-
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
28-
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:17:58
29-
|
30-
LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
31-
| ^^^
32-
|
33-
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
34-
3519
error: lifetime may not live long enough
3620
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:17:64
3721
|
@@ -41,6 +25,5 @@ LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
4125
| | let's call the lifetime of this reference `'1`
4226
| lifetime `'a` defined here
4327

44-
error: aborting due to 5 previous errors
28+
error: aborting due to 3 previous errors
4529

46-
For more information about this error, try `rustc --explain E0700`.
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
2-
--> $DIR/lt-ref-self-async.rs:12:42
3-
|
4-
LL | async fn ref_self(&self, f: &u32) -> &u32 {
5-
| ^^^^
6-
|
7-
= note: hidden type `impl std::future::Future` captures lifetime '_#23r
8-
91
error: lifetime may not live long enough
102
--> $DIR/lt-ref-self-async.rs:13:9
113
|
@@ -16,14 +8,6 @@ LL | async fn ref_self(&self, f: &u32) -> &u32 {
168
LL | f
179
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
1810

19-
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
20-
--> $DIR/lt-ref-self-async.rs:18:48
21-
|
22-
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
23-
| ^^^^
24-
|
25-
= note: hidden type `impl std::future::Future` captures lifetime '_#23r
26-
2711
error: lifetime may not live long enough
2812
--> $DIR/lt-ref-self-async.rs:19:9
2913
|
@@ -34,14 +18,6 @@ LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
3418
LL | f
3519
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
3620

37-
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
38-
--> $DIR/lt-ref-self-async.rs:22:57
39-
|
40-
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
41-
| ^^^^
42-
|
43-
= note: hidden type `impl std::future::Future` captures lifetime '_#23r
44-
4521
error: lifetime may not live long enough
4622
--> $DIR/lt-ref-self-async.rs:23:9
4723
|
@@ -52,14 +28,6 @@ LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
5228
LL | f
5329
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
5430

55-
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
56-
--> $DIR/lt-ref-self-async.rs:26:57
57-
|
58-
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
59-
| ^^^^
60-
|
61-
= note: hidden type `impl std::future::Future` captures lifetime '_#23r
62-
6331
error: lifetime may not live long enough
6432
--> $DIR/lt-ref-self-async.rs:27:9
6533
|
@@ -70,14 +38,6 @@ LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
7038
LL | f
7139
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
7240

73-
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
74-
--> $DIR/lt-ref-self-async.rs:30:66
75-
|
76-
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
77-
| ^^^^
78-
|
79-
= note: hidden type `impl std::future::Future` captures lifetime '_#23r
80-
8141
error: lifetime may not live long enough
8242
--> $DIR/lt-ref-self-async.rs:31:9
8343
|
@@ -88,14 +48,6 @@ LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
8848
LL | f
8949
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
9050

91-
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
92-
--> $DIR/lt-ref-self-async.rs:34:62
93-
|
94-
LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
95-
| ^^^^
96-
|
97-
= note: hidden type `impl std::future::Future` captures lifetime '_#23r
98-
9951
error: lifetime may not live long enough
10052
--> $DIR/lt-ref-self-async.rs:35:9
10153
|
@@ -106,6 +58,5 @@ LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
10658
LL | f
10759
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
10860

109-
error: aborting due to 12 previous errors
61+
error: aborting due to 6 previous errors
11062

111-
For more information about this error, try `rustc --explain E0700`.

0 commit comments

Comments
 (0)