lifetime elision: add non-conforming-to-fn tests.
This commit is contained in:
parent
43a2cbdfd3
commit
a69478242d
27 changed files with 2195 additions and 0 deletions
51
src/test/ui/self/elision/lt-ref-self-async.nll.stderr
Normal file
51
src/test/ui/self/elision/lt-ref-self-async.nll.stderr
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/lt-ref-self-async.rs:15:42
|
||||
|
|
||||
LL | async fn ref_self(&self, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/lt-ref-self-async.rs:23:48
|
||||
|
|
||||
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/lt-ref-self-async.rs:29:57
|
||||
|
|
||||
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/lt-ref-self-async.rs:35:57
|
||||
|
|
||||
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/lt-ref-self-async.rs:41:66
|
||||
|
|
||||
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/lt-ref-self-async.rs:47:62
|
||||
|
|
||||
LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
54
src/test/ui/self/elision/lt-ref-self-async.rs
Normal file
54
src/test/ui/self/elision/lt-ref-self-async.rs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
// edition:2018
|
||||
|
||||
#![feature(async_await)]
|
||||
|
||||
#![feature(arbitrary_self_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use std::pin::Pin;
|
||||
|
||||
struct Struct<'a> { data: &'a u32 }
|
||||
|
||||
impl<'a> Struct<'a> {
|
||||
// Test using `&self` sugar:
|
||||
|
||||
async fn ref_self(&self, f: &u32) -> &u32 {
|
||||
//~^ ERROR cannot infer an appropriate lifetime
|
||||
//~| ERROR missing lifetime specifier
|
||||
f
|
||||
}
|
||||
|
||||
// Test using `&Self` explicitly:
|
||||
|
||||
async fn ref_Self(self: &Self, f: &u32) -> &u32 {
|
||||
//~^ ERROR cannot infer an appropriate lifetime
|
||||
//~| ERROR missing lifetime specifier
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
|
||||
//~^ ERROR cannot infer an appropriate lifetime
|
||||
//~| ERROR missing lifetime specifier
|
||||
f
|
||||
}
|
||||
|
||||
async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
|
||||
//~^ ERROR cannot infer an appropriate lifetime
|
||||
//~| ERROR missing lifetime specifier
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
|
||||
//~^ ERROR cannot infer an appropriate lifetime
|
||||
//~| ERROR missing lifetime specifier
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
|
||||
//~^ ERROR cannot infer an appropriate lifetime
|
||||
//~| ERROR missing lifetime specifier
|
||||
f
|
||||
}
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
159
src/test/ui/self/elision/lt-ref-self-async.stderr
Normal file
159
src/test/ui/self/elision/lt-ref-self-async.stderr
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/lt-ref-self-async.rs:15:42
|
||||
|
|
||||
LL | async fn ref_self(&self, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/lt-ref-self-async.rs:23:48
|
||||
|
|
||||
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/lt-ref-self-async.rs:29:57
|
||||
|
|
||||
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/lt-ref-self-async.rs:35:57
|
||||
|
|
||||
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/lt-ref-self-async.rs:41:66
|
||||
|
|
||||
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/lt-ref-self-async.rs:47:62
|
||||
|
|
||||
LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/lt-ref-self-async.rs:15:30
|
||||
|
|
||||
LL | async fn ref_self(&self, f: &u32) -> &u32 {
|
||||
| ^ ---- 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:23
|
||||
--> $DIR/lt-ref-self-async.rs:15:23
|
||||
|
|
||||
LL | async fn ref_self(&self, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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:23
|
||||
|
|
||||
LL | async fn ref_self(&self, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/lt-ref-self-async.rs:23:36
|
||||
|
|
||||
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 23:29
|
||||
--> $DIR/lt-ref-self-async.rs:23:29
|
||||
|
|
||||
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 23:29
|
||||
|
|
||||
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/lt-ref-self-async.rs:29:45
|
||||
|
|
||||
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 29:37
|
||||
--> $DIR/lt-ref-self-async.rs:29:37
|
||||
|
|
||||
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 29:37
|
||||
|
|
||||
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/lt-ref-self-async.rs:35:45
|
||||
|
|
||||
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 35:37
|
||||
--> $DIR/lt-ref-self-async.rs:35:37
|
||||
|
|
||||
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 35:37
|
||||
|
|
||||
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/lt-ref-self-async.rs:41:54
|
||||
|
|
||||
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 41:45
|
||||
--> $DIR/lt-ref-self-async.rs:41:45
|
||||
|
|
||||
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 41:45
|
||||
|
|
||||
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/lt-ref-self-async.rs:47:50
|
||||
|
|
||||
LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 47:41
|
||||
--> $DIR/lt-ref-self-async.rs:47:41
|
||||
|
|
||||
LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 47:41
|
||||
|
|
||||
LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 12 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
43
src/test/ui/self/elision/multiple-ref-self-async.nll.stderr
Normal file
43
src/test/ui/self/elision/multiple-ref-self-async.nll.stderr
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/multiple-ref-self-async.rs:24:74
|
||||
|
|
||||
LL | async fn wrap_ref_Self_ref_Self(self: Wrap<&Self, &Self>, f: &u8) -> &u8 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/multiple-ref-self-async.rs:30:84
|
||||
|
|
||||
LL | async fn box_wrap_ref_Self_ref_Self(self: Box<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/multiple-ref-self-async.rs:36:84
|
||||
|
|
||||
LL | async fn pin_wrap_ref_Self_ref_Self(self: Pin<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/multiple-ref-self-async.rs:42:93
|
||||
|
|
||||
LL | async fn box_box_wrap_ref_Self_ref_Self(self: Box<Box<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/multiple-ref-self-async.rs:48:93
|
||||
|
|
||||
LL | async fn box_pin_wrap_ref_Self_ref_Self(self: Box<Pin<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
55
src/test/ui/self/elision/multiple-ref-self-async.rs
Normal file
55
src/test/ui/self/elision/multiple-ref-self-async.rs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
// edition:2018
|
||||
|
||||
#![feature(async_await)]
|
||||
|
||||
#![feature(arbitrary_self_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use std::marker::PhantomData;
|
||||
use std::ops::Deref;
|
||||
use std::pin::Pin;
|
||||
|
||||
struct Struct { }
|
||||
|
||||
struct Wrap<T, P>(T, PhantomData<P>);
|
||||
|
||||
impl<T, P> Deref for Wrap<T, P> {
|
||||
type Target = T;
|
||||
fn deref(&self) -> &T { &self.0 }
|
||||
}
|
||||
|
||||
impl Struct {
|
||||
// Test using multiple `&Self`:
|
||||
|
||||
async fn wrap_ref_Self_ref_Self(self: Wrap<&Self, &Self>, f: &u8) -> &u8 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_wrap_ref_Self_ref_Self(self: Box<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn pin_wrap_ref_Self_ref_Self(self: Pin<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_box_wrap_ref_Self_ref_Self(self: Box<Box<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_pin_wrap_ref_Self_ref_Self(self: Box<Pin<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
133
src/test/ui/self/elision/multiple-ref-self-async.stderr
Normal file
133
src/test/ui/self/elision/multiple-ref-self-async.stderr
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/multiple-ref-self-async.rs:24:74
|
||||
|
|
||||
LL | async fn wrap_ref_Self_ref_Self(self: Wrap<&Self, &Self>, f: &u8) -> &u8 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/multiple-ref-self-async.rs:30:84
|
||||
|
|
||||
LL | async fn box_wrap_ref_Self_ref_Self(self: Box<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/multiple-ref-self-async.rs:36:84
|
||||
|
|
||||
LL | async fn pin_wrap_ref_Self_ref_Self(self: Pin<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/multiple-ref-self-async.rs:42:93
|
||||
|
|
||||
LL | async fn box_box_wrap_ref_Self_ref_Self(self: Box<Box<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/multiple-ref-self-async.rs:48:93
|
||||
|
|
||||
LL | async fn box_pin_wrap_ref_Self_ref_Self(self: Box<Pin<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/multiple-ref-self-async.rs:24:63
|
||||
|
|
||||
LL | async fn wrap_ref_Self_ref_Self(self: Wrap<&Self, &Self>, f: &u8) -> &u8 {
|
||||
| ^ --- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 24:48
|
||||
--> $DIR/multiple-ref-self-async.rs:24:48
|
||||
|
|
||||
LL | async fn wrap_ref_Self_ref_Self(self: Wrap<&Self, &Self>, f: &u8) -> &u8 {
|
||||
| ^
|
||||
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 24:48
|
||||
|
|
||||
LL | async fn wrap_ref_Self_ref_Self(self: Wrap<&Self, &Self>, f: &u8) -> &u8 + '_ {
|
||||
| ^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/multiple-ref-self-async.rs:30:72
|
||||
|
|
||||
LL | async fn box_wrap_ref_Self_ref_Self(self: Box<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 30:56
|
||||
--> $DIR/multiple-ref-self-async.rs:30:56
|
||||
|
|
||||
LL | async fn box_wrap_ref_Self_ref_Self(self: Box<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 30:56
|
||||
|
|
||||
LL | async fn box_wrap_ref_Self_ref_Self(self: Box<Wrap<&Self, &Self>>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/multiple-ref-self-async.rs:36:72
|
||||
|
|
||||
LL | async fn pin_wrap_ref_Self_ref_Self(self: Pin<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 36:56
|
||||
--> $DIR/multiple-ref-self-async.rs:36:56
|
||||
|
|
||||
LL | async fn pin_wrap_ref_Self_ref_Self(self: Pin<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 36:56
|
||||
|
|
||||
LL | async fn pin_wrap_ref_Self_ref_Self(self: Pin<Wrap<&Self, &Self>>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/multiple-ref-self-async.rs:42:81
|
||||
|
|
||||
LL | async fn box_box_wrap_ref_Self_ref_Self(self: Box<Box<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 42:64
|
||||
--> $DIR/multiple-ref-self-async.rs:42:64
|
||||
|
|
||||
LL | async fn box_box_wrap_ref_Self_ref_Self(self: Box<Box<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 42:64
|
||||
|
|
||||
LL | async fn box_box_wrap_ref_Self_ref_Self(self: Box<Box<Wrap<&Self, &Self>>>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/multiple-ref-self-async.rs:48:81
|
||||
|
|
||||
LL | async fn box_pin_wrap_ref_Self_ref_Self(self: Box<Pin<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 48:64
|
||||
--> $DIR/multiple-ref-self-async.rs:48:64
|
||||
|
|
||||
LL | async fn box_pin_wrap_ref_Self_ref_Self(self: Box<Pin<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 48:64
|
||||
|
|
||||
LL | async fn box_pin_wrap_ref_Self_ref_Self(self: Box<Pin<Wrap<&Self, &Self>>>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
43
src/test/ui/self/elision/ref-alias-async.nll.stderr
Normal file
43
src/test/ui/self/elision/ref-alias-async.nll.stderr
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-alias-async.rs:20:50
|
||||
|
|
||||
LL | async fn ref_Alias(self: &Alias, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-alias-async.rs:26:59
|
||||
|
|
||||
LL | async fn box_ref_Alias(self: Box<&Alias>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-alias-async.rs:32:59
|
||||
|
|
||||
LL | async fn pin_ref_Alias(self: Pin<&Alias>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-alias-async.rs:38:68
|
||||
|
|
||||
LL | async fn box_box_ref_Alias(self: Box<Box<&Alias>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-alias-async.rs:44:68
|
||||
|
|
||||
LL | async fn box_pin_ref_Alias(self: Box<Pin<&Alias>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
51
src/test/ui/self/elision/ref-alias-async.rs
Normal file
51
src/test/ui/self/elision/ref-alias-async.rs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
// edition:2018
|
||||
|
||||
#![feature(async_await)]
|
||||
|
||||
#![feature(arbitrary_self_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use std::pin::Pin;
|
||||
|
||||
struct Struct { }
|
||||
|
||||
type Alias = Struct;
|
||||
|
||||
impl Struct {
|
||||
// Test using an alias for `Struct`:
|
||||
//
|
||||
// FIXME. We currently fail to recognize this as the self type, which
|
||||
// feels like a bug.
|
||||
|
||||
async fn ref_Alias(self: &Alias, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_ref_Alias(self: Box<&Alias>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn pin_ref_Alias(self: Pin<&Alias>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_box_ref_Alias(self: Box<Box<&Alias>>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_pin_ref_Alias(self: Box<Pin<&Alias>>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
133
src/test/ui/self/elision/ref-alias-async.stderr
Normal file
133
src/test/ui/self/elision/ref-alias-async.stderr
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-alias-async.rs:20:50
|
||||
|
|
||||
LL | async fn ref_Alias(self: &Alias, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-alias-async.rs:26:59
|
||||
|
|
||||
LL | async fn box_ref_Alias(self: Box<&Alias>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-alias-async.rs:32:59
|
||||
|
|
||||
LL | async fn pin_ref_Alias(self: Pin<&Alias>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-alias-async.rs:38:68
|
||||
|
|
||||
LL | async fn box_box_ref_Alias(self: Box<Box<&Alias>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-alias-async.rs:44:68
|
||||
|
|
||||
LL | async fn box_pin_ref_Alias(self: Box<Pin<&Alias>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-alias-async.rs:20:38
|
||||
|
|
||||
LL | async fn ref_Alias(self: &Alias, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 20:30
|
||||
--> $DIR/ref-alias-async.rs:20:30
|
||||
|
|
||||
LL | async fn ref_Alias(self: &Alias, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 20:30
|
||||
|
|
||||
LL | async fn ref_Alias(self: &Alias, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-alias-async.rs:26:47
|
||||
|
|
||||
LL | async fn box_ref_Alias(self: Box<&Alias>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 26:38
|
||||
--> $DIR/ref-alias-async.rs:26:38
|
||||
|
|
||||
LL | async fn box_ref_Alias(self: Box<&Alias>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 26:38
|
||||
|
|
||||
LL | async fn box_ref_Alias(self: Box<&Alias>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-alias-async.rs:32:47
|
||||
|
|
||||
LL | async fn pin_ref_Alias(self: Pin<&Alias>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 32:38
|
||||
--> $DIR/ref-alias-async.rs:32:38
|
||||
|
|
||||
LL | async fn pin_ref_Alias(self: Pin<&Alias>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 32:38
|
||||
|
|
||||
LL | async fn pin_ref_Alias(self: Pin<&Alias>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-alias-async.rs:38:56
|
||||
|
|
||||
LL | async fn box_box_ref_Alias(self: Box<Box<&Alias>>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 38:46
|
||||
--> $DIR/ref-alias-async.rs:38:46
|
||||
|
|
||||
LL | async fn box_box_ref_Alias(self: Box<Box<&Alias>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 38:46
|
||||
|
|
||||
LL | async fn box_box_ref_Alias(self: Box<Box<&Alias>>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-alias-async.rs:44:56
|
||||
|
|
||||
LL | async fn box_pin_ref_Alias(self: Box<Pin<&Alias>>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 44:46
|
||||
--> $DIR/ref-alias-async.rs:44:46
|
||||
|
|
||||
LL | async fn box_pin_ref_Alias(self: Box<Pin<&Alias>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 44:46
|
||||
|
|
||||
LL | async fn box_pin_ref_Alias(self: Box<Pin<&Alias>>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
43
src/test/ui/self/elision/ref-assoc-async.nll.stderr
Normal file
43
src/test/ui/self/elision/ref-assoc-async.nll.stderr
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-assoc-async.rs:21:77
|
||||
|
|
||||
LL | async fn ref_AssocType(self: &<Struct as Trait>::AssocType, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-assoc-async.rs:27:86
|
||||
|
|
||||
LL | async fn box_ref_AssocType(self: Box<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-assoc-async.rs:33:86
|
||||
|
|
||||
LL | async fn pin_ref_AssocType(self: Pin<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-assoc-async.rs:39:95
|
||||
|
|
||||
LL | async fn box_box_ref_AssocType(self: Box<Box<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-assoc-async.rs:45:95
|
||||
|
|
||||
LL | async fn box_pin_ref_AssocType(self: Box<Pin<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
52
src/test/ui/self/elision/ref-assoc-async.rs
Normal file
52
src/test/ui/self/elision/ref-assoc-async.rs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
// edition:2018
|
||||
|
||||
#![feature(async_await)]
|
||||
|
||||
#![feature(arbitrary_self_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use std::pin::Pin;
|
||||
|
||||
trait Trait {
|
||||
type AssocType;
|
||||
}
|
||||
|
||||
struct Struct { }
|
||||
|
||||
impl Trait for Struct {
|
||||
type AssocType = Self;
|
||||
}
|
||||
|
||||
impl Struct {
|
||||
async fn ref_AssocType(self: &<Struct as Trait>::AssocType, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_ref_AssocType(self: Box<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn pin_ref_AssocType(self: Pin<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_box_ref_AssocType(self: Box<Box<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_pin_ref_AssocType(self: Box<Pin<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
133
src/test/ui/self/elision/ref-assoc-async.stderr
Normal file
133
src/test/ui/self/elision/ref-assoc-async.stderr
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-assoc-async.rs:21:77
|
||||
|
|
||||
LL | async fn ref_AssocType(self: &<Struct as Trait>::AssocType, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-assoc-async.rs:27:86
|
||||
|
|
||||
LL | async fn box_ref_AssocType(self: Box<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-assoc-async.rs:33:86
|
||||
|
|
||||
LL | async fn pin_ref_AssocType(self: Pin<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-assoc-async.rs:39:95
|
||||
|
|
||||
LL | async fn box_box_ref_AssocType(self: Box<Box<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-assoc-async.rs:45:95
|
||||
|
|
||||
LL | async fn box_pin_ref_AssocType(self: Box<Pin<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-assoc-async.rs:21:65
|
||||
|
|
||||
LL | async fn ref_AssocType(self: &<Struct as Trait>::AssocType, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 21:34
|
||||
--> $DIR/ref-assoc-async.rs:21:34
|
||||
|
|
||||
LL | async fn ref_AssocType(self: &<Struct as Trait>::AssocType, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 21:34
|
||||
|
|
||||
LL | async fn ref_AssocType(self: &<Struct as Trait>::AssocType, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-assoc-async.rs:27:74
|
||||
|
|
||||
LL | async fn box_ref_AssocType(self: Box<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 27:42
|
||||
--> $DIR/ref-assoc-async.rs:27:42
|
||||
|
|
||||
LL | async fn box_ref_AssocType(self: Box<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 27:42
|
||||
|
|
||||
LL | async fn box_ref_AssocType(self: Box<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-assoc-async.rs:33:74
|
||||
|
|
||||
LL | async fn pin_ref_AssocType(self: Pin<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 33:42
|
||||
--> $DIR/ref-assoc-async.rs:33:42
|
||||
|
|
||||
LL | async fn pin_ref_AssocType(self: Pin<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 33:42
|
||||
|
|
||||
LL | async fn pin_ref_AssocType(self: Pin<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-assoc-async.rs:39:83
|
||||
|
|
||||
LL | async fn box_box_ref_AssocType(self: Box<Box<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 39:50
|
||||
--> $DIR/ref-assoc-async.rs:39:50
|
||||
|
|
||||
LL | async fn box_box_ref_AssocType(self: Box<Box<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 39:50
|
||||
|
|
||||
LL | async fn box_box_ref_AssocType(self: Box<Box<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-assoc-async.rs:45:83
|
||||
|
|
||||
LL | async fn box_pin_ref_AssocType(self: Box<Pin<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 45:50
|
||||
--> $DIR/ref-assoc-async.rs:45:50
|
||||
|
|
||||
LL | async fn box_pin_ref_AssocType(self: Box<Pin<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 45:50
|
||||
|
|
||||
LL | async fn box_pin_ref_AssocType(self: Box<Pin<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
43
src/test/ui/self/elision/ref-mut-alias-async.nll.stderr
Normal file
43
src/test/ui/self/elision/ref-mut-alias-async.nll.stderr
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-alias-async.rs:17:54
|
||||
|
|
||||
LL | async fn ref_Alias(self: &mut Alias, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-alias-async.rs:23:63
|
||||
|
|
||||
LL | async fn box_ref_Alias(self: Box<&mut Alias>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-alias-async.rs:29:63
|
||||
|
|
||||
LL | async fn pin_ref_Alias(self: Pin<&mut Alias>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-alias-async.rs:35:72
|
||||
|
|
||||
LL | async fn box_box_ref_Alias(self: Box<Box<&mut Alias>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-alias-async.rs:41:72
|
||||
|
|
||||
LL | async fn box_pin_ref_Alias(self: Box<Pin<&mut Alias>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
48
src/test/ui/self/elision/ref-mut-alias-async.rs
Normal file
48
src/test/ui/self/elision/ref-mut-alias-async.rs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
// edition:2018
|
||||
|
||||
#![feature(async_await)]
|
||||
|
||||
#![feature(arbitrary_self_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use std::pin::Pin;
|
||||
|
||||
struct Struct { }
|
||||
|
||||
type Alias = Struct;
|
||||
|
||||
impl Struct {
|
||||
// Test using an alias for `Struct`:
|
||||
|
||||
async fn ref_Alias(self: &mut Alias, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_ref_Alias(self: Box<&mut Alias>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn pin_ref_Alias(self: Pin<&mut Alias>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_box_ref_Alias(self: Box<Box<&mut Alias>>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_pin_ref_Alias(self: Box<Pin<&mut Alias>>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
133
src/test/ui/self/elision/ref-mut-alias-async.stderr
Normal file
133
src/test/ui/self/elision/ref-mut-alias-async.stderr
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-alias-async.rs:17:54
|
||||
|
|
||||
LL | async fn ref_Alias(self: &mut Alias, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-alias-async.rs:23:63
|
||||
|
|
||||
LL | async fn box_ref_Alias(self: Box<&mut Alias>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-alias-async.rs:29:63
|
||||
|
|
||||
LL | async fn pin_ref_Alias(self: Pin<&mut Alias>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-alias-async.rs:35:72
|
||||
|
|
||||
LL | async fn box_box_ref_Alias(self: Box<Box<&mut Alias>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-alias-async.rs:41:72
|
||||
|
|
||||
LL | async fn box_pin_ref_Alias(self: Box<Pin<&mut Alias>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-mut-alias-async.rs:17:42
|
||||
|
|
||||
LL | async fn ref_Alias(self: &mut Alias, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 17:30
|
||||
--> $DIR/ref-mut-alias-async.rs:17:30
|
||||
|
|
||||
LL | async fn ref_Alias(self: &mut Alias, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 17:30
|
||||
|
|
||||
LL | async fn ref_Alias(self: &mut Alias, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-mut-alias-async.rs:23:51
|
||||
|
|
||||
LL | async fn box_ref_Alias(self: Box<&mut Alias>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 23:38
|
||||
--> $DIR/ref-mut-alias-async.rs:23:38
|
||||
|
|
||||
LL | async fn box_ref_Alias(self: Box<&mut Alias>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 23:38
|
||||
|
|
||||
LL | async fn box_ref_Alias(self: Box<&mut Alias>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-mut-alias-async.rs:29:51
|
||||
|
|
||||
LL | async fn pin_ref_Alias(self: Pin<&mut Alias>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 29:38
|
||||
--> $DIR/ref-mut-alias-async.rs:29:38
|
||||
|
|
||||
LL | async fn pin_ref_Alias(self: Pin<&mut Alias>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 29:38
|
||||
|
|
||||
LL | async fn pin_ref_Alias(self: Pin<&mut Alias>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-mut-alias-async.rs:35:60
|
||||
|
|
||||
LL | async fn box_box_ref_Alias(self: Box<Box<&mut Alias>>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 35:46
|
||||
--> $DIR/ref-mut-alias-async.rs:35:46
|
||||
|
|
||||
LL | async fn box_box_ref_Alias(self: Box<Box<&mut Alias>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 35:46
|
||||
|
|
||||
LL | async fn box_box_ref_Alias(self: Box<Box<&mut Alias>>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-mut-alias-async.rs:41:60
|
||||
|
|
||||
LL | async fn box_pin_ref_Alias(self: Box<Pin<&mut Alias>>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 41:46
|
||||
--> $DIR/ref-mut-alias-async.rs:41:46
|
||||
|
|
||||
LL | async fn box_pin_ref_Alias(self: Box<Pin<&mut Alias>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 41:46
|
||||
|
|
||||
LL | async fn box_pin_ref_Alias(self: Box<Pin<&mut Alias>>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
51
src/test/ui/self/elision/ref-mut-self-async.nll.stderr
Normal file
51
src/test/ui/self/elision/ref-mut-self-async.nll.stderr
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-self-async.rs:15:46
|
||||
|
|
||||
LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-self-async.rs:23:52
|
||||
|
|
||||
LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-self-async.rs:29:61
|
||||
|
|
||||
LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-self-async.rs:35:61
|
||||
|
|
||||
LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-self-async.rs:41:70
|
||||
|
|
||||
LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-self-async.rs:47:70
|
||||
|
|
||||
LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
54
src/test/ui/self/elision/ref-mut-self-async.rs
Normal file
54
src/test/ui/self/elision/ref-mut-self-async.rs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
// edition:2018
|
||||
|
||||
#![feature(async_await)]
|
||||
|
||||
#![feature(arbitrary_self_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use std::pin::Pin;
|
||||
|
||||
struct Struct { }
|
||||
|
||||
impl Struct {
|
||||
// Test using `&mut self` sugar:
|
||||
|
||||
async fn ref_self(&mut self, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
// Test using `&mut Self` explicitly:
|
||||
|
||||
async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
159
src/test/ui/self/elision/ref-mut-self-async.stderr
Normal file
159
src/test/ui/self/elision/ref-mut-self-async.stderr
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-self-async.rs:15:46
|
||||
|
|
||||
LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-self-async.rs:23:52
|
||||
|
|
||||
LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-self-async.rs:29:61
|
||||
|
|
||||
LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-self-async.rs:35:61
|
||||
|
|
||||
LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-self-async.rs:41:70
|
||||
|
|
||||
LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-self-async.rs:47:70
|
||||
|
|
||||
LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-mut-self-async.rs:15:34
|
||||
|
|
||||
LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
|
||||
| ^ ---- 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:23
|
||||
--> $DIR/ref-mut-self-async.rs:15:23
|
||||
|
|
||||
LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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:23
|
||||
|
|
||||
LL | async fn ref_self(&mut self, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-mut-self-async.rs:23:40
|
||||
|
|
||||
LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 23:29
|
||||
--> $DIR/ref-mut-self-async.rs:23:29
|
||||
|
|
||||
LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 23:29
|
||||
|
|
||||
LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-mut-self-async.rs:29:49
|
||||
|
|
||||
LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 29:37
|
||||
--> $DIR/ref-mut-self-async.rs:29:37
|
||||
|
|
||||
LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 29:37
|
||||
|
|
||||
LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-mut-self-async.rs:35:49
|
||||
|
|
||||
LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 35:37
|
||||
--> $DIR/ref-mut-self-async.rs:35:37
|
||||
|
|
||||
LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 35:37
|
||||
|
|
||||
LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-mut-self-async.rs:41:58
|
||||
|
|
||||
LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 41:45
|
||||
--> $DIR/ref-mut-self-async.rs:41:45
|
||||
|
|
||||
LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 41:45
|
||||
|
|
||||
LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-mut-self-async.rs:47:58
|
||||
|
|
||||
LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 47:45
|
||||
--> $DIR/ref-mut-self-async.rs:47:45
|
||||
|
|
||||
LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 47:45
|
||||
|
|
||||
LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 12 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
43
src/test/ui/self/elision/ref-mut-struct-async.nll.stderr
Normal file
43
src/test/ui/self/elision/ref-mut-struct-async.nll.stderr
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-struct-async.rs:15:56
|
||||
|
|
||||
LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-struct-async.rs:21:65
|
||||
|
|
||||
LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-struct-async.rs:27:65
|
||||
|
|
||||
LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-struct-async.rs:33:74
|
||||
|
|
||||
LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-struct-async.rs:39:74
|
||||
|
|
||||
LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
46
src/test/ui/self/elision/ref-mut-struct-async.rs
Normal file
46
src/test/ui/self/elision/ref-mut-struct-async.rs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
// edition:2018
|
||||
|
||||
#![feature(async_await)]
|
||||
|
||||
#![feature(arbitrary_self_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use std::pin::Pin;
|
||||
|
||||
struct Struct { }
|
||||
|
||||
impl Struct {
|
||||
// Test using `&mut Struct` explicitly:
|
||||
|
||||
async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
133
src/test/ui/self/elision/ref-mut-struct-async.stderr
Normal file
133
src/test/ui/self/elision/ref-mut-struct-async.stderr
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-struct-async.rs:15:56
|
||||
|
|
||||
LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-struct-async.rs:21:65
|
||||
|
|
||||
LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-struct-async.rs:27:65
|
||||
|
|
||||
LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-struct-async.rs:33:74
|
||||
|
|
||||
LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-mut-struct-async.rs:39:74
|
||||
|
|
||||
LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-mut-struct-async.rs:15:44
|
||||
|
|
||||
LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
|
||||
| ^ ---- 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:31
|
||||
--> $DIR/ref-mut-struct-async.rs:15:31
|
||||
|
|
||||
LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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:31
|
||||
|
|
||||
LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-mut-struct-async.rs:21:53
|
||||
|
|
||||
LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 21:39
|
||||
--> $DIR/ref-mut-struct-async.rs:21:39
|
||||
|
|
||||
LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 21:39
|
||||
|
|
||||
LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-mut-struct-async.rs:27:53
|
||||
|
|
||||
LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 27:39
|
||||
--> $DIR/ref-mut-struct-async.rs:27:39
|
||||
|
|
||||
LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 27:39
|
||||
|
|
||||
LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-mut-struct-async.rs:33:62
|
||||
|
|
||||
LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 33:47
|
||||
--> $DIR/ref-mut-struct-async.rs:33:47
|
||||
|
|
||||
LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 33:47
|
||||
|
|
||||
LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-mut-struct-async.rs:39:62
|
||||
|
|
||||
LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 39:47
|
||||
--> $DIR/ref-mut-struct-async.rs:39:47
|
||||
|
|
||||
LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 39:47
|
||||
|
|
||||
LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
59
src/test/ui/self/elision/ref-self-async.nll.stderr
Normal file
59
src/test/ui/self/elision/ref-self-async.nll.stderr
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-self-async.rs:24:42
|
||||
|
|
||||
LL | async fn ref_self(&self, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-self-async.rs:32:48
|
||||
|
|
||||
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-self-async.rs:38:57
|
||||
|
|
||||
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-self-async.rs:44:57
|
||||
|
|
||||
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-self-async.rs:50:66
|
||||
|
|
||||
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-self-async.rs:56:66
|
||||
|
|
||||
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-self-async.rs:62:69
|
||||
|
|
||||
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
69
src/test/ui/self/elision/ref-self-async.rs
Normal file
69
src/test/ui/self/elision/ref-self-async.rs
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
// edition:2018
|
||||
|
||||
#![feature(async_await)]
|
||||
|
||||
#![feature(arbitrary_self_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use std::marker::PhantomData;
|
||||
use std::ops::Deref;
|
||||
use std::pin::Pin;
|
||||
|
||||
struct Struct { }
|
||||
|
||||
struct Wrap<T, P>(T, PhantomData<P>);
|
||||
|
||||
impl<T, P> Deref for Wrap<T, P> {
|
||||
type Target = T;
|
||||
fn deref(&self) -> &T { &self.0 }
|
||||
}
|
||||
|
||||
impl Struct {
|
||||
// Test using `&self` sugar:
|
||||
|
||||
async fn ref_self(&self, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
// Test using `&Self` explicitly:
|
||||
|
||||
async fn ref_Self(self: &Self, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
185
src/test/ui/self/elision/ref-self-async.stderr
Normal file
185
src/test/ui/self/elision/ref-self-async.stderr
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-self-async.rs:24:42
|
||||
|
|
||||
LL | async fn ref_self(&self, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-self-async.rs:32:48
|
||||
|
|
||||
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-self-async.rs:38:57
|
||||
|
|
||||
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-self-async.rs:44:57
|
||||
|
|
||||
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-self-async.rs:50:66
|
||||
|
|
||||
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-self-async.rs:56:66
|
||||
|
|
||||
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-self-async.rs:62:69
|
||||
|
|
||||
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-self-async.rs:24:30
|
||||
|
|
||||
LL | async fn ref_self(&self, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 24:23
|
||||
--> $DIR/ref-self-async.rs:24:23
|
||||
|
|
||||
LL | async fn ref_self(&self, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 24:23
|
||||
|
|
||||
LL | async fn ref_self(&self, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-self-async.rs:32:36
|
||||
|
|
||||
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 32:29
|
||||
--> $DIR/ref-self-async.rs:32:29
|
||||
|
|
||||
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 32:29
|
||||
|
|
||||
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-self-async.rs:38:45
|
||||
|
|
||||
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 38:37
|
||||
--> $DIR/ref-self-async.rs:38:37
|
||||
|
|
||||
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 38:37
|
||||
|
|
||||
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-self-async.rs:44:45
|
||||
|
|
||||
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 44:37
|
||||
--> $DIR/ref-self-async.rs:44:37
|
||||
|
|
||||
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 44:37
|
||||
|
|
||||
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-self-async.rs:50:54
|
||||
|
|
||||
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 50:45
|
||||
--> $DIR/ref-self-async.rs:50:45
|
||||
|
|
||||
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 50:45
|
||||
|
|
||||
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-self-async.rs:56:54
|
||||
|
|
||||
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 56:45
|
||||
--> $DIR/ref-self-async.rs:56:45
|
||||
|
|
||||
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 56:45
|
||||
|
|
||||
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-self-async.rs:62:58
|
||||
|
|
||||
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
|
||||
| ^ --- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 62:44
|
||||
--> $DIR/ref-self-async.rs:62:44
|
||||
|
|
||||
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
|
||||
| ^
|
||||
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 62:44
|
||||
|
|
||||
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 + '_ {
|
||||
| ^^^^^^^^
|
||||
|
||||
error: aborting due to 14 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
43
src/test/ui/self/elision/ref-struct-async.nll.stderr
Normal file
43
src/test/ui/self/elision/ref-struct-async.nll.stderr
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-struct-async.rs:15:52
|
||||
|
|
||||
LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-struct-async.rs:21:61
|
||||
|
|
||||
LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-struct-async.rs:27:61
|
||||
|
|
||||
LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-struct-async.rs:33:70
|
||||
|
|
||||
LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-struct-async.rs:39:66
|
||||
|
|
||||
LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
46
src/test/ui/self/elision/ref-struct-async.rs
Normal file
46
src/test/ui/self/elision/ref-struct-async.rs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
// edition:2018
|
||||
|
||||
#![feature(async_await)]
|
||||
|
||||
#![feature(arbitrary_self_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use std::pin::Pin;
|
||||
|
||||
struct Struct { }
|
||||
|
||||
impl Struct {
|
||||
// Test using `&Struct` explicitly:
|
||||
|
||||
async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~| ERROR cannot infer an appropriate lifetime
|
||||
f
|
||||
}
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
133
src/test/ui/self/elision/ref-struct-async.stderr
Normal file
133
src/test/ui/self/elision/ref-struct-async.stderr
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-struct-async.rs:15:52
|
||||
|
|
||||
LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-struct-async.rs:21:61
|
||||
|
|
||||
LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-struct-async.rs:27:61
|
||||
|
|
||||
LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-struct-async.rs:33:70
|
||||
|
|
||||
LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ref-struct-async.rs:39:66
|
||||
|
|
||||
LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
|
|
||||
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-struct-async.rs:15:40
|
||||
|
|
||||
LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
|
||||
| ^ ---- 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:31
|
||||
--> $DIR/ref-struct-async.rs:15:31
|
||||
|
|
||||
LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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:31
|
||||
|
|
||||
LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-struct-async.rs:21:49
|
||||
|
|
||||
LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 21:39
|
||||
--> $DIR/ref-struct-async.rs:21:39
|
||||
|
|
||||
LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 21:39
|
||||
|
|
||||
LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-struct-async.rs:27:49
|
||||
|
|
||||
LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 27:39
|
||||
--> $DIR/ref-struct-async.rs:27:39
|
||||
|
|
||||
LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 27:39
|
||||
|
|
||||
LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-struct-async.rs:33:58
|
||||
|
|
||||
LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 33:47
|
||||
--> $DIR/ref-struct-async.rs:33:47
|
||||
|
|
||||
LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 33:47
|
||||
|
|
||||
LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot infer an appropriate lifetime
|
||||
--> $DIR/ref-struct-async.rs:39:54
|
||||
|
|
||||
LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
|
||||
| ^ ---- this return type evaluates to the `'static` lifetime...
|
||||
| |
|
||||
| ...but this borrow...
|
||||
|
|
||||
note: ...can't outlive the lifetime '_ as defined on the method body at 39:43
|
||||
--> $DIR/ref-struct-async.rs:39:43
|
||||
|
|
||||
LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
|
||||
| ^
|
||||
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 39:43
|
||||
|
|
||||
LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 + '_ {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0106`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue