Skip to content

Commit 2e8e591

Browse files
authored
Rollup merge of #81926 - henryboisdequin:fix-81907, r=estebank
add suggestion to use the `async_recursion` crate Closes #81907 CC `@estebank`
2 parents 40fa6fc + 4af417a commit 2e8e591

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
@@ -1505,6 +1505,9 @@ fn async_opaque_type_cycle_error(tcx: TyCtxt<'tcx>, span: Span) {
15051505
struct_span_err!(tcx.sess, span, E0733, "recursion in an `async fn` requires boxing")
15061506
.span_label(span, "recursive `async fn`")
15071507
.note("a recursive `async fn` must be rewritten to return a boxed `dyn Future`")
1508+
.note(
1509+
"consider using the `async_recursion` crate: https://crates.io/crates/async_recursion",
1510+
)
15081511
.emit();
15091512
}
15101513

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)