WIP fix tests

This commit is contained in:
Niko Matsakis 2019-10-02 14:17:38 -04:00
parent 81cd596bc5
commit dce20bf62a
20 changed files with 221 additions and 187 deletions

View file

@ -20,7 +20,7 @@ fn return_targets_async_block_not_fn() -> u8 {
} }
async fn return_targets_async_block_not_async_fn() -> u8 { async fn return_targets_async_block_not_async_fn() -> u8 {
//~^ ERROR type mismatch resolving //~^ ERROR mismatched types
let block = async { let block = async {
return 0u8; return 0u8;
}; };

View file

@ -39,6 +39,22 @@ LL | let _: &dyn Future<Output = ()> = &block;
found type `()` found type `()`
= note: required for the cast to the object type `dyn std::future::Future<Output = ()>` = note: required for the cast to the object type `dyn std::future::Future<Output = ()>`
error[E0308]: mismatched types
--> $DIR/async-block-control-flow-static-semantics.rs:22:58
|
LL | async fn return_targets_async_block_not_async_fn() -> u8 {
| __________________________________________________________^
LL | |
LL | | let block = async {
LL | | return 0u8;
... |
LL | |
LL | | }
| |_^ expected u8, found ()
|
= note: expected type `u8`
found type `()`
error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == ()` error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == ()`
--> $DIR/async-block-control-flow-static-semantics.rs:27:39 --> $DIR/async-block-control-flow-static-semantics.rs:27:39
| |
@ -49,16 +65,6 @@ LL | let _: &dyn Future<Output = ()> = &block;
found type `()` found type `()`
= note: required for the cast to the object type `dyn std::future::Future<Output = ()>` = note: required for the cast to the object type `dyn std::future::Future<Output = ()>`
error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == u8`
--> $DIR/async-block-control-flow-static-semantics.rs:22:55
|
LL | async fn return_targets_async_block_not_async_fn() -> u8 {
| ^^ expected (), found u8
|
= note: expected type `()`
found type `u8`
= note: the return type of a function must have a statically known size
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/async-block-control-flow-static-semantics.rs:48:44 --> $DIR/async-block-control-flow-static-semantics.rs:48:44
| |

View file

@ -9,7 +9,7 @@ fn get_future() -> impl Future<Output = ()> {
} }
async fn foo() { async fn foo() {
let a; //~ ERROR type inside `async` object must be known in this context let a; //~ ERROR type inside `async` fn body must be known in this context
get_future().await; get_future().await;
} }

View file

@ -1,10 +1,10 @@
error[E0698]: type inside `async` object must be known in this context error[E0698]: type inside `async` fn body must be known in this context
--> $DIR/async-error-span.rs:12:9 --> $DIR/async-error-span.rs:12:9
| |
LL | let a; LL | let a;
| ^ cannot infer type | ^ cannot infer type
| |
note: the type is part of the `async` object because of this `await` note: the type is part of the `async` fn body because of this `await`
--> $DIR/async-error-span.rs:13:5 --> $DIR/async-error-span.rs:13:5
| |
LL | get_future().await; LL | get_future().await;

View file

@ -9,9 +9,9 @@ trait Foo {}
impl Xyz { impl Xyz {
async fn do_sth<'a>( async fn do_sth<'a>(
&'a self, foo: &dyn Foo &'a self, foo: &dyn Foo
) -> &dyn Foo //~ ERROR lifetime mismatch ) -> &dyn Foo
{ {
foo foo //~ ERROR lifetime mismatch
} }
} }

View file

@ -1,12 +1,13 @@
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/issue-63388-1.rs:12:10 --> $DIR/issue-63388-1.rs:14:9
| |
LL | &'a self, foo: &dyn Foo LL | &'a self, foo: &dyn Foo
| -------- this parameter and the return type are declared with different lifetimes... | -------- this parameter and the return type are declared with different lifetimes...
LL | ) -> &dyn Foo LL | ) -> &dyn Foo
| ^^^^^^^^ | --------
| | LL | {
| ...but data from `foo` is returned here LL | foo
| ^^^ ...but data from `foo` is returned here
error: aborting due to previous error error: aborting due to previous error

View file

@ -11,8 +11,9 @@ error: cannot infer an appropriate lifetime
| |
LL | foo: &dyn Foo, bar: &'a dyn Foo LL | foo: &dyn Foo, bar: &'a dyn Foo
| ^^^ ...but this borrow... | ^^^ ...but this borrow...
LL | ) -> &dyn Foo ...
| -------- this return type evaluates to the `'static` lifetime... LL | foo
| --- this return type evaluates to the `'static` lifetime...
| |
note: ...can't outlive the lifetime '_ as defined on the method body at 11:14 note: ...can't outlive the lifetime '_ as defined on the method body at 11:14
--> $DIR/issue-63388-2.rs:11:14 --> $DIR/issue-63388-2.rs:11:14
@ -21,8 +22,8 @@ LL | foo: &dyn Foo, bar: &'a dyn Foo
| ^ | ^
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 11:14 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 11:14
| |
LL | ) -> &dyn Foo + '_ LL | foo + '_
| ^^^^^^^^^^^^^ |
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -7,9 +7,9 @@ async fn bar<T>() -> () {}
async fn foo() { async fn foo() {
bar().await; bar().await;
//~^ ERROR type inside `async` object must be known in this context //~^ ERROR type inside `async` fn body must be known in this context
//~| NOTE cannot infer type for `T` //~| NOTE cannot infer type for `T`
//~| NOTE the type is part of the `async` object because of this `await` //~| NOTE the type is part of the `async` fn body because of this `await`
//~| NOTE in this expansion of desugaring of `await` //~| NOTE in this expansion of desugaring of `await`
} }
fn main() {} fn main() {}

View file

@ -1,10 +1,10 @@
error[E0698]: type inside `async` object must be known in this context error[E0698]: type inside `async` fn body must be known in this context
--> $DIR/unresolved_type_param.rs:9:5 --> $DIR/unresolved_type_param.rs:9:5
| |
LL | bar().await; LL | bar().await;
| ^^^ cannot infer type for `T` | ^^^ cannot infer type for `T`
| |
note: the type is part of the `async` object because of this `await` note: the type is part of the `async` fn body because of this `await`
--> $DIR/unresolved_type_param.rs:9:5 --> $DIR/unresolved_type_param.rs:9:5
| |
LL | bar().await; LL | bar().await;

View file

@ -1,28 +1,25 @@
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:8:45 --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:8:52
| |
LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f } LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
| ---- ^^^^ | ---- ---- ^ ...but data from `f` is returned here
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:11:55 --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:11:82
| |
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
| ----- ^^^^^^^^^^^^^^^^^ | ----- ----------------- ^ ...but data from `f` is returned here
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:17:58 --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:17:64
| |
LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg } LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
| ----- ^^^ | ----- --- ^^^ ...but data from `arg` is returned here
| | | | |
| | ...but data from `arg` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
error: aborting due to 3 previous errors error: aborting due to 3 previous errors

