about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/ui/async-await/issues/issue-63388-1.nll.stderr24
-rw-r--r--src/test/ui/async-await/issues/issue-63388-2.nll.stderr11
-rw-r--r--src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.nll.stderr49
-rw-r--r--src/test/ui/self/elision/lt-ref-self-async.nll.stderr122
-rw-r--r--src/test/ui/self/elision/ref-mut-self-async.nll.stderr122
-rw-r--r--src/test/ui/self/elision/ref-mut-struct-async.nll.stderr102
-rw-r--r--src/test/ui/self/elision/ref-self-async.nll.stderr142
-rw-r--r--src/test/ui/self/elision/ref-struct-async.nll.stderr102
8 files changed, 538 insertions, 136 deletions
diff --git a/src/test/ui/async-await/issues/issue-63388-1.nll.stderr b/src/test/ui/async-await/issues/issue-63388-1.nll.stderr
new file mode 100644
index 00000000000..fab5892dae1
--- /dev/null
+++ b/src/test/ui/async-await/issues/issue-63388-1.nll.stderr
@@ -0,0 +1,24 @@
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/issue-63388-1.rs:14:10
+   |
+LL |     ) -> &dyn Foo
+   |          ^^^^^^^^
+   |
+   = note: hidden type `impl std::future::Future` captures lifetime '_#27r
+
+error: lifetime may not live long enough
+  --> $DIR/issue-63388-1.rs:15:5
+   |
+LL |       async fn do_sth<'a>(
+   |                       -- lifetime `'a` defined here
+LL |           &'a self, foo: &dyn Foo
+   |                          - lifetime `'_` defined here
+LL |       ) -> &dyn Foo
+LL | /     {
+LL | |         foo
+LL | |     }
+   | |_____^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'_`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0700`.
diff --git a/src/test/ui/async-await/issues/issue-63388-2.nll.stderr b/src/test/ui/async-await/issues/issue-63388-2.nll.stderr
new file mode 100644
index 00000000000..b91cdc1b770
--- /dev/null
+++ b/src/test/ui/async-await/issues/issue-63388-2.nll.stderr
@@ -0,0 +1,11 @@
+error[E0106]: missing lifetime specifier
+  --> $DIR/issue-63388-2.rs:14:10
+   |
+LL |     ) -> &dyn Foo
+   |          ^ help: consider using the named lifetime: `&'a`
+   |
+   = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `foo` or `bar`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0106`.
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 65856095556..94646c2cfe0 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
@@ -1,27 +1,46 @@
-error[E0106]: missing lifetime specifier
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
   --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:10:45
    |
 LL |     async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
-   |                                             ^
+   |                                             ^^^^
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:60
+error: lifetime may not live long enough
+  --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:10:50
    |
-LL |     async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
-   |                                                            ^
-   |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+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 `'_`
+   |                          |
+   |                          lifetime `'_` defined here
+   |                          lifetime `'_` defined here
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:67
+error: lifetime may not live long enough
+  --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:13:73
    |
 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 `'_`
+   |                          |
+   |                          lifetime `'_` defined here
+   |                          lifetime `'_` defined here
+
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:19:58
+   |
+LL |     async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
+   |                                                          ^^^
+   |
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
+
+error: lifetime may not live long enough
+  --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:19:62
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+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 `'a` defined here
 
-error: aborting due to 3 previous errors
+error: aborting due to 5 previous errors
 
