From f7ed53c9dad467b5b9e33398e9e33f00a6724d96 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 2 Oct 2019 10:03:40 -0400 Subject: extract expected return type from `-> impl Future` obligation --- .../ui/async-await/return-ty-raw-ptr-coercion.rs | 25 ++++++++++++++++ .../ui/async-await/return-ty-unsize-coercion.rs | 34 ++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 src/test/ui/async-await/return-ty-raw-ptr-coercion.rs create mode 100644 src/test/ui/async-await/return-ty-unsize-coercion.rs (limited to 'src/test') diff --git a/src/test/ui/async-await/return-ty-raw-ptr-coercion.rs b/src/test/ui/async-await/return-ty-raw-ptr-coercion.rs new file mode 100644 index 00000000000..570e745f8c7 --- /dev/null +++ b/src/test/ui/async-await/return-ty-raw-ptr-coercion.rs @@ -0,0 +1,25 @@ +// Check that we apply unsizing coercions based on the return type. +// +// Also serves as a regression test for #60424. +// +// edition:2018 +// check-pass + +#![allow(warnings)] + +use std::fmt::Debug; + +const TMP: u32 = 22; + +// Coerce from `Box<"asdf">` to `Box`. +fn raw_pointer_coercion() { + fn sync_example() -> *const u32 { + &TMP + } + + async fn async_example() -> *const u32 { + &TMP + } +} + +fn main() {} diff --git a/src/test/ui/async-await/return-ty-unsize-coercion.rs b/src/test/ui/async-await/return-ty-unsize-coercion.rs new file mode 100644 index 00000000000..4d1b87677ed --- /dev/null +++ b/src/test/ui/async-await/return-ty-unsize-coercion.rs @@ -0,0 +1,34 @@ +// Check that we apply unsizing coercions based on the return type. +// +// Also serves as a regression test for #60424. +// +// edition:2018 +// check-pass + +#![allow(warnings)] + +use std::fmt::Debug; + +// Coerce from `Box<"asdf">` to `Box`. +fn unsize_trait_coercion() { + fn sync_example() -> Box { + Box::new("asdf") + } + + async fn async_example() -> Box { + Box::new("asdf") + } +} + +// Coerce from `Box<[u32; N]>` to `Box<[32]>`. +fn unsize_slice_coercion() { + fn sync_example() -> Box<[u32]> { + Box::new([0]) + } + + async fn async_example() -> Box<[u32]> { + Box::new([0]) + } +} + +fn main() {} -- cgit 1.4.1-3-g733a5 From dce20bf62a37cd8b22858c6f23de62cd36404fa1 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 2 Oct 2019 14:17:38 -0400 Subject: WIP fix tests --- .../async-block-control-flow-static-semantics.rs | 2 +- ...sync-block-control-flow-static-semantics.stderr | 26 +++++---- src/test/ui/async-await/async-error-span.rs | 2 +- src/test/ui/async-await/async-error-span.stderr | 4 +- src/test/ui/async-await/issues/issue-63388-1.rs | 4 +- .../ui/async-await/issues/issue-63388-1.stderr | 9 ++-- .../ui/async-await/issues/issue-63388-2.stderr | 9 ++-- src/test/ui/async-await/unresolved_type_param.rs | 4 +- .../ui/async-await/unresolved_type_param.stderr | 4 +- ...y_self_types_pin_lifetime_mismatch-async.stderr | 21 ++++---- src/test/ui/self/elision/lt-ref-self-async.rs | 12 ++--- src/test/ui/self/elision/lt-ref-self-async.stderr | 54 ++++++++++--------- src/test/ui/self/elision/ref-mut-self-async.rs | 14 ++--- src/test/ui/self/elision/ref-mut-self-async.stderr | 54 ++++++++++--------- src/test/ui/self/elision/ref-mut-struct-async.rs | 10 ++-- .../ui/self/elision/ref-mut-struct-async.stderr | 45 +++++++++------- src/test/ui/self/elision/ref-self-async.rs | 16 +++--- src/test/ui/self/elision/ref-self-async.stderr | 63 ++++++++++++---------- src/test/ui/self/elision/ref-struct-async.rs | 10 ++-- src/test/ui/self/elision/ref-struct-async.stderr | 45 +++++++++------- 20 files changed, 221 insertions(+), 187 deletions(-) (limited to 'src/test') diff --git a/src/test/ui/async-await/async-block-control-flow-static-semantics.rs b/src/test/ui/async-await/async-block-control-flow-static-semantics.rs index 753a4e49155..971d4476334 100644 --- a/src/test/ui/async-await/async-block-control-flow-static-semantics.rs +++ b/src/test/ui/async-await/async-block-control-flow-static-semantics.rs @@ -20,7 +20,7 @@ fn return_targets_async_block_not_fn() -> u8 { } async fn return_targets_async_block_not_async_fn() -> u8 { - //~^ ERROR type mismatch resolving + //~^ ERROR mismatched types let block = async { return 0u8; }; diff --git a/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr b/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr index c36caa5586f..a9b0e7ae779 100644 --- a/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr +++ b/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr @@ -39,6 +39,22 @@ LL | let _: &dyn Future = █ found type `()` = note: required for the cast to the object type `dyn std::future::Future` +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 `::Output == ()` --> $DIR/async-block-control-flow-static-semantics.rs:27:39 | @@ -49,16 +65,6 @@ LL | let _: &dyn Future = █ found type `()` = note: required for the cast to the object type `dyn std::future::Future` -error[E0271]: type mismatch resolving `::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 --> $DIR/async-block-control-flow-static-semantics.rs:48:44 | diff --git a/src/test/ui/async-await/async-error-span.rs b/src/test/ui/async-await/async-error-span.rs index dec3ac0f685..0559e627643 100644 --- a/src/test/ui/async-await/async-error-span.rs +++ b/src/test/ui/async-await/async-error-span.rs @@ -9,7 +9,7 @@ fn get_future() -> impl Future { } 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; } diff --git a/src/test/ui/async-await/async-error-span.stderr b/src/test/ui/async-await/async-error-span.stderr index 47441f5e4ef..384029f3aa5 100644 --- a/src/test/ui/async-await/async-error-span.stderr +++ b/src/test/ui/async-await/async-error-span.stderr @@ -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 | LL | let a; | ^ 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 | LL | get_future().await; diff --git a/src/test/ui/async-await/issues/issue-63388-1.rs b/src/test/ui/async-await/issues/issue-63388-1.rs index 3cde5de2198..baecf49c798 100644 --- a/src/test/ui/async-await/issues/issue-63388-1.rs +++ b/src/test/ui/async-await/issues/issue-63388-1.rs @@ -9,9 +9,9 @@ trait Foo {} impl Xyz { async fn do_sth<'a>( &'a self, foo: &dyn Foo - ) -> &dyn Foo //~ ERROR lifetime mismatch + ) -> &dyn Foo { - foo + foo //~ ERROR lifetime mismatch } } diff --git a/src/test/ui/async-await/issues/issue-63388-1.stderr b/src/test/ui/async-await/issues/issue-63388-1.stderr index a54cadb0cd2..2917fa9ccb7 100644 --- a/src/test/ui/async-await/issues/issue-63388-1.stderr +++ b/src/test/ui/async-await/issues/issue-63388-1.stderr @@ -1,12 +1,13 @@ error[E0623]: lifetime mismatch - --> $DIR/issue-63388-1.rs:12:10 + --> $DIR/issue-63388-1.rs:14:9 | LL | &'a self, foo: &dyn Foo | -------- this parameter and the return type are declared with different lifetimes... LL | ) -> &dyn Foo - | ^^^^^^^^ - | | - | ...but data from `foo` is returned here + | -------- +LL | { +LL | foo + | ^^^ ...but data from `foo` is returned here error: aborting due to previous error diff --git a/src/test/ui/async-await/issues/issue-63388-2.stderr b/src/test/ui/async-await/issues/issue-63388-2.stderr index 1edeb3d5493..5099297fbeb 100644 --- a/src/test/ui/async-await/issues/issue-63388-2.stderr +++ b/src/test/ui/async-await/issues/issue-63388-2.stderr @@ -11,8 +11,9 @@ error: cannot infer an appropriate lifetime | LL | foo: &dyn Foo, bar: &'a dyn Foo | ^^^ ...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 --> $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 | -LL | ) -> &dyn Foo + '_ - | ^^^^^^^^^^^^^ +LL | foo + '_ + | error: aborting due to 2 previous errors diff --git a/src/test/ui/async-await/unresolved_type_param.rs b/src/test/ui/async-await/unresolved_type_param.rs index d8ea87d2775..8d035d038ab 100644 --- a/src/test/ui/async-await/unresolved_type_param.rs +++ b/src/test/ui/async-await/unresolved_type_param.rs @@ -7,9 +7,9 @@ async fn bar() -> () {} async fn foo() { 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 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` } fn main() {} diff --git a/src/test/ui/async-await/unresolved_type_param.stderr b/src/test/ui/async-await/unresolved_type_param.stderr index f3090a2b980..652f15cffe2 100644 --- a/src/test/ui/async-await/unresolved_type_param.stderr +++ b/src/test/ui/async-await/unresolved_type_param.stderr @@ -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 | LL | bar().await; | ^^^ 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 | LL | bar().await; diff --git a/src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.stderr b/src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.stderr index 57ad026bdcf..e3c261576e6 100644 --- a/src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.stderr +++ b/src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.stderr @@ -1,28 +1,25 @@ 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 } - | ---- ^^^^ - | | | - | | ...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... 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) } - | ----- ^^^^^^^^^^^^^^^^^ - | | | - | | ...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... 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 } - | ----- ^^^ - | | | - | | ...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... error: aborting due to 3 previous errors diff --git a/src/test/ui/self/elision/lt-ref-self-async.rs b/src/test/ui/self/elision/lt-ref-self-async.rs index e3ca0c2e2dd..5aba7cfcf29 100644 --- a/src/test/ui/self/elision/lt-ref-self-async.rs +++ b/src/test/ui/self/elision/lt-ref-self-async.rs @@ -11,29 +11,29 @@ impl<'a> Struct<'a> { // Test using `&self` sugar: async fn ref_self(&self, f: &u32) -> &u32 { - f //~^ ERROR lifetime mismatch + f //~ ERROR lifetime mismatch } // Test using `&Self` explicitly: 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 { - f //~^ ERROR lifetime mismatch + f //~ ERROR lifetime mismatch } 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>, f: &u32) -> &u32 { - f //~^ ERROR lifetime mismatch + f //~ ERROR lifetime mismatch } async fn box_pin_Self(self: Box>, f: &u32) -> &u32 { - f //~^ ERROR lifetime mismatch + f //~ ERROR lifetime mismatch } } diff --git a/src/test/ui/self/elision/lt-ref-self-async.stderr b/src/test/ui/self/elision/lt-ref-self-async.stderr index 2bc64bdf1f7..6b668d9f1f6 100644 --- a/src/test/ui/self/elision/lt-ref-self-async.stderr +++ b/src/test/ui/self/elision/lt-ref-self-async.stderr @@ -1,56 +1,62 @@ 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 { - | ----- ^^^^ - | | | - | | ...but data from `f` is returned here + | ----- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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 { - | ----- ^^^^ - | | | - | | ...but data from `f` is returned here + | ----- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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 { - | ----- ^^^^ - | | | - | | ...but data from `f` is returned here + | ----- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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 { - | ----- ^^^^ - | | | - | | ...but data from `f` is returned here + | ----- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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>, f: &u32) -> &u32 { - | ----- ^^^^ - | | | - | | ...but data from `f` is returned here + | ----- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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>, f: &u32) -> &u32 { - | ----- ^^^^ - | | | - | | ...but data from `f` is returned here + | ----- ---- + | | | 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 diff --git a/src/test/ui/self/elision/ref-mut-self-async.rs b/src/test/ui/self/elision/ref-mut-self-async.rs index 2ca14800a75..b8eb416d904 100644 --- a/src/test/ui/self/elision/ref-mut-self-async.rs +++ b/src/test/ui/self/elision/ref-mut-self-async.rs @@ -10,30 +10,30 @@ struct Struct { } impl Struct { // Test using `&mut self` sugar: - async fn ref_self(&mut self, f: &u32) -> &u32 { //~ ERROR lifetime mismatch - f + async fn ref_self(&mut self, f: &u32) -> &u32 { + f //~ ERROR lifetime mismatch } // Test using `&mut Self` explicitly: 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 { - f //~^ ERROR lifetime mismatch + f //~ ERROR lifetime mismatch } 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>, f: &u32) -> &u32 { - f //~^ ERROR lifetime mismatch + f //~ ERROR lifetime mismatch } async fn box_pin_ref_Self(self: Box>, f: &u32) -> &u32 { - f //~^ ERROR lifetime mismatch + f //~ ERROR lifetime mismatch } } diff --git a/src/test/ui/self/elision/ref-mut-self-async.stderr b/src/test/ui/self/elision/ref-mut-self-async.stderr index 39a1b30ca53..29fbec9fa7a 100644 --- a/src/test/ui/self/elision/ref-mut-self-async.stderr +++ b/src/test/ui/self/elision/ref-mut-self-async.stderr @@ -1,56 +1,62 @@ 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 { - | --------- ^^^^ - | | | - | | ...but data from `f` is returned here + | --------- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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 { - | --------- ^^^^ - | | | - | | ...but data from `f` is returned here + | --------- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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 { - | --------- ^^^^ - | | | - | | ...but data from `f` is returned here + | --------- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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 { - | --------- ^^^^ - | | | - | | ...but data from `f` is returned here + | --------- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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>, f: &u32) -> &u32 { - | --------- ^^^^ - | | | - | | ...but data from `f` is returned here + | --------- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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>, f: &u32) -> &u32 { - | --------- ^^^^ - | | | - | | ...but data from `f` is returned here + | --------- ---- + | | | 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 diff --git a/src/test/ui/self/elision/ref-mut-struct-async.rs b/src/test/ui/self/elision/ref-mut-struct-async.rs index a671116de25..1822a9a468b 100644 --- a/src/test/ui/self/elision/ref-mut-struct-async.rs +++ b/src/test/ui/self/elision/ref-mut-struct-async.rs @@ -11,23 +11,23 @@ impl Struct { // Test using `&mut Struct` explicitly: 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 { - f //~^ ERROR lifetime mismatch + f //~ ERROR lifetime mismatch } 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>, f: &u32) -> &u32 { - f //~^ ERROR lifetime mismatch + f //~ ERROR lifetime mismatch } async fn box_pin_ref_Struct(self: Box>, f: &u32) -> &u32 { - f //~^ ERROR lifetime mismatch + f //~ ERROR lifetime mismatch } } diff --git a/src/test/ui/self/elision/ref-mut-struct-async.stderr b/src/test/ui/self/elision/ref-mut-struct-async.stderr index fe4a636ada6..46591bfc958 100644 --- a/src/test/ui/self/elision/ref-mut-struct-async.stderr +++ b/src/test/ui/self/elision/ref-mut-struct-async.stderr @@ -1,47 +1,52 @@ 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 { - | ----------- ^^^^ - | | | - | | ...but data from `f` is returned here + | ----------- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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 { - | ----------- ^^^^ - | | | - | | ...but data from `f` is returned here + | ----------- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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 { - | ----------- ^^^^ - | | | - | | ...but data from `f` is returned here + | ----------- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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>, f: &u32) -> &u32 { - | ----------- ^^^^ - | | | - | | ...but data from `f` is returned here + | ----------- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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>, f: &u32) -> &u32 { - | ----------- ^^^^ - | | | - | | ...but data from `f` is returned here + | ----------- ---- + | | | 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 diff --git a/src/test/ui/self/elision/ref-self-async.rs b/src/test/ui/self/elision/ref-self-async.rs index 06f3b127b21..9425fbfca8f 100644 --- a/src/test/ui/self/elision/ref-self-async.rs +++ b/src/test/ui/self/elision/ref-self-async.rs @@ -19,34 +19,34 @@ impl Deref for Wrap { impl Struct { // Test using `&self` sugar: - async fn ref_self(&self, f: &u32) -> &u32 { //~ ERROR lifetime mismatch - f + async fn ref_self(&self, f: &u32) -> &u32 { + f //~ ERROR lifetime mismatch } // Test using `&Self` explicitly: 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 { - f //~^ ERROR lifetime mismatch + f //~ ERROR lifetime mismatch } 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>, f: &u32) -> &u32 { - f //~^ ERROR lifetime mismatch + f //~ ERROR lifetime mismatch } async fn box_pin_ref_Self(self: Box>, f: &u32) -> &u32 { - f //~^ ERROR lifetime mismatch + f //~ ERROR lifetime mismatch } async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 { - f //~^ ERROR lifetime mismatch + f //~ ERROR lifetime mismatch } } diff --git a/src/test/ui/self/elision/ref-self-async.stderr b/src/test/ui/self/elision/ref-self-async.stderr index 2f9e2a01e34..c255d189363 100644 --- a/src/test/ui/self/elision/ref-self-async.stderr +++ b/src/test/ui/self/elision/ref-self-async.stderr @@ -1,65 +1,72 @@ 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 { - | ----- ^^^^ - | | | - | | ...but data from `f` is returned here + | ----- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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 { - | ----- ^^^^ - | | | - | | ...but data from `f` is returned here + | ----- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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 { - | ----- ^^^^ - | | | - | | ...but data from `f` is returned here + | ----- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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 { - | ----- ^^^^ - | | | - | | ...but data from `f` is returned here + | ----- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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>, f: &u32) -> &u32 { - | ----- ^^^^ - | | | - | | ...but data from `f` is returned here + | ----- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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>, f: &u32) -> &u32 { - | ----- ^^^^ - | | | - | | ...but data from `f` is returned here + | ----- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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 { - | ----- ^^^ - | | | - | | ...but data from `f` is returned here + | ----- --- + | | | 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 diff --git a/src/test/ui/self/elision/ref-struct-async.rs b/src/test/ui/self/elision/ref-struct-async.rs index 94eaeedc734..64c84c4cd2e 100644 --- a/src/test/ui/self/elision/ref-struct-async.rs +++ b/src/test/ui/self/elision/ref-struct-async.rs @@ -11,23 +11,23 @@ impl Struct { // Test using `&Struct` explicitly: 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 { - f //~^ ERROR lifetime mismatch + f //~ ERROR lifetime mismatch } 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>, f: &u32) -> &u32 { - f //~^ ERROR lifetime mismatch + f //~ ERROR lifetime mismatch } async fn box_pin_Struct(self: Box>, f: &u32) -> &u32 { - f //~^ ERROR lifetime mismatch + f //~ ERROR lifetime mismatch } } diff --git a/src/test/ui/self/elision/ref-struct-async.stderr b/src/test/ui/self/elision/ref-struct-async.stderr index 222e27ebf0d..c70facc931e 100644 --- a/src/test/ui/self/elision/ref-struct-async.stderr +++ b/src/test/ui/self/elision/ref-struct-async.stderr @@ -1,47 +1,52 @@ 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 { - | ------- ^^^^ - | | | - | | ...but data from `f` is returned here + | ------- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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 { - | ------- ^^^^ - | | | - | | ...but data from `f` is returned here + | ------- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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 { - | ------- ^^^^ - | | | - | | ...but data from `f` is returned here + | ------- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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>, f: &u32) -> &u32 { - | ------- ^^^^ - | | | - | | ...but data from `f` is returned here + | ------- ---- + | | | this parameter and the return type are declared with different lifetimes... +LL | f + | ^ ...but data from `f` is returned here 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>, f: &u32) -> &u32 { - | ------- ^^^^ - | | | - | | ...but data from `f` is returned here + | ------- ---- + | | | 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 -- cgit 1.4.1-3-g733a5 From 3ae4abbaa312dce8086732fd8a4fb7f741e5e325 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 2 Oct 2019 14:23:36 -0400 Subject: correct coercion comments --- src/test/ui/async-await/return-ty-raw-ptr-coercion.rs | 2 +- src/test/ui/async-await/return-ty-unsize-coercion.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/test') diff --git a/src/test/ui/async-await/return-ty-raw-ptr-coercion.rs b/src/test/ui/async-await/return-ty-raw-ptr-coercion.rs index 570e745f8c7..9fe0869cad6 100644 --- a/src/test/ui/async-await/return-ty-raw-ptr-coercion.rs +++ b/src/test/ui/async-await/return-ty-raw-ptr-coercion.rs @@ -11,7 +11,7 @@ use std::fmt::Debug; const TMP: u32 = 22; -// Coerce from `Box<"asdf">` to `Box`. +// Coerce from `&u32` to `*const u32` fn raw_pointer_coercion() { fn sync_example() -> *const u32 { &TMP diff --git a/src/test/ui/async-await/return-ty-unsize-coercion.rs b/src/test/ui/async-await/return-ty-unsize-coercion.rs index 4d1b87677ed..8855e2e55ef 100644 --- a/src/test/ui/async-await/return-ty-unsize-coercion.rs +++ b/src/test/ui/async-await/return-ty-unsize-coercion.rs @@ -9,7 +9,7 @@ use std::fmt::Debug; -// Coerce from `Box<"asdf">` to `Box`. +// Unsizing coercion from `Box<&'static str>` to `Box`. fn unsize_trait_coercion() { fn sync_example() -> Box { Box::new("asdf") @@ -20,7 +20,7 @@ fn unsize_trait_coercion() { } } -// Coerce from `Box<[u32; N]>` to `Box<[32]>`. +// Unsizing coercion from `Box<[u32; N]>` to `Box<[32]>`. fn unsize_slice_coercion() { fn sync_example() -> Box<[u32]> { Box::new([0]) -- cgit 1.4.1-3-g733a5 From 3f277e1a66f0e8de9cc46c9a886b4ad0f4582944 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 2 Oct 2019 14:39:44 -0400 Subject: s/`async` fn/`async fn`/ --- src/librustc/hir/mod.rs | 2 +- src/test/ui/async-await/async-error-span.rs | 2 +- src/test/ui/async-await/async-error-span.stderr | 4 ++-- src/test/ui/async-await/unresolved_type_param.rs | 4 ++-- src/test/ui/async-await/unresolved_type_param.stderr | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/test') diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index ec44c92bd33..1a84889513d 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1404,7 +1404,7 @@ impl fmt::Display for AsyncGeneratorKind { f.write_str(match self { AsyncGeneratorKind::Block => "`async` block", AsyncGeneratorKind::Closure => "`async` closure body", - AsyncGeneratorKind::Fn => "`async` fn body", + AsyncGeneratorKind::Fn => "`async fn` body", }) } } diff --git a/src/test/ui/async-await/async-error-span.rs b/src/test/ui/async-await/async-error-span.rs index 0559e627643..28132c9789c 100644 --- a/src/test/ui/async-await/async-error-span.rs +++ b/src/test/ui/async-await/async-error-span.rs @@ -9,7 +9,7 @@ fn get_future() -> impl Future { } async fn foo() { - let a; //~ ERROR type inside `async` fn body must be known in this context + let a; //~ ERROR type inside `async fn` body must be known in this context get_future().await; } diff --git a/src/test/ui/async-await/async-error-span.stderr b/src/test/ui/async-await/async-error-span.stderr index 384029f3aa5..b551b99587d 100644 --- a/src/test/ui/async-await/async-error-span.stderr +++ b/src/test/ui/async-await/async-error-span.stderr @@ -1,10 +1,10 @@ -error[E0698]: type inside `async` fn body 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 | LL | let a; | ^ cannot infer type | -note: the type is part of the `async` fn body 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 | LL | get_future().await; diff --git a/src/test/ui/async-await/unresolved_type_param.rs b/src/test/ui/async-await/unresolved_type_param.rs index 8d035d038ab..2876f9fea0e 100644 --- a/src/test/ui/async-await/unresolved_type_param.rs +++ b/src/test/ui/async-await/unresolved_type_param.rs @@ -7,9 +7,9 @@ async fn bar() -> () {} async fn foo() { bar().await; - //~^ ERROR type inside `async` fn body 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 the type is part of the `async` fn body 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` } fn main() {} diff --git a/src/test/ui/async-await/unresolved_type_param.stderr b/src/test/ui/async-await/unresolved_type_param.stderr index 652f15cffe2..c7866fc7744 100644 --- a/src/test/ui/async-await/unresolved_type_param.stderr +++ b/src/test/ui/async-await/unresolved_type_param.stderr @@ -1,10 +1,10 @@ -error[E0698]: type inside `async` fn body 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 | LL | bar().await; | ^^^ cannot infer type for `T` | -note: the type is part of the `async` fn body 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 | LL | bar().await; -- cgit 1.4.1-3-g733a5 From 4a49351e8b3552eb28251ede3511d0ff53e650d7 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 2 Oct 2019 18:13:40 -0400 Subject: add unsize slice-str coercion --- src/test/ui/async-await/return-ty-unsize-coercion.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/test') diff --git a/src/test/ui/async-await/return-ty-unsize-coercion.rs b/src/test/ui/async-await/return-ty-unsize-coercion.rs index 8855e2e55ef..b9884416930 100644 --- a/src/test/ui/async-await/return-ty-unsize-coercion.rs +++ b/src/test/ui/async-await/return-ty-unsize-coercion.rs @@ -31,4 +31,15 @@ fn unsize_slice_coercion() { } } +// Unsizing coercion from `&[&str; 1]` to `&[&str]` +fn unsize_slice_str_coercion() { + fn func() -> &'static [&'static str] { + &["hi"] + } + + async fn func() -> &'static [&'static str] { + &["hi"] + } +} + fn main() {} -- cgit 1.4.1-3-g733a5 From 19c07cc2b2f2dc1f30acce0f75b270c3dead6d70 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 2 Oct 2019 18:45:44 -0400 Subject: fix example (le sigh) --- src/test/ui/async-await/return-ty-unsize-coercion.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/test') diff --git a/src/test/ui/async-await/return-ty-unsize-coercion.rs b/src/test/ui/async-await/return-ty-unsize-coercion.rs index b9884416930..93832ef7edd 100644 --- a/src/test/ui/async-await/return-ty-unsize-coercion.rs +++ b/src/test/ui/async-await/return-ty-unsize-coercion.rs @@ -33,11 +33,11 @@ fn unsize_slice_coercion() { // Unsizing coercion from `&[&str; 1]` to `&[&str]` fn unsize_slice_str_coercion() { - fn func() -> &'static [&'static str] { + fn sync_example() -> &'static [&'static str] { &["hi"] } - async fn func() -> &'static [&'static str] { + async fn async_example() -> &'static [&'static str] { &["hi"] } } -- cgit 1.4.1-3-g733a5 From a807032f9e4e4b43db17a1f17be766bb02d23a57 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 3 Oct 2019 04:20:51 -0400 Subject: ./x.py test --bless --compare-mode=nll --- ...lf_types_pin_lifetime_mismatch-async.nll.stderr | 15 ++- .../ui/self/elision/lt-ref-self-async.nll.stderr | 114 +++++++++--------- .../ui/self/elision/ref-mut-self-async.nll.stderr | 114 +++++++++--------- .../self/elision/ref-mut-struct-async.nll.stderr | 85 +++++++------ src/test/ui/self/elision/ref-self-async.nll.stderr | 133 ++++++++++----------- .../ui/self/elision/ref-struct-async.nll.stderr | 85 +++++++------ 6 files changed, 258 insertions(+), 288 deletions(-) (limited to 'src/test') diff --git a/src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.nll.stderr b/src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.nll.stderr index e53d91c3604..7eec31d36e3 100644 --- a/src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.nll.stderr +++ b/src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.nll.stderr @@ -7,19 +7,19 @@ LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f } = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:8:50 + --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:8:52 | LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f } - | - ^^^^^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + | - ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` | | | lifetime `'_` defined here | lifetime `'_` defined here error: lifetime may not live long enough - --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:11:73 + --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:11:75 | LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } - | - ^^^^^^^^^^^^^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + | - ^^^^^^^^^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` | | | lifetime `'_` defined here | lifetime `'_` defined here @@ -33,12 +33,11 @@ LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg } = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:17:62 + --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:17:64 | LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg } - | -- - ^^^^^^^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'a` - | | | - | | lifetime `'_` defined here + | -- - lifetime `'_` defined here ^^^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'a` + | | | lifetime `'a` defined here error: aborting due to 5 previous errors diff --git a/src/test/ui/self/elision/lt-ref-self-async.nll.stderr b/src/test/ui/self/elision/lt-ref-self-async.nll.stderr index 998178dde1d..b4f8ff6001d 100644 --- a/src/test/ui/self/elision/lt-ref-self-async.nll.stderr +++ b/src/test/ui/self/elision/lt-ref-self-async.nll.stderr @@ -7,16 +7,15 @@ LL | async fn ref_self(&self, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#23r error: lifetime may not live long enough - --> $DIR/lt-ref-self-async.rs:13:47 - | -LL | async fn ref_self(&self, f: &u32) -> &u32 { - | _______________________-_______________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + --> $DIR/lt-ref-self-async.rs:14:9 + | +LL | async fn ref_self(&self, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/lt-ref-self-async.rs:19:48 @@ -27,16 +26,15 @@ LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#23r error: lifetime may not live long enough - --> $DIR/lt-ref-self-async.rs:19:53 - | -LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { - | _____________________________-_______________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + --> $DIR/lt-ref-self-async.rs:20:9 + | +LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/lt-ref-self-async.rs:23:57 @@ -47,16 +45,15 @@ LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#23r error: lifetime may not live long enough - --> $DIR/lt-ref-self-async.rs:23:62 - | -LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { - | _____________________________________-________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + --> $DIR/lt-ref-self-async.rs:24:9 + | +LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/lt-ref-self-async.rs:27:57 @@ -67,16 +64,15 @@ LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#23r error: lifetime may not live long enough - --> $DIR/lt-ref-self-async.rs:27:62 - | -LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { - | _____________________________________-________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + --> $DIR/lt-ref-self-async.rs:28:9 + | +LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/lt-ref-self-async.rs:31:66 @@ -87,16 +83,15 @@ LL | async fn box_box_ref_Self(self: Box>, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#23r error: lifetime may not live long enough - --> $DIR/lt-ref-self-async.rs:31:71 - | -LL | async fn box_box_ref_Self(self: Box>, f: &u32) -> &u32 { - | _____________________________________________-_________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + --> $DIR/lt-ref-self-async.rs:32:9 + | +LL | async fn box_box_ref_Self(self: Box>, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/lt-ref-self-async.rs:35:62 @@ -107,16 +102,15 @@ LL | async fn box_pin_Self(self: Box>, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#23r error: lifetime may not live long enough - --> $DIR/lt-ref-self-async.rs:35:67 - | -LL | async fn box_pin_Self(self: Box>, f: &u32) -> &u32 { - | _________________________________________-_________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + --> $DIR/lt-ref-self-async.rs:36:9 + | +LL | async fn box_pin_Self(self: Box>, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error: aborting due to 12 previous errors diff --git a/src/test/ui/self/elision/ref-mut-self-async.nll.stderr b/src/test/ui/self/elision/ref-mut-self-async.nll.stderr index 97bc80509df..b6f2b63f093 100644 --- a/src/test/ui/self/elision/ref-mut-self-async.nll.stderr +++ b/src/test/ui/self/elision/ref-mut-self-async.nll.stderr @@ -7,16 +7,15 @@ LL | async fn ref_self(&mut self, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-mut-self-async.rs:13:51 - | -LL | async fn ref_self(&mut self, f: &u32) -> &u32 { - | _______________________-___________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + --> $DIR/ref-mut-self-async.rs:14:9 + | +LL | async fn ref_self(&mut self, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/ref-mut-self-async.rs:19:52 @@ -27,16 +26,15 @@ LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-mut-self-async.rs:19:57 - | -LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 { - | _____________________________-___________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + --> $DIR/ref-mut-self-async.rs:20:9 + | +LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/ref-mut-self-async.rs:23:61 @@ -47,16 +45,15 @@ LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-mut-self-async.rs:23:66 - | -LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 { - | _____________________________________-____________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + --> $DIR/ref-mut-self-async.rs:24:9 + | +LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/ref-mut-self-async.rs:27:61 @@ -67,16 +64,15 @@ LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-mut-self-async.rs:27:66 - | -LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 { - | _____________________________________-____________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + --> $DIR/ref-mut-self-async.rs:28:9 + | +LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/ref-mut-self-async.rs:31:70 @@ -87,16 +83,15 @@ LL | async fn box_box_ref_Self(self: Box>, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-mut-self-async.rs:31:75 - | -LL | async fn box_box_ref_Self(self: Box>, f: &u32) -> &u32 { - | _____________________________________________-_____________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + --> $DIR/ref-mut-self-async.rs:32:9 + | +LL | async fn box_box_ref_Self(self: Box>, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/ref-mut-self-async.rs:35:70 @@ -107,16 +102,15 @@ LL | async fn box_pin_ref_Self(self: Box>, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-mut-self-async.rs:35:75 - | -LL | async fn box_pin_ref_Self(self: Box>, f: &u32) -> &u32 { - | _____________________________________________-_____________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + --> $DIR/ref-mut-self-async.rs:36:9 + | +LL | async fn box_pin_ref_Self(self: Box>, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error: aborting due to 12 previous errors diff --git a/src/test/ui/self/elision/ref-mut-struct-async.nll.stderr b/src/test/ui/self/elision/ref-mut-struct-async.nll.stderr index 2905a022e5d..fa78543bd87 100644 --- a/src/test/ui/self/elision/ref-mut-struct-async.nll.stderr +++ b/src/test/ui/self/elision/ref-mut-struct-async.nll.stderr @@ -7,16 +7,15 @@ LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-mut-struct-async.rs:13:61 + --> $DIR/ref-mut-struct-async.rs:14:9 | -LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 { - | _______________________________-_____________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` +LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/ref-mut-struct-async.rs:17:65 @@ -27,16 +26,15 @@ LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-mut-struct-async.rs:17:70 + --> $DIR/ref-mut-struct-async.rs:18:9 | -LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 { - | _______________________________________-______________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` +LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/ref-mut-struct-async.rs:21:65 @@ -47,16 +45,15 @@ LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-mut-struct-async.rs:21:70 + --> $DIR/ref-mut-struct-async.rs:22:9 | -LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 { - | _______________________________________-______________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` +LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/ref-mut-struct-async.rs:25:74 @@ -67,16 +64,15 @@ LL | async fn box_box_ref_Struct(self: Box>, f: &u32) -> &u = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-mut-struct-async.rs:25:79 + --> $DIR/ref-mut-struct-async.rs:26:9 | -LL | async fn box_box_ref_Struct(self: Box>, f: &u32) -> &u32 { - | _______________________________________________-_______________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` +LL | async fn box_box_ref_Struct(self: Box>, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/ref-mut-struct-async.rs:29:74 @@ -87,16 +83,15 @@ LL | async fn box_pin_ref_Struct(self: Box>, f: &u32) -> &u = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-mut-struct-async.rs:29:79 + --> $DIR/ref-mut-struct-async.rs:30:9 | -LL | async fn box_pin_ref_Struct(self: Box>, f: &u32) -> &u32 { - | _______________________________________________-_______________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` +LL | async fn box_pin_ref_Struct(self: Box>, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error: aborting due to 10 previous errors diff --git a/src/test/ui/self/elision/ref-self-async.nll.stderr b/src/test/ui/self/elision/ref-self-async.nll.stderr index 0eee56654f7..88fd2101bc6 100644 --- a/src/test/ui/self/elision/ref-self-async.nll.stderr +++ b/src/test/ui/self/elision/ref-self-async.nll.stderr @@ -7,16 +7,15 @@ LL | async fn ref_self(&self, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:22:47 - | -LL | async fn ref_self(&self, f: &u32) -> &u32 { - | _______________________-_______________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + --> $DIR/ref-self-async.rs:23:9 + | +LL | async fn ref_self(&self, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/ref-self-async.rs:28:48 @@ -27,16 +26,15 @@ LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:28:53 - | -LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { - | _____________________________-_______________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + --> $DIR/ref-self-async.rs:29:9 + | +LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/ref-self-async.rs:32:57 @@ -47,16 +45,15 @@ LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:32:62 - | -LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { - | _____________________________________-________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + --> $DIR/ref-self-async.rs:33:9 + | +LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/ref-self-async.rs:36:57 @@ -67,16 +64,15 @@ LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:36:62 - | -LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { - | _____________________________________-________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + --> $DIR/ref-self-async.rs:37:9 + | +LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/ref-self-async.rs:40:66 @@ -87,16 +83,15 @@ LL | async fn box_box_ref_Self(self: Box>, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:40:71 - | -LL | async fn box_box_ref_Self(self: Box>, f: &u32) -> &u32 { - | _____________________________________________-_________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + --> $DIR/ref-self-async.rs:41:9 + | +LL | async fn box_box_ref_Self(self: Box>, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/ref-self-async.rs:44:66 @@ -107,16 +102,15 @@ LL | async fn box_pin_ref_Self(self: Box>, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:44:71 - | -LL | async fn box_pin_ref_Self(self: Box>, f: &u32) -> &u32 { - | _____________________________________________-_________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + --> $DIR/ref-self-async.rs:45:9 + | +LL | async fn box_pin_ref_Self(self: Box>, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/ref-self-async.rs:48:69 @@ -127,16 +121,15 @@ LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:48:73 - | -LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 { - | ____________________________________________-____________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` + --> $DIR/ref-self-async.rs:49:9 + | +LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error: aborting due to 14 previous errors diff --git a/src/test/ui/self/elision/ref-struct-async.nll.stderr b/src/test/ui/self/elision/ref-struct-async.nll.stderr index 8508e42264b..93fec69ec34 100644 --- a/src/test/ui/self/elision/ref-struct-async.nll.stderr +++ b/src/test/ui/self/elision/ref-struct-async.nll.stderr @@ -7,16 +7,15 @@ LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-struct-async.rs:13:57 + --> $DIR/ref-struct-async.rs:14:9 | -LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 { - | _______________________________-_________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` +LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/ref-struct-async.rs:17:61 @@ -27,16 +26,15 @@ LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-struct-async.rs:17:66 + --> $DIR/ref-struct-async.rs:18:9 | -LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 { - | _______________________________________-__________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` +LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/ref-struct-async.rs:21:61 @@ -47,16 +45,15 @@ LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-struct-async.rs:21:66 + --> $DIR/ref-struct-async.rs:22:9 | -LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 { - | _______________________________________-__________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` +LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/ref-struct-async.rs:25:70 @@ -67,16 +64,15 @@ LL | async fn box_box_ref_Struct(self: Box>, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-struct-async.rs:25:75 + --> $DIR/ref-struct-async.rs:26:9 | -LL | async fn box_box_ref_Struct(self: Box>, f: &u32) -> &u32 { - | _______________________________________________-___________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` +LL | async fn box_box_ref_Struct(self: Box>, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/ref-struct-async.rs:29:66 @@ -87,16 +83,15 @@ LL | async fn box_pin_Struct(self: Box>, f: &u32) -> &u32 { = note: hidden type `impl std::future::Future` captures lifetime '_#15r error: lifetime may not live long enough - --> $DIR/ref-struct-async.rs:29:71 + --> $DIR/ref-struct-async.rs:30:9 | -LL | async fn box_pin_Struct(self: Box>, f: &u32) -> &u32 { - | ___________________________________________-___________________________^ - | | | - | | lifetime `'_` defined here - | | lifetime `'_` defined here -LL | | f -LL | | } - | |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` +LL | async fn box_pin_Struct(self: Box>, f: &u32) -> &u32 { + | - + | | + | lifetime `'_` defined here + | lifetime `'_` defined here +LL | f + | ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_` error: aborting due to 10 previous errors -- cgit 1.4.1-3-g733a5