View file

@ -11,29 +11,29 @@ impl<'a> Struct<'a> {
// Test using `&self` sugar: // Test using `&self` sugar:
async fn ref_self(&self, f: &u32) -> &u32 { async fn ref_self(&self, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
// Test using `&Self` explicitly: // Test using `&Self` explicitly:
async fn ref_Self(self: &Self, f: &u32) -> &u32 { async fn ref_Self(self: &Self, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
} }

View file

@ -1,56 +1,62 @@
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:13:42 --> $DIR/lt-ref-self-async.rs:14:9
| |
LL | async fn ref_self(&self, f: &u32) -> &u32 { LL | async fn ref_self(&self, f: &u32) -> &u32 {
| ----- ^^^^ | ----- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:19:48 --> $DIR/lt-ref-self-async.rs:20:9
| |
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ----- ^^^^ | ----- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:23:57 --> $DIR/lt-ref-self-async.rs:24:9
| |
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ----- ^^^^ | ----- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:27:57 --> $DIR/lt-ref-self-async.rs:28:9
| |
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ----- ^^^^ | ----- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:31:66 --> $DIR/lt-ref-self-async.rs:32:9
| |
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ----- ^^^^ | ----- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:35:62 --> $DIR/lt-ref-self-async.rs:36:9
| |
LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ----- ^^^^ | ----- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View file

@ -10,30 +10,30 @@ struct Struct { }
impl Struct { impl Struct {
// Test using `&mut self` sugar: // Test using `&mut self` sugar:
async fn ref_self(&mut self, f: &u32) -> &u32 { //~ ERROR lifetime mismatch async fn ref_self(&mut self, f: &u32) -> &u32 {
f f //~ ERROR lifetime mismatch
} }
// Test using `&mut Self` explicitly: // Test using `&mut Self` explicitly:
async fn ref_Self(self: &mut Self, f: &u32) -> &u32 { async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 { async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 { async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 { async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 { async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
} }

View file

@ -1,56 +1,62 @@
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:13:46 --> $DIR/ref-mut-self-async.rs:14:9
| |
LL | async fn ref_self(&mut self, f: &u32) -> &u32 { LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
| --------- ^^^^ | --------- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:19:52 --> $DIR/ref-mut-self-async.rs:20:9
| |
LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 { LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
| --------- ^^^^ | --------- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:23:61 --> $DIR/ref-mut-self-async.rs:24:9
| |
LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 { LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
| --------- ^^^^ | --------- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:27:61 --> $DIR/ref-mut-self-async.rs:28:9
| |
LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 { LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
| --------- ^^^^ | --------- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:31:70 --> $DIR/ref-mut-self-async.rs:32:9
| |
LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 { LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
| --------- ^^^^ | --------- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:35:70 --> $DIR/ref-mut-self-async.rs:36:9
| |
LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 { LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
| --------- ^^^^ | --------- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View file

@ -11,23 +11,23 @@ impl Struct {
// Test using `&mut Struct` explicitly: // Test using `&mut Struct` explicitly:
async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 { async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 { async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 { async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 { async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 { async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
} }

View file

@ -1,47 +1,52 @@
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:13:56 --> $DIR/ref-mut-struct-async.rs:14:9
| |
LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 { LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
| ----------- ^^^^ | ----------- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:17:65 --> $DIR/ref-mut-struct-async.rs:18:9
| |
LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 { LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
| ----------- ^^^^ | ----------- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:21:65 --> $DIR/ref-mut-struct-async.rs:22:9
| |
LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 { LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
| ----------- ^^^^ | ----------- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:25:74 --> $DIR/ref-mut-struct-async.rs:26:9
| |
LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 { LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
| ----------- ^^^^ | ----------- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:29:74 --> $DIR/ref-mut-struct-async.rs:30:9
| |
LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 { LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
| ----------- ^^^^ | ----------- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error: aborting due to 5 previous errors error: aborting due to 5 previous errors

View file

@ -19,34 +19,34 @@ impl<T, P> Deref for Wrap<T, P> {
impl Struct { impl Struct {
// Test using `&self` sugar: // Test using `&self` sugar:
async fn ref_self(&self, f: &u32) -> &u32 { //~ ERROR lifetime mismatch async fn ref_self(&self, f: &u32) -> &u32 {
f f //~ ERROR lifetime mismatch
} }
// Test using `&Self` explicitly: // Test using `&Self` explicitly:
async fn ref_Self(self: &Self, f: &u32) -> &u32 { async fn ref_Self(self: &Self, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 { async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
} }

View file

@ -1,65 +1,72 @@
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:22:42 --> $DIR/ref-self-async.rs:23:9
| |
LL | async fn ref_self(&self, f: &u32) -> &u32 { LL | async fn ref_self(&self, f: &u32) -> &u32 {
| ----- ^^^^ | ----- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:28:48 --> $DIR/ref-self-async.rs:29:9
| |
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ----- ^^^^ | ----- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:32:57 --> $DIR/ref-self-async.rs:33:9
| |
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ----- ^^^^ | ----- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:36:57 --> $DIR/ref-self-async.rs:37:9
| |
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ----- ^^^^ | ----- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:40:66 --> $DIR/ref-self-async.rs:41:9
| |
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ----- ^^^^ | ----- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:44:66 --> $DIR/ref-self-async.rs:45:9
| |
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ----- ^^^^ | ----- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:48:69 --> $DIR/ref-self-async.rs:49:9
| |
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 { LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
| ----- ^^^ | ----- ---
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error: aborting due to 7 previous errors error: aborting due to 7 previous errors

View file

@ -11,23 +11,23 @@ impl Struct {
// Test using `&Struct` explicitly: // Test using `&Struct` explicitly:
async fn ref_Struct(self: &Struct, f: &u32) -> &u32 { async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 { async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 { async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 { async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 { async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch f //~ ERROR lifetime mismatch
} }
} }

View file

@ -1,47 +1,52 @@
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:13:52 --> $DIR/ref-struct-async.rs:14:9
| |
LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 { LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
| ------- ^^^^ | ------- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:17:61 --> $DIR/ref-struct-async.rs:18:9
| |
LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 { LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
| ------- ^^^^ | ------- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:21:61 --> $DIR/ref-struct-async.rs:22:9
| |
LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 { LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
| ------- ^^^^ | ------- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:25:70 --> $DIR/ref-struct-async.rs:26:9
| |
LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 { LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
| ------- ^^^^ | ------- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:29:66 --> $DIR/ref-struct-async.rs:30:9
| |
LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 { LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
| ------- ^^^^ | ------- ----
| | | | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here
error: aborting due to 5 previous errors error: aborting due to 5 previous errors