-For more information about this error, try `rustc --explain E0106`.
+For more information about this error, try `rustc --explain E0700`.
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 d3aeb73b9b7..779b21e21a0 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
@@ -1,51 +1,123 @@
-error[E0106]: missing lifetime specifier
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
   --> $DIR/lt-ref-self-async.rs:15:42
    |
 LL |     async fn ref_self(&self, f: &u32) -> &u32 {
-   |                                          ^
+   |                                          ^^^^
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+   = note: hidden type `impl std::future::Future` captures lifetime '_#28r
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/lt-ref-self-async.rs:23:48
+error: lifetime may not live long enough
+  --> $DIR/lt-ref-self-async.rs:15: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 `'_`
+
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/lt-ref-self-async.rs:21:48
    |
 LL |     async fn ref_Self(self: &Self, f: &u32) -> &u32 {
-   |                                                ^
+   |                                                ^^^^
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+   = note: hidden type `impl std::future::Future` captures lifetime '_#28r
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/lt-ref-self-async.rs:29:57
+error: lifetime may not live long enough
+  --> $DIR/lt-ref-self-async.rs:21: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 `'_`
+
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/lt-ref-self-async.rs:25:57
    |
 LL |     async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
-   |                                                         ^
+   |                                                         ^^^^
+   |
+   = note: hidden type `impl std::future::Future` captures lifetime '_#28r
+
+error: lifetime may not live long enough
+  --> $DIR/lt-ref-self-async.rs:25:62
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+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 `'_`
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/lt-ref-self-async.rs:35:57
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/lt-ref-self-async.rs:29:57
    |
 LL |     async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
-   |                                                         ^
+   |                                                         ^^^^
+   |
+   = note: hidden type `impl std::future::Future` captures lifetime '_#28r
+
+error: lifetime may not live long enough
+  --> $DIR/lt-ref-self-async.rs:29:62
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+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 `'_`
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/lt-ref-self-async.rs:41:66
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/lt-ref-self-async.rs:33:66
    |
 LL |     async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
-   |                                                                  ^
+   |                                                                  ^^^^
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+   = note: hidden type `impl std::future::Future` captures lifetime '_#28r
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/lt-ref-self-async.rs:47:62
+error: lifetime may not live long enough
+  --> $DIR/lt-ref-self-async.rs:33:71
+   |
+LL |       async fn box_box_ref_Self(self: Box<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 `'_`
+
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/lt-ref-self-async.rs:37:62
    |
 LL |     async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
-   |                                                              ^
+   |                                                              ^^^^
+   |
+   = note: hidden type `impl std::future::Future` captures lifetime '_#28r
+
+error: lifetime may not live long enough
+  --> $DIR/lt-ref-self-async.rs:37:67
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+LL |       async fn box_pin_Self(self: Box<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 `'_`
 
-error: aborting due to 6 previous errors
+error: aborting due to 12 previous errors
 
-For more information about this error, try `rustc --explain E0106`.
+For more information about this error, try `rustc --explain E0700`.
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 35969659b19..cfe91dde373 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
@@ -1,51 +1,123 @@
-error[E0106]: missing lifetime specifier
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
   --> $DIR/ref-mut-self-async.rs:15:46
    |
 LL |     async fn ref_self(&mut self, f: &u32) -> &u32 {
-   |                                              ^
+   |                                              ^^^^
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/ref-mut-self-async.rs:23:52
+error: lifetime may not live long enough
+  --> $DIR/ref-mut-self-async.rs:15: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 `'_`
+
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ref-mut-self-async.rs:21:52
    |
 LL |     async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
-   |                                                    ^
+   |                                                    ^^^^
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/ref-mut-self-async.rs:29:61
+error: lifetime may not live long enough
+  --> $DIR/ref-mut-self-async.rs:21: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 `'_`
+
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ref-mut-self-async.rs:25:61
    |
 LL |     async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
-   |                                                             ^
+   |                                                             ^^^^
+   |
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
+
+error: lifetime may not live long enough
+  --> $DIR/ref-mut-self-async.rs:25:66
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+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 `'_`
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/ref-mut-self-async.rs:35:61
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ref-mut-self-async.rs:29:61
    |
 LL |     async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
-   |                                                             ^
+   |                                                             ^^^^
+   |
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
+
+error: lifetime may not live long enough
+  --> $DIR/ref-mut-self-async.rs:29:66
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+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 `'_`
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/ref-mut-self-async.rs:41:70
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ref-mut-self-async.rs:33:70
    |
 LL |     async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
-   |                                                                      ^
+   |                                                                      ^^^^
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/ref-mut-self-async.rs:47:70
+error: lifetime may not live long enough
+  --> $DIR/ref-mut-self-async.rs:33:75
+   |
+LL |       async fn box_box_ref_Self(self: Box<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 `'_`
+
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ref-mut-self-async.rs:37:70
    |
 LL |     async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
-   |                                                                      ^
+   |                                                                      ^^^^
+   |
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
+
+error: lifetime may not live long enough
+  --> $DIR/ref-mut-self-async.rs:37:75
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+LL |       async fn box_pin_ref_Self(self: Box<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 `'_`
 
-error: aborting due to 6 previous errors
+error: aborting due to 12 previous errors
 
-For more information about this error, try `rustc --explain E0106`.
+For more information about this error, try `rustc --explain E0700`.
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 a70dcf5b0ad..98fa5e25451 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
@@ -1,43 +1,103 @@
-error[E0106]: missing lifetime specifier
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
   --> $DIR/ref-mut-struct-async.rs:15:56
    |
 LL |     async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
-   |                                                        ^
+   |                                                        ^^^^
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/ref-mut-struct-async.rs:21:65
+error: lifetime may not live long enough
+  --> $DIR/ref-mut-struct-async.rs:15:61
+   |
+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 `'_`
+
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ref-mut-struct-async.rs:19:65
    |
 LL |     async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
-   |                                                                 ^
+   |                                                                 ^^^^
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/ref-mut-struct-async.rs:27:65
+error: lifetime may not live long enough
+  --> $DIR/ref-mut-struct-async.rs:19:70
+   |
+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 `'_`
+
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ref-mut-struct-async.rs:23:65
    |
 LL |     async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
-   |                                                                 ^
+   |                                                                 ^^^^
+   |
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
+
+error: lifetime may not live long enough
+  --> $DIR/ref-mut-struct-async.rs:23:70
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+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 `'_`
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/ref-mut-struct-async.rs:33:74
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ref-mut-struct-async.rs:27:74
    |
 LL |     async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
-   |                                                                          ^
+   |                                                                          ^^^^
+   |
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
+
+error: lifetime may not live long enough
+  --> $DIR/ref-mut-struct-async.rs:27:79
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+LL |       async fn box_box_ref_Struct(self: Box<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 `'_`
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/ref-mut-struct-async.rs:39:74
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ref-mut-struct-async.rs:31:74
    |
 LL |     async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
-   |                                                                          ^
+   |                                                                          ^^^^
+   |
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
+
+error: lifetime may not live long enough
+  --> $DIR/ref-mut-struct-async.rs:31:79
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+LL |       async fn box_pin_ref_Struct(self: Box<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 `'_`
 
-error: aborting due to 5 previous errors
+error: aborting due to 10 previous errors
 
-For more information about this error, try `rustc --explain E0106`.
+For more information about this error, try `rustc --explain E0700`.
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 ae17ba9839d..f991f6d9f7f 100644
--- a/src/test/ui/self/elision/ref-self-async.nll.stderr
+++ b/src/test/ui/self/elision/ref-self-async.nll.stderr
@@ -1,59 +1,143 @@
-error[E0106]: missing lifetime specifier
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
   --> $DIR/ref-self-async.rs:24:42
    |
 LL |     async fn ref_self(&self, f: &u32) -> &u32 {
-   |                                          ^
+   |                                          ^^^^
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/ref-self-async.rs:32:48
+error: lifetime may not live long enough
+  --> $DIR/ref-self-async.rs:24: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 `'_`
+
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ref-self-async.rs:30:48
    |
 LL |     async fn ref_Self(self: &Self, f: &u32) -> &u32 {
-   |                                                ^
+   |                                                ^^^^
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/ref-self-async.rs:38:57
+error: lifetime may not live long enough
+  --> $DIR/ref-self-async.rs:30: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 `'_`
+
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ref-self-async.rs:34:57
    |
 LL |     async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
-   |                                                         ^
+   |                                                         ^^^^
+   |
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
+
+error: lifetime may not live long enough
+  --> $DIR/ref-self-async.rs:34:62
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+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 `'_`
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/ref-self-async.rs:44:57
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ref-self-async.rs:38:57
    |
 LL |     async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
-   |                                                         ^
+   |                                                         ^^^^
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/ref-self-async.rs:50:66
+error: lifetime may not live long enough
+  --> $DIR/ref-self-async.rs:38: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 `'_`
+
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ref-self-async.rs:42:66
    |
 LL |     async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
-   |                                                                  ^
+   |                                                                  ^^^^
+   |
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
+
+error: lifetime may not live long enough
+  --> $DIR/ref-self-async.rs:42:71
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+LL |       async fn box_box_ref_Self(self: Box<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 `'_`
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/ref-self-async.rs:56:66
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ref-self-async.rs:46:66
    |
 LL |     async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
-   |                                                                  ^
+   |                                                                  ^^^^
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/ref-self-async.rs:62:69
+error: lifetime may not live long enough
+  --> $DIR/ref-self-async.rs:46:71
+   |
+LL |       async fn box_pin_ref_Self(self: Box<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 `'_`
+
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ref-self-async.rs:50:69
    |
 LL |     async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
-   |                                                                     ^
+   |                                                                     ^^^
+   |
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
+
+error: lifetime may not live long enough
+  --> $DIR/ref-self-async.rs:50:73
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+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 `'_`
 
-error: aborting due to 7 previous errors
+error: aborting due to 14 previous errors
 
-For more information about this error, try `rustc --explain E0106`.
+For more information about this error, try `rustc --explain E0700`.
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 b4f12d7057d..437d403e044 100644
--- a/src/test/ui/self/elision/ref-struct-async.nll.stderr
+++ b/src/test/ui/self/elision/ref-struct-async.nll.stderr
@@ -1,43 +1,103 @@
-error[E0106]: missing lifetime specifier
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
   --> $DIR/ref-struct-async.rs:15:52
    |
 LL |     async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
-   |                                                    ^
+   |                                                    ^^^^
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/ref-struct-async.rs:21:61
+error: lifetime may not live long enough
+  --> $DIR/ref-struct-async.rs:15:57
+   |
+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 `'_`
+
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ref-struct-async.rs:19:61
    |
 LL |     async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
-   |                                                             ^
+   |                                                             ^^^^
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/ref-struct-async.rs:27:61
+error: lifetime may not live long enough
+  --> $DIR/ref-struct-async.rs:19:66
+   |
+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 `'_`
+
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ref-struct-async.rs:23:61
    |
 LL |     async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
-   |                                                             ^
+   |                                                             ^^^^
+   |
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
+
+error: lifetime may not live long enough
+  --> $DIR/ref-struct-async.rs:23:66
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+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 `'_`
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/ref-struct-async.rs:33:70
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ref-struct-async.rs:27:70
    |
 LL |     async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
-   |                                                                      ^
+   |                                                                      ^^^^
+   |
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
+
+error: lifetime may not live long enough
+  --> $DIR/ref-struct-async.rs:27:75
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+LL |       async fn box_box_ref_Struct(self: Box<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 `'_`
 
-error[E0106]: missing lifetime specifier
-  --> $DIR/ref-struct-async.rs:39:66
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ref-struct-async.rs:31:66
    |
 LL |     async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
-   |                                                                  ^
+   |                                                                  ^^^^
+   |
+   = note: hidden type `impl std::future::Future` captures lifetime '_#18r
+
+error: lifetime may not live long enough
+  --> $DIR/ref-struct-async.rs:31:71
    |
-   = note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
+LL |       async fn box_pin_Struct(self: Box<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 `'_`
 
-error: aborting due to 5 previous errors
+error: aborting due to 10 previous errors
 
-For more information about this error, try `rustc --explain E0106`.
+For more information about this error, try `rustc --explain E0700`.