Skip to content

Commit 83dc1b5

Browse files
committed
arbitrary_self_types lifetime elision: --bless --compare-mode=nll.
1 parent cef33d4 commit 83dc1b5

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-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+

0 commit comments

Comments
 (0)