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.
This commit is contained in:
parent
4295eea903
commit
7bb2d8b076
2 changed files with 4 additions and 4 deletions
|
@ -1420,8 +1420,8 @@ fn check_opaque_for_cycles<'tcx>(
|
|||
tcx.sess, span, E0733,
|
||||
"recursion in an `async fn` requires boxing",
|
||||
)
|
||||
.span_label(span, "an `async fn` cannot invoke itself directly")
|
||||
.note("a recursive `async fn` must be rewritten to return a boxed future.")
|
||||
.span_label(span, "recursive `async fn`")
|
||||
.note("a recursive `async fn` must be rewritten to return a boxed `dyn Future`.")
|
||||
.emit();
|
||||
} else {
|
||||
let mut err = struct_span_err!(
|
||||
|
|
|
@ -2,9 +2,9 @@ error[E0733]: recursion in an `async fn` requires boxing
|
|||
--> $DIR/recursive-async-impl-trait-type.rs:5:40
|
||||
|
|
||||
LL | async fn recursive_async_function() -> () {
|
||||
| ^^ an `async fn` cannot invoke itself directly
|
||||
| ^^ recursive `async fn`
|
||||
|
|
||||
= note: a recursive `async fn` must be rewritten to return a boxed future.
|
||||
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`.
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
Loading…
Reference in a new issue