Skip to content

Commit 05f67a2

Browse files
committedJul 27, 2019
arbitrary_self_types lifetime elision: --bless --compare-mode=nll
1 parent 34f59eb commit 05f67a2

7 files changed

+342
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/arbitrary_self_types_pin_lifetime_impl_trait.rs:8:31
3+
|
4+
LL | fn f(self: Pin<&Self>) -> impl Clone { self }
5+
| - ^^^^^^^^^^ opaque type requires that `'1` must outlive `'static`
6+
| |
7+
| let's call the lifetime of this reference `'1`
8+
help: to allow this `impl Trait` to capture borrowed data with lifetime `'1`, add `'_` as a constraint
9+
|
10+
LL | fn f(self: Pin<&Self>) -> impl Clone + '_ { self }
11+
| ^^^^^^^^^^^^^^^
12+
13+
error: aborting due to previous error
14+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:8:46
3+
|
4+
LL | fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
5+
| - - ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
6+
| | |
7+
| | let's call the lifetime of this reference `'1`
8+
| let's call the lifetime of this reference `'2`
9+
10+
error: lifetime may not live long enough
11+
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:10:69
12+
|
13+
LL | fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
14+
| - - ^^^^^^^^^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
15+
| | |
16+
| | let's call the lifetime of this reference `'1`
17+
| let's call the lifetime of this reference `'2`
18+
19+
error: lifetime may not live long enough
20+
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:15:58
21+
|
22+
LL | fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
23+
| -- ---- has type `std::pin::Pin<&'1 Foo>` ^^^ function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a`
24+
| |
25+
| lifetime `'a` defined here
26+
27+
error: aborting due to 3 previous errors
28+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/lt-ref-self.rs:12:9
3+
|
4+
LL | fn ref_self(&self, f: &u32) -> &u32 {
5+
| - - let's call the lifetime of this reference `'1`
6+
| |
7+
| let's call the lifetime of this reference `'2`
8+
LL | f
9+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
10+
11+
error: lifetime may not live long enough
12+
--> $DIR/lt-ref-self.rs:18:9
13+
|
14+
LL | fn ref_Self(self: &Self, f: &u32) -> &u32 {
15+
| - - let's call the lifetime of this reference `'1`
16+
| |
17+
| let's call the lifetime of this reference `'2`
18+
LL | f
19+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
20+
21+
error: lifetime may not live long enough
22+
--> $DIR/lt-ref-self.rs:22:9
23+
|
24+
LL | fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
25+
| - - let's call the lifetime of this reference `'1`
26+
| |
27+
| let's call the lifetime of this reference `'2`
28+
LL | f
29+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
30+
31+
error: lifetime may not live long enough
32+
--> $DIR/lt-ref-self.rs:26:9
33+
|
34+
LL | fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
35+
| - - let's call the lifetime of this reference `'1`
36+
| |
37+
| let's call the lifetime of this reference `'2`
38+
LL | f
39+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
40+
41+
error: lifetime may not live long enough
42+
--> $DIR/lt-ref-self.rs:30:9
43+
|
44+
LL | fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
45+
| - - let's call the lifetime of this reference `'1`
46+
| |
47+
| let's call the lifetime of this reference `'2`
48+
LL | f
49+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
50+
51+
error: lifetime may not live long enough
52+
--> $DIR/lt-ref-self.rs:34:9
53+
|
54+
LL | fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
55+
| - - let's call the lifetime of this reference `'1`
56+
| |
57+
| let's call the lifetime of this reference `'2`
58+
LL | f
59+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
60+
61+
error: aborting due to 6 previous errors
62+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/ref-mut-self.rs:12:9
3+
|
4+
LL | fn ref_self(&mut self, f: &u32) -> &u32 {
5+
| - - let's call the lifetime of this reference `'1`
6+
| |
7+
| let's call the lifetime of this reference `'2`
8+
LL | f
9+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
10+
11+
error: lifetime may not live long enough
12+
--> $DIR/ref-mut-self.rs:18:9
13+
|
14+
LL | fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
15+
| - - let's call the lifetime of this reference `'1`
16+
| |
17+
| let's call the lifetime of this reference `'2`
18+
LL | f
19+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
20+
21+
error: lifetime may not live long enough
22+
--> $DIR/ref-mut-self.rs:22:9
23+
|
24+
LL | fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
25+
| - - let's call the lifetime of this reference `'1`
26+
| |
27+
| let's call the lifetime of this reference `'2`
28+
LL | f
29+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
30+
31+
error: lifetime may not live long enough
32+
--> $DIR/ref-mut-self.rs:26:9
33+
|
34+
LL | fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
35+
| - - let's call the lifetime of this reference `'1`
36+
| |
37+
| let's call the lifetime of this reference `'2`
38+
LL | f
39+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
40+
41+
error: lifetime may not live long enough
42+
--> $DIR/ref-mut-self.rs:30:9
43+
|
44+
LL | fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
45+
| - - let's call the lifetime of this reference `'1`
46+
| |
47+
| let's call the lifetime of this reference `'2`
48+
LL | f
49+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
50+
51+
error: lifetime may not live long enough
52+
--> $DIR/ref-mut-self.rs:34:9
53+
|
54+
LL | fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
55+
| - - let's call the lifetime of this reference `'1`
56+
| |
57+
| let's call the lifetime of this reference `'2`
58+
LL | f
59+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
60+
61+
error: aborting due to 6 previous errors
62+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/ref-mut-struct.rs:12:9
3+
|
4+
LL | fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
5+
| - - let's call the lifetime of this reference `'1`
6+
| |
7+
| let's call the lifetime of this reference `'2`
8+
LL | f
9+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
10+
11+
error: lifetime may not live long enough
12+
--> $DIR/ref-mut-struct.rs:16:9
13+
|
14+
LL | fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
15+
| - - let's call the lifetime of this reference `'1`
16+
| |
17+
| let's call the lifetime of this reference `'2`
18+
LL | f
19+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
20+
21+
error: lifetime may not live long enough
22+
--> $DIR/ref-mut-struct.rs:20:9
23+
|
24+
LL | fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
25+
| - - let's call the lifetime of this reference `'1`
26+
| |
27+
| let's call the lifetime of this reference `'2`
28+
LL | f
29+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
30+
31+
error: lifetime may not live long enough
32+
--> $DIR/ref-mut-struct.rs:24:9
33+
|
34+
LL | fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
35+
| - - let's call the lifetime of this reference `'1`
36+
| |
37+
| let's call the lifetime of this reference `'2`
38+
LL | f
39+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
40+
41+
error: lifetime may not live long enough
42+
--> $DIR/ref-mut-struct.rs:28:9
43+
|
44+
LL | fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
45+
| - - let's call the lifetime of this reference `'1`
46+
| |
47+
| let's call the lifetime of this reference `'2`
48+
LL | f
49+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
50+
51+
error: aborting due to 5 previous errors
52+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/ref-self.rs:21:9
3+
|
4+
LL | fn ref_self(&self, f: &u32) -> &u32 {
5+
| - - let's call the lifetime of this reference `'1`
6+
| |
7+
| let's call the lifetime of this reference `'2`
8+
LL | f
9+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
10+
11+
error: lifetime may not live long enough
12+
--> $DIR/ref-self.rs:27:9
13+
|
14+
LL | fn ref_Self(self: &Self, f: &u32) -> &u32 {
15+
| - - let's call the lifetime of this reference `'1`
16+
| |
17+
| let's call the lifetime of this reference `'2`
18+
LL | f
19+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
20+
21+
error: lifetime may not live long enough
22+
--> $DIR/ref-self.rs:31:9
23+
|
24+
LL | fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
25+
| - - let's call the lifetime of this reference `'1`
26+
| |
27+
| let's call the lifetime of this reference `'2`
28+
LL | f
29+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
30+
31+
error: lifetime may not live long enough
32+
--> $DIR/ref-self.rs:35:9
33+
|
34+
LL | fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
35+
| - - let's call the lifetime of this reference `'1`
36+
| |
37+
| let's call the lifetime of this reference `'2`
38+
LL | f
39+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
40+
41+
error: lifetime may not live long enough
42+
--> $DIR/ref-self.rs:39:9
43+
|
44+
LL | fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
45+
| - - let's call the lifetime of this reference `'1`
46+
| |
47+
| let's call the lifetime of this reference `'2`
48+
LL | f
49+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
50+
51+
error: lifetime may not live long enough
52+
--> $DIR/ref-self.rs:43:9
53+
|
54+
LL | fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
55+
| - - let's call the lifetime of this reference `'1`
56+
| |
57+
| let's call the lifetime of this reference `'2`
58+
LL | f
59+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
60+
61+
error: lifetime may not live long enough
62+
--> $DIR/ref-self.rs:47:9
63+
|
64+
LL | fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
65+
| - - let's call the lifetime of this reference `'1`
66+
| |
67+
| let's call the lifetime of this reference `'2`
68+
LL | f
69+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
70+
71+
error: aborting due to 7 previous errors
72+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/ref-struct.rs:12:9
3+
|
4+
LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
5+
| - - let's call the lifetime of this reference `'1`
6+
| |
7+
| let's call the lifetime of this reference `'2`
8+
LL | f
9+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
10+
11+
error: lifetime may not live long enough
12+
--> $DIR/ref-struct.rs:16:9
13+
|
14+
LL | fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
15+
| - - let's call the lifetime of this reference `'1`
16+
| |
17+
| let's call the lifetime of this reference `'2`
18+
LL | f
19+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
20+
21+
error: lifetime may not live long enough
22+
--> $DIR/ref-struct.rs:20:9
23+
|
24+
LL | fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
25+
| - - let's call the lifetime of this reference `'1`
26+
| |
27+
| let's call the lifetime of this reference `'2`
28+
LL | f
29+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
30+
31+
error: lifetime may not live long enough
32+
--> $DIR/ref-struct.rs:24:9
33+
|
34+
LL | fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
35+
| - - let's call the lifetime of this reference `'1`
36+
| |
37+
| let's call the lifetime of this reference `'2`
38+
LL | f
39+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
40+
41+
error: lifetime may not live long enough
42+
--> $DIR/ref-struct.rs:28:9
43+
|
44+
LL | fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
45+
| - - let's call the lifetime of this reference `'1`
46+
| |
47+
| let's call the lifetime of this reference `'2`
48+
LL | f
49+
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
50+
51+
error: aborting due to 5 previous errors
52+

0 commit comments

Comments
 (0)
Please sign in to comment.