Skip to content

Commit 7bb2d8b

Browse files
committed
Slightly clean up the error for recursive async fn
* Make it clear that type erasure is required, not just pointer indirection. * Don't make the message specific to direct recursion.
1 parent 4295eea commit 7bb2d8b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/librustc_typeck/check/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1420,8 +1420,8 @@ fn check_opaque_for_cycles<'tcx>(
14201420
tcx.sess, span, E0733,
14211421
"recursion in an `async fn` requires boxing",
14221422
)
1423-
.span_label(span, "an `async fn` cannot invoke itself directly")
1424-
.note("a recursive `async fn` must be rewritten to return a boxed future.")
1423+
.span_label(span, "recursive `async fn`")
1424+
.note("a recursive `async fn` must be rewritten to return a boxed `dyn Future`.")
14251425
.emit();
14261426
} else {
14271427
let mut err = struct_span_err!(

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ error[E0733]: recursion in an `async fn` requires boxing
22
--> $DIR/recursive-async-impl-trait-type.rs:5:40
33
|
44
LL | async fn recursive_async_function() -> () {
5-
| ^^ an `async fn` cannot invoke itself directly
5+
| ^^ recursive `async fn`
66
|
7-
= note: a recursive `async fn` must be rewritten to return a boxed future.
7+
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`.
88

99
error: aborting due to previous error
1010

0 commit comments

Comments
 (0)