-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
arbitrary_self_types lifetime elision: --bless --compare-mode=nll.
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.nll.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error: lifetime may not live long enough | ||
--> $DIR/arbitrary_self_types_pin_lifetime_impl_trait.rs:8:31 | ||
| | ||
LL | fn f(self: Pin<&Self>) -> impl Clone { self } | ||
| - ^^^^^^^^^^ opaque type requires that `'1` must outlive `'static` | ||
| | | ||
| let's call the lifetime of this reference `'1` | ||
help: to allow this impl Trait to capture borrowed data with lifetime `'1`, add `'_` as a constraint | ||
| | ||
LL | fn f(self: Pin<&Self>) -> impl Clone + '_ { self } | ||
| ^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
28 changes: 28 additions & 0 deletions
28
src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch.nll.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
error: lifetime may not live long enough | ||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:8:46 | ||
| | ||
LL | fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f } | ||
| - - ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ||
| | | | ||
| | let's call the lifetime of this reference `'1` | ||
| let's call the lifetime of this reference `'2` | ||
|
||
error: lifetime may not live long enough | ||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:10:69 | ||
| | ||
LL | fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } | ||
| - - ^^^^^^^^^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ||
| | | | ||
| | let's call the lifetime of this reference `'1` | ||
| let's call the lifetime of this reference `'2` | ||
|
||
error: lifetime may not live long enough | ||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:15:58 | ||
| | ||
LL | fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg } | ||
| -- ---- has type `std::pin::Pin<&'1 Foo>` ^^^ function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a` | ||
| | | ||
| lifetime `'a` defined here | ||
|
||
error: aborting due to 3 previous errors | ||
|