Skip to content

Commit

Permalink
Slightly clean up the error for recursive async fn
Browse files Browse the repository at this point in the history
* Make it clear that type erasure is required, not just pointer
  indirection.
* Don't make the message specific to direct recursion.
  • Loading branch information
matthewjasper committed Aug 31, 2019
1 parent 4295eea commit 7bb2d8b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/librustc_typeck/check/mod.rs
Expand Up @@ -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!(
Expand Down
Expand Up @@ -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

Expand Down

0 comments on commit 7bb2d8b

Please sign in to comment.