Skip to content

Commit 4af417a

Browse files
add suggestion to use the async_recursion crate
1 parent 1279b3b commit 4af417a

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

compiler/rustc_typeck/src/check/check.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1446,6 +1446,9 @@ fn async_opaque_type_cycle_error(tcx: TyCtxt<'tcx>, span: Span) {
14461446
struct_span_err!(tcx.sess, span, E0733, "recursion in an `async fn` requires boxing")
14471447
.span_label(span, "recursive `async fn`")
14481448
.note("a recursive `async fn` must be rewritten to return a boxed `dyn Future`")
1449+
.note(
1450+
"consider using the `async_recursion` crate: https://crates.io/crates/async_recursion",
1451+
)
14491452
.emit();
14501453
}
14511454

src/test/ui/async-await/mutually-recursive-async-impl-trait-type.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | async fn rec_1() {
55
| ^ recursive `async fn`
66
|
77
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
8+
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
89

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

1719
error: aborting due to 2 previous errors
1820

src/test/ui/async-await/recursive-async-impl-trait-type.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | async fn recursive_async_function() -> () {
55
| ^^ recursive `async fn`
66
|
77
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
8+
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
89

910
error: aborting due to previous error
1011

0 commit comments

Comments
 (0)