-
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.
- Loading branch information
1 parent
ad214fe
commit d7c7c52
Showing
7 changed files
with
27 additions
and
146 deletions.
There are no files selected for viewing
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
85 changes: 13 additions & 72 deletions
85
src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.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 |
---|---|---|
@@ -1,88 +1,29 @@ | ||
error[E0106]: missing lifetime specifier | ||
error[E0623]: lifetime mismatch | ||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:10:45 | ||
| | ||
LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f } | ||
| ^ | ||
| | ||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple. | ||
|
||
error[E0106]: missing lifetime specifier | ||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:60 | ||
| | ||
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } | ||
| ^ | ||
| | ||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple. | ||
| ---- ^^^^ | ||
| | | | ||
| | ...but data from `f` is returned here | ||
| this parameter and the return type are declared with different lifetimes... | ||
|
||
error[E0106]: missing lifetime specifier | ||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:67 | ||
| | ||
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } | ||
| ^ | ||
| | ||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple. | ||
|
||
error: cannot infer an appropriate lifetime | ||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:10:33 | ||
| | ||
LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f } | ||
| ^ ---- this return type evaluates to the `'static` lifetime... | ||
| | | ||
| ...but this borrow... | ||
| | ||
note: ...can't outlive the lifetime '_ as defined on the method body at 10:26 | ||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:10:26 | ||
| | ||
LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f } | ||
| ^ | ||
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 10:26 | ||
| | ||
LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo + '_ { f } | ||
| ^^^^^^^^^ | ||
|
||
error: cannot infer an appropriate lifetime | ||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:16 | ||
| | ||
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } | ||
| ^^^^ ...but this borrow... ----------------- this return type evaluates to the `'static` lifetime... | ||
| | ||
note: ...can't outlive the lifetime '_ as defined on the method body at 15:26 | ||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:26 | ||
| | ||
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } | ||
| ^ | ||
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 15:26 | ||
| | ||
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) + '_ { (self, f) } | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: cannot infer an appropriate lifetime | ||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:34 | ||
| | ||
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } | ||
| ^ ----------------- this return type evaluates to the `'static` lifetime... | ||
| | | ||
| ...but this borrow... | ||
| | ||
note: ...can't outlive the lifetime '_ as defined on the method body at 15:26 | ||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:26 | ||
error[E0623]: lifetime mismatch | ||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:13:55 | ||
| | ||
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } | ||
| ^ | ||
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 15:26 | ||
| | ||
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) + '_ { (self, f) } | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
| ----- ^^^^^^^^^^^^^^^^^ | ||
| | | | ||
| | ...but data from `f` is returned here | ||
| this parameter and the return type are declared with different lifetimes... | ||
|
||
error[E0623]: lifetime mismatch | ||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:25:58 | ||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:19:58 | ||
| | ||
LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg } | ||
| ----- ^^^ | ||
| | | | ||
| | ...but data from `arg` is returned here | ||
| this parameter and the return type are declared with different lifetimes... | ||
|
||
error: aborting due to 7 previous errors | ||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0106`. |
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
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,20 +1,16 @@ | ||
// FIXME: Investigate why `self_lifetime.rs` is check-pass but this isn't. | ||
|
||
// check-pass | ||
// edition:2018 | ||
|
||
#![feature(async_await)] | ||
|
||
struct Foo<'a>(&'a ()); | ||
impl<'a> Foo<'a> { | ||
async fn foo<'b>(self: &'b Foo<'a>) -> &() { self.0 } | ||
//~^ ERROR missing lifetime specifier | ||
//~| ERROR cannot infer an appropriate lifetime | ||
} | ||
|
||
type Alias = Foo<'static>; | ||
impl Alias { | ||
async fn bar<'a>(self: &Alias, arg: &'a ()) -> &() { arg } | ||
//~^ ERROR lifetime mismatch | ||
} | ||
|
||
fn main() {} |
This file was deleted.
Oops, something went wrong.