]> git.lizzy.rs Git - rust.git/commitdiff
add suggestion to use the `async_recursion` crate
authorHenry Boisdequin <65845077+henryboisdequin@users.noreply.github.com>
Tue, 9 Feb 2021 13:13:39 +0000 (18:43 +0530)
committerHenry Boisdequin <65845077+henryboisdequin@users.noreply.github.com>
Tue, 9 Feb 2021 13:13:39 +0000 (18:43 +0530)
compiler/rustc_typeck/src/check/check.rs
src/test/ui/async-await/mutually-recursive-async-impl-trait-type.stderr
src/test/ui/async-await/recursive-async-impl-trait-type.stderr

index ab3c26fac8338a03ba0c707780a64def2018f38d..f0bc31641b4c9237e3d453f54894b35e9500ff5e 100644 (file)
@@ -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();
 }
 
index f6e4c8be29260a5f769c3290ca68bbbf25926e79..f789ad2a05c7d5499b898f1f9f79c0bdee5bdc97 100644 (file)
@@ -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
 
index 892d91e3a4992706fdb93558374f7d5048829e4d..63f64f4455749acbec7833cd1aa24319ffdcfefd 100644 (file)
@@ -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