Point to full async fn for future

This commit is contained in:
Michael Goulet 2023-10-02 21:31:46 +00:00
parent 2e5a9dd6c9
commit 2934fe07b7
18 changed files with 68 additions and 64 deletions

View File

@ -1824,7 +1824,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
} }
let fn_def_id = self.local_def_id(fn_node_id); let fn_def_id = self.local_def_id(fn_node_id);
self.lower_async_fn_ret_ty(&decl.output, fn_def_id, ret_id, kind) self.lower_async_fn_ret_ty(&decl.output, fn_def_id, ret_id, kind, fn_span)
} else { } else {
match &decl.output { match &decl.output {
FnRetTy::Ty(ty) => { FnRetTy::Ty(ty) => {
@ -1901,8 +1901,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
fn_def_id: LocalDefId, fn_def_id: LocalDefId,
opaque_ty_node_id: NodeId, opaque_ty_node_id: NodeId,
fn_kind: FnDeclKind, fn_kind: FnDeclKind,
fn_span: Span,
) -> hir::FnRetTy<'hir> { ) -> hir::FnRetTy<'hir> {
let span = self.lower_span(output.span()); let span = self.lower_span(fn_span);
let opaque_ty_span = self.mark_span_with_reason(DesugaringKind::Async, span, None); let opaque_ty_span = self.mark_span_with_reason(DesugaringKind::Async, span, None);
let captured_lifetimes: Vec<_> = self let captured_lifetimes: Vec<_> = self

View File

@ -1,8 +1,8 @@
warning: future cannot be sent between threads safely warning: future cannot be sent between threads safely
--> $DIR/ice-10645.rs:5:35 --> $DIR/ice-10645.rs:5:1
| |
LL | pub async fn bar<'a, T: 'a>(_: T) {} LL | pub async fn bar<'a, T: 'a>(_: T) {}
| ^ future returned by `bar` is not `Send` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `bar` is not `Send`
| |
note: captured value is not `Send` note: captured value is not `Send`
--> $DIR/ice-10645.rs:5:29 --> $DIR/ice-10645.rs:5:29

View File

@ -1,8 +1,8 @@
error: future cannot be sent between threads safely error: future cannot be sent between threads safely
--> $DIR/future_not_send.rs:7:62 --> $DIR/future_not_send.rs:7:1
| |
LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool { LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
| ^^^^ future returned by `private_future` is not `Send` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `private_future` is not `Send`
| |
note: future is not `Send` as this value is used across an await note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:9:20 --> $DIR/future_not_send.rs:9:20
@ -23,10 +23,10 @@ LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
= help: to override `-D warnings` add `#[allow(clippy::future_not_send)]` = help: to override `-D warnings` add `#[allow(clippy::future_not_send)]`
error: future cannot be sent between threads safely error: future cannot be sent between threads safely
--> $DIR/future_not_send.rs:12:42 --> $DIR/future_not_send.rs:12:1
| |
LL | pub async fn public_future(rc: Rc<[u8]>) { LL | pub async fn public_future(rc: Rc<[u8]>) {
| ^ future returned by `public_future` is not `Send` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `public_future` is not `Send`
| |
note: future is not `Send` as this value is used across an await note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:14:20 --> $DIR/future_not_send.rs:14:20
@ -39,10 +39,10 @@ LL | async { true }.await;
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send` = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
error: future cannot be sent between threads safely error: future cannot be sent between threads safely
--> $DIR/future_not_send.rs:21:63 --> $DIR/future_not_send.rs:21:1
| |
LL | async fn private_future2(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool { LL | async fn private_future2(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
| ^^^^ future returned by `private_future2` is not `Send` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `private_future2` is not `Send`
| |
note: captured value is not `Send` note: captured value is not `Send`
--> $DIR/future_not_send.rs:21:26 --> $DIR/future_not_send.rs:21:26
@ -58,10 +58,10 @@ LL | async fn private_future2(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
= note: `std::cell::Cell<usize>` doesn't implement `std::marker::Sync` = note: `std::cell::Cell<usize>` doesn't implement `std::marker::Sync`
error: future cannot be sent between threads safely error: future cannot be sent between threads safely
--> $DIR/future_not_send.rs:26:43 --> $DIR/future_not_send.rs:26:1
| |
LL | pub async fn public_future2(rc: Rc<[u8]>) {} LL | pub async fn public_future2(rc: Rc<[u8]>) {}
| ^ future returned by `public_future2` is not `Send` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `public_future2` is not `Send`
| |
note: captured value is not `Send` note: captured value is not `Send`
--> $DIR/future_not_send.rs:26:29 --> $DIR/future_not_send.rs:26:29
@ -71,10 +71,10 @@ LL | pub async fn public_future2(rc: Rc<[u8]>) {}
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send` = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
error: future cannot be sent between threads safely error: future cannot be sent between threads safely
--> $DIR/future_not_send.rs:38:39 --> $DIR/future_not_send.rs:38:5
| |
LL | async fn private_future(&self) -> usize { LL | async fn private_future(&self) -> usize {
| ^^^^^ future returned by `private_future` is not `Send` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `private_future` is not `Send`
| |
note: future is not `Send` as this value is used across an await note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:40:24 --> $DIR/future_not_send.rs:40:24
@ -87,10 +87,10 @@ LL | async { true }.await;
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync` = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync`
error: future cannot be sent between threads safely error: future cannot be sent between threads safely
--> $DIR/future_not_send.rs:44:39 --> $DIR/future_not_send.rs:44:5
| |
LL | pub async fn public_future(&self) { LL | pub async fn public_future(&self) {
| ^ future returned by `public_future` is not `Send` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `public_future` is not `Send`
| |
note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync` note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
--> $DIR/future_not_send.rs:44:32 --> $DIR/future_not_send.rs:44:32
@ -100,10 +100,13 @@ LL | pub async fn public_future(&self) {
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync` = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync`
error: future cannot be sent between threads safely error: future cannot be sent between threads safely
--> $DIR/future_not_send.rs:55:37 --> $DIR/future_not_send.rs:55:1
| |
LL | async fn generic_future<T>(t: T) -> T LL | / async fn generic_future<T>(t: T) -> T
| ^ future returned by `generic_future` is not `Send` LL | |
LL | | where
LL | | T: Send,
| |____________^ future returned by `generic_future` is not `Send`
| |
note: future is not `Send` as this value is used across an await note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:61:20 --> $DIR/future_not_send.rs:61:20
@ -115,10 +118,10 @@ LL | async { true }.await;
= note: `T` doesn't implement `std::marker::Sync` = note: `T` doesn't implement `std::marker::Sync`
error: future cannot be sent between threads safely error: future cannot be sent between threads safely
--> $DIR/future_not_send.rs:73:34 --> $DIR/future_not_send.rs:73:1
| |
LL | async fn unclear_future<T>(t: T) {} LL | async fn unclear_future<T>(t: T) {}
| ^ future returned by `unclear_future` is not `Send` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `unclear_future` is not `Send`
| |
note: captured value is not `Send` note: captured value is not `Send`
--> $DIR/future_not_send.rs:73:28 --> $DIR/future_not_send.rs:73:28

View File

@ -22,7 +22,7 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely
--> $DIR/async-await-let-else.rs:47:13 --> $DIR/async-await-let-else.rs:47:13
| |
LL | async fn foo2(x: Option<bool>) { LL | async fn foo2(x: Option<bool>) {
| - within this `impl Future<Output = ()>` | ------------------------------ within this `impl Future<Output = ()>`
... ...
LL | is_send(foo2(Some(true))); LL | is_send(foo2(Some(true)));
| ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely | ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely

View File

@ -1,8 +1,8 @@
error[E0053]: method `foo` has an incompatible type for trait error[E0053]: method `foo` has an incompatible type for trait
--> $DIR/async-example-desugared-boxed-in-trait.rs:15:28 --> $DIR/async-example-desugared-boxed-in-trait.rs:15:5
| |
LL | async fn foo(&self) -> i32 { LL | async fn foo(&self) -> i32 {
| ^^^ expected `Pin<Box<dyn Future<Output = i32>>>`, found future | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Pin<Box<dyn Future<Output = i32>>>`, found future
| |
note: type in trait note: type in trait
--> $DIR/async-example-desugared-boxed-in-trait.rs:11:22 --> $DIR/async-example-desugared-boxed-in-trait.rs:11:22

View File

@ -1,8 +1,8 @@
error[E0311]: the parameter type `U` may not live long enough error[E0311]: the parameter type `U` may not live long enough
--> $DIR/async-generics-and-bounds.rs:12:28 --> $DIR/async-generics-and-bounds.rs:12:5
| |
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
note: the parameter type `U` must be valid for the anonymous lifetime as defined here... note: the parameter type `U` must be valid for the anonymous lifetime as defined here...
--> $DIR/async-generics-and-bounds.rs:12:18 --> $DIR/async-generics-and-bounds.rs:12:18
@ -10,16 +10,16 @@ note: the parameter type `U` must be valid for the anonymous lifetime as defined
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^ | ^
note: ...so that the reference type `&(T, U)` does not outlive the data it points at note: ...so that the reference type `&(T, U)` does not outlive the data it points at
--> $DIR/async-generics-and-bounds.rs:12:28 --> $DIR/async-generics-and-bounds.rs:12:5
| |
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0311]: the parameter type `T` may not live long enough error[E0311]: the parameter type `T` may not live long enough
--> $DIR/async-generics-and-bounds.rs:12:28 --> $DIR/async-generics-and-bounds.rs:12:5
| |
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
note: the parameter type `T` must be valid for the anonymous lifetime as defined here... note: the parameter type `T` must be valid for the anonymous lifetime as defined here...
--> $DIR/async-generics-and-bounds.rs:12:18 --> $DIR/async-generics-and-bounds.rs:12:18
@ -27,10 +27,10 @@ note: the parameter type `T` must be valid for the anonymous lifetime as defined
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^ | ^
note: ...so that the reference type `&(T, U)` does not outlive the data it points at note: ...so that the reference type `&(T, U)` does not outlive the data it points at
--> $DIR/async-generics-and-bounds.rs:12:28 --> $DIR/async-generics-and-bounds.rs:12:5
| |
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -1,8 +1,8 @@
error[E0311]: the parameter type `U` may not live long enough error[E0311]: the parameter type `U` may not live long enough
--> $DIR/async-generics.rs:9:28 --> $DIR/async-generics.rs:9:5
| |
LL | async fn foo(&self) -> &(T, U); LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
note: the parameter type `U` must be valid for the anonymous lifetime as defined here... note: the parameter type `U` must be valid for the anonymous lifetime as defined here...
--> $DIR/async-generics.rs:9:18 --> $DIR/async-generics.rs:9:18
@ -10,16 +10,16 @@ note: the parameter type `U` must be valid for the anonymous lifetime as defined
LL | async fn foo(&self) -> &(T, U); LL | async fn foo(&self) -> &(T, U);
| ^ | ^
note: ...so that the reference type `&(T, U)` does not outlive the data it points at note: ...so that the reference type `&(T, U)` does not outlive the data it points at
--> $DIR/async-generics.rs:9:28 --> $DIR/async-generics.rs:9:5
| |
LL | async fn foo(&self) -> &(T, U); LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0311]: the parameter type `T` may not live long enough error[E0311]: the parameter type `T` may not live long enough
--> $DIR/async-generics.rs:9:28 --> $DIR/async-generics.rs:9:5
| |
LL | async fn foo(&self) -> &(T, U); LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
note: the parameter type `T` must be valid for the anonymous lifetime as defined here... note: the parameter type `T` must be valid for the anonymous lifetime as defined here...
--> $DIR/async-generics.rs:9:18 --> $DIR/async-generics.rs:9:18
@ -27,10 +27,10 @@ note: the parameter type `T` must be valid for the anonymous lifetime as defined
LL | async fn foo(&self) -> &(T, U); LL | async fn foo(&self) -> &(T, U);
| ^ | ^
note: ...so that the reference type `&(T, U)` does not outlive the data it points at note: ...so that the reference type `&(T, U)` does not outlive the data it points at
--> $DIR/async-generics.rs:9:28 --> $DIR/async-generics.rs:9:5
| |
LL | async fn foo(&self) -> &(T, U); LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -1,8 +1,8 @@
error[E0733]: recursion in an `async fn` requires boxing error[E0733]: recursion in an `async fn` requires boxing
--> $DIR/async-recursive-generic.rs:11:48 --> $DIR/async-recursive-generic.rs:11:5
| |
LL | async fn foo_recursive(&self, n: usize) -> T { LL | async fn foo_recursive(&self, n: usize) -> T {
| ^ recursive `async fn` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive `async fn`
| |
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion

View File

@ -1,8 +1,8 @@
error[E0733]: recursion in an `async fn` requires boxing error[E0733]: recursion in an `async fn` requires boxing
--> $DIR/async-recursive.rs:11:48 --> $DIR/async-recursive.rs:11:5
| |
LL | async fn foo_recursive(&self, n: usize) -> i32 { LL | async fn foo_recursive(&self, n: usize) -> i32 {
| ^^^ recursive `async fn` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive `async fn`
| |
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion

View File

@ -1,14 +1,14 @@
error[E0053]: method `foo` has an incompatible type for trait error[E0053]: method `foo` has an incompatible type for trait
--> $DIR/dont-project-to-specializable-projection.rs:14:35 --> $DIR/dont-project-to-specializable-projection.rs:14:5
| |
LL | default async fn foo(_: T) -> &'static str { LL | default async fn foo(_: T) -> &'static str {
| ^^^^^^^^^^^^ expected associated type, found future | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found future
| |
note: type in trait note: type in trait
--> $DIR/dont-project-to-specializable-projection.rs:10:27 --> $DIR/dont-project-to-specializable-projection.rs:10:5
| |
LL | async fn foo(_: T) -> &'static str; LL | async fn foo(_: T) -> &'static str;
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: expected signature `fn(_) -> impl Future<Output = &'static str>` = note: expected signature `fn(_) -> impl Future<Output = &'static str>`
found signature `fn(_) -> impl Future<Output = &'static str>` found signature `fn(_) -> impl Future<Output = &'static str>`

View File

@ -2,7 +2,7 @@ error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output
--> $DIR/issue-64130-3-other.rs:25:12 --> $DIR/issue-64130-3-other.rs:25:12
| |
LL | async fn bar() { LL | async fn bar() {
| - within this `impl Future<Output = ()>` | -------------- within this `impl Future<Output = ()>`
... ...
LL | is_qux(bar()); LL | is_qux(bar());
| ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo` | ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`

View File

@ -6,10 +6,10 @@ LL | g(issue_67893::run())
| | | |
| required by a bound introduced by this call | required by a bound introduced by this call
| |
::: $DIR/auxiliary/issue_67893.rs:9:20 ::: $DIR/auxiliary/issue_67893.rs:9:1
| |
LL | pub async fn run() { LL | pub async fn run() {
| - within this `impl Future<Output = ()>` | ------------------ within this `impl Future<Output = ()>`
| |
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, ()>` = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
= note: required because it captures the following types: `Arc<Mutex<()>>`, `MutexGuard<'_, ()>`, `impl Future<Output = ()>` = note: required because it captures the following types: `Arc<Mutex<()>>`, `MutexGuard<'_, ()>`, `impl Future<Output = ()>`

View File

@ -1,17 +1,17 @@
error[E0733]: recursion in an `async fn` requires boxing error[E0733]: recursion in an `async fn` requires boxing
--> $DIR/mutually-recursive-async-impl-trait-type.rs:5:18 --> $DIR/mutually-recursive-async-impl-trait-type.rs:5:1
| |
LL | async fn rec_1() { LL | async fn rec_1() {
| ^ recursive `async fn` | ^^^^^^^^^^^^^^^^ recursive `async fn`
| |
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
error[E0733]: recursion in an `async fn` requires boxing error[E0733]: recursion in an `async fn` requires boxing
--> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18 --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:1
| |
LL | async fn rec_2() { LL | async fn rec_2() {
| ^ recursive `async fn` | ^^^^^^^^^^^^^^^^ recursive `async fn`
| |
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion

View File

@ -7,7 +7,7 @@ LL | gimme_send(foo());
| required by a bound introduced by this call | required by a bound introduced by this call
... ...
LL | async fn foo() { LL | async fn foo() {
| - within this `impl Future<Output = ()>` | -------------- within this `impl Future<Output = ()>`
| |
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NotSend` = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NotSend`
= note: required because it appears within the type `(NotSend,)` = note: required because it appears within the type `(NotSend,)`

View File

@ -1,8 +1,8 @@
error[E0733]: recursion in an `async fn` requires boxing error[E0733]: recursion in an `async fn` requires boxing
--> $DIR/recursive-async-impl-trait-type.rs:5:40 --> $DIR/recursive-async-impl-trait-type.rs:5:1
| |
LL | async fn recursive_async_function() -> () { LL | async fn recursive_async_function() -> () {
| ^^ recursive `async fn` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive `async fn`
| |
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion

View File

@ -26,9 +26,9 @@ error: lifetime may not live long enough
--> $DIR/impl-trait-missing-lifetime.rs:16:69 --> $DIR/impl-trait-missing-lifetime.rs:16:69
| |
LL | async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } LL | async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
| -------------- ^^^^^^^^ returning this value requires that `'1` must outlive `'static` | ----------------------------------------------------------------- ^^^^^^^^ returning this value requires that `'1` must outlive `'static`
| | | |
| return type `impl Future<Output = Option<&'static ()>>` contains a lifetime `'1` | return type `impl Future<Output = Option<&'static ()>>` contains a lifetime `'1`
error: aborting due to 3 previous errors error: aborting due to 3 previous errors

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/suggest-ret-on-async-w-late.rs:7:5 --> $DIR/suggest-ret-on-async-w-late.rs:7:5
| |
LL | async fn ice(_: &i32) { LL | async fn ice(_: &i32) {
| - help: try adding a return type: `-> bool` | --------------------- help: try adding a return type: `-> bool`
LL | true LL | true
| ^^^^ expected `()`, found `bool` | ^^^^ expected `()`, found `bool`

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-90027-async-fn-return-suggestion.rs:4:5 --> $DIR/issue-90027-async-fn-return-suggestion.rs:4:5
| |
LL | async fn hello() { LL | async fn hello() {
| - help: try adding a return type: `-> i32` | ---------------- help: try adding a return type: `-> i32`
LL | 0 LL | 0
| ^ expected `()`, found integer | ^ expected `()`, found integer
@ -10,7 +10,7 @@ error[E0308]: mismatched types
--> $DIR/issue-90027-async-fn-return-suggestion.rs:9:5 --> $DIR/issue-90027-async-fn-return-suggestion.rs:9:5
| |
LL | async fn world() -> () { LL | async fn world() -> () {
| -- expected `()` because of return type | ---------------------- expected `()` because of return type
LL | 0 LL | 0
| ^ expected `()`, found integer | ^ expected `()`, found integer