diff options
| author | Henry Boisdequin <65845077+henryboisdequin@users.noreply.github.com> | 2021-02-09 18:43:39 +0530 |
|---|---|---|
| committer | Henry Boisdequin <65845077+henryboisdequin@users.noreply.github.com> | 2021-02-09 18:43:39 +0530 |
| commit | 4af417a78a1684e2c75b275ee3a0db8049ef8b0f (patch) | |
| tree | 875650c7e7361d0c22c841bfdf76ef386e87ee59 | |
| parent | 1279b3b9232e4c44112d98f19cfa8846776d1fe8 (diff) | |
| download | rust-4af417a78a1684e2c75b275ee3a0db8049ef8b0f.tar.gz rust-4af417a78a1684e2c75b275ee3a0db8049ef8b0f.zip | |
add suggestion to use the `async_recursion` crate
3 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_typeck/src/check/check.rs b/compiler/rustc_typeck/src/check/check.rs index ab3c26fac83..f0bc31641b4 100644 --- a/compiler/rustc_typeck/src/check/check.rs +++ b/compiler/rustc_typeck/src/check/check.rs @@ -1446,6 +1446,9 @@ fn async_opaque_type_cycle_error(tcx: TyCtxt<'tcx>, span: Span) { struct_span_err!(tcx.sess, span, E0733, "recursion in an `async fn` requires boxing") .span_label(span, "recursive `async fn`") .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", + ) .emit(); } diff --git a/src/test/ui/async-await/mutually-recursive-async-impl-trait-type.stderr b/src/test/ui/async-await/mutually-recursive-async-impl-trait-type.stderr index f6e4c8be292..f789ad2a05c 100644 --- a/src/test/ui/async-await/mutually-recursive-async-impl-trait-type.stderr +++ b/src/test/ui/async-await/mutually-recursive-async-impl-trait-type.stderr @@ -5,6 +5,7 @@ LL | async fn rec_1() { | ^ recursive `async fn` | = 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 error[E0733]: recursion in an `async fn` requires boxing --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18 @@ -13,6 +14,7 @@ LL | async fn rec_2() { | ^ recursive `async fn` | = 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 error: aborting due to 2 previous errors diff --git a/src/test/ui/async-await/recursive-async-impl-trait-type.stderr b/src/test/ui/async-await/recursive-async-impl-trait-type.stderr index 892d91e3a49..63f64f44557 100644 --- a/src/test/ui/async-await/recursive-async-impl-trait-type.stderr +++ b/src/test/ui/async-await/recursive-async-impl-trait-type.stderr @@ -5,6 +5,7 @@ LL | async fn recursive_async_function() -> () { | ^^ recursive `async fn` | = 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 error: aborting due to previous error |
