diff options
| author | Matthew Jasper <mjjasper1@gmail.com> | 2019-08-31 15:43:24 +0100 |
|---|---|---|
| committer | Matthew Jasper <mjjasper1@gmail.com> | 2019-08-31 15:43:24 +0100 |
| commit | 7bb2d8b0765e6737f43b501135d91bc8ab64db7a (patch) | |
| tree | ff229d479bdf4b0a94dac675170562165790344d | |
| parent | 4295eea903a9e1014ee30f82930f5ec08d888077 (diff) | |
| download | rust-7bb2d8b0765e6737f43b501135d91bc8ab64db7a.tar.gz rust-7bb2d8b0765e6737f43b501135d91bc8ab64db7a.zip | |
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.
| -rw-r--r-- | src/librustc_typeck/check/mod.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/async-await/recursive-async-impl-trait-type.stderr | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index a80550486d6..7855008a282 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -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!( diff --git a/src/test/ui/async-await/recursive-async-impl-trait-type.stderr b/src/test/ui/async-await/recursive-async-impl-trait-type.stderr index 8781a9c444d..9ee01402180 100644 --- a/src/test/ui/async-await/recursive-async-impl-trait-type.stderr +++ b/src/test/ui/async-await/recursive-async-impl-trait-type.stderr @@ -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 |
