1
Fork 0

bless tests

This commit is contained in:
Niko Matsakis 2019-08-12 21:13:59 -04:00
parent ad214fe470
commit d7c7c52dbc
7 changed files with 30 additions and 149 deletions

View file

@ -8,16 +8,10 @@ struct Foo;
impl Foo {
async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
// FIXME: should be E0623?
//~^ ERROR lifetime mismatch
async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
//~| ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
// FIXME: should be E0623?
//~^ ERROR lifetime mismatch
}
type Alias<T> = Pin<T>;

View file

@ -1,81 +1,23 @@
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.
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
|
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:13:55
|
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:19:58
|
LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
| ----- ^^^
@ -83,6 +25,5 @@ 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`.

View file

@ -8,7 +8,7 @@ LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes...
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:24:52
--> $DIR/ref-mut-self-async.rs:21:52
|
LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
| --------- ^^^^
@ -17,7 +17,7 @@ LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes...
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:28:61
--> $DIR/ref-mut-self-async.rs:25:61
|
LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
| --------- ^^^^
@ -26,7 +26,7 @@ LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes...
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:32:61
--> $DIR/ref-mut-self-async.rs:29:61
|
LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
| --------- ^^^^
@ -35,7 +35,7 @@ LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes...
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:36:70
--> $DIR/ref-mut-self-async.rs:33:70
|
LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
| --------- ^^^^
@ -44,7 +44,7 @@ LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes...
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:40:70
--> $DIR/ref-mut-self-async.rs:37:70
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
| --------- ^^^^

View file

@ -8,7 +8,7 @@ LL | async fn ref_self(&self, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes...
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:33:48
--> $DIR/ref-self-async.rs:30:48
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ----- ^^^^
@ -17,7 +17,7 @@ LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes...
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:37:57
--> $DIR/ref-self-async.rs:34:57
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ----- ^^^^
@ -26,7 +26,7 @@ LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes...
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:41:57
--> $DIR/ref-self-async.rs:38:57
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ----- ^^^^
@ -35,7 +35,7 @@ LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes...
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:45:66
--> $DIR/ref-self-async.rs:42:66
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ----- ^^^^
@ -44,7 +44,7 @@ LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes...
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:49:66
--> $DIR/ref-self-async.rs:46:66
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ----- ^^^^
@ -53,7 +53,7 @@ LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes...
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:53:69
--> $DIR/ref-self-async.rs:50:69
|
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
| ----- ^^^

View file

@ -1,11 +0,0 @@
error[E0106]: missing lifetime specifier
--> $DIR/self_lifetime-async.rs:9:44
|
LL | async fn foo<'b>(self: &'b Foo<'a>) -> &() { self.0 }
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found none.
error: aborting due to previous error
For more information about this error, try `rustc --explain E0106`.

View file

@ -1,5 +1,4 @@
// FIXME: Investigate why `self_lifetime.rs` is check-pass but this isn't.
// check-pass
// edition:2018
#![feature(async_await)]
@ -7,14 +6,11 @@
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() {}

View file

@ -1,39 +0,0 @@
error[E0106]: missing lifetime specifier
--> $DIR/self_lifetime-async.rs:9:44
|
LL | async fn foo<'b>(self: &'b Foo<'a>) -> &() { self.0 }
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found none.
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
--> $DIR/self_lifetime-async.rs:9:22
|
LL | async fn foo<'b>(self: &'b Foo<'a>) -> &() { self.0 }
| ^^^^
|
note: first, the lifetime cannot outlive the lifetime 'a as defined on the impl at 8:6...
--> $DIR/self_lifetime-async.rs:8:6
|
LL | impl<'a> Foo<'a> {
| ^^
= note: ...so that the expression is assignable:
expected &Foo<'_>
found &'b Foo<'a>
= note: but, the lifetime must be valid for the static lifetime...
= note: ...so that the types are compatible:
expected &()
found &'static ()
error[E0623]: lifetime mismatch
--> $DIR/self_lifetime-async.rs:16:52
|
LL | async fn bar<'a>(self: &Alias, 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 3 previous errors
For more information about this error, try `rustc --explain E0106`.