diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-07-26 17:38:47 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-08-02 13:24:40 +0200 |
| commit | 507f403f952501d9c2c819c5306c0ee4af3183bd (patch) | |
| tree | 45c3e7d0b31a96e89196542afd0dbc1c7bfd5a55 | |
| parent | 9e92106d457abd14f82adc29e7f2496861e07916 (diff) | |
| download | rust-507f403f952501d9c2c819c5306c0ee4af3183bd.tar.gz rust-507f403f952501d9c2c819c5306c0ee4af3183bd.zip | |
Clean up E0733 explanation
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0733.md | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/librustc_error_codes/error_codes/E0733.md b/src/librustc_error_codes/error_codes/E0733.md index 0bda7a7d682..051b75148e5 100644 --- a/src/librustc_error_codes/error_codes/E0733.md +++ b/src/librustc_error_codes/error_codes/E0733.md @@ -1,4 +1,6 @@ -Recursion in an `async fn` requires boxing. For example, this will not compile: +An [`async`] function used recursion without boxing. + +Erroneous code example: ```edition2018,compile_fail,E0733 async fn foo(n: usize) { @@ -8,8 +10,8 @@ async fn foo(n: usize) { } ``` -To achieve async recursion, the `async fn` needs to be desugared -such that the `Future` is explicit in the return type: +To perform async recursion, the `async fn` needs to be desugared such that the +`Future` is explicit in the return type: ```edition2018,compile_fail,E0720 use std::future::Future; @@ -36,5 +38,7 @@ fn foo_recursive(n: usize) -> Pin<Box<dyn Future<Output = ()>>> { } ``` -The `Box<...>` ensures that the result is of known size, -and the pin is required to keep it in the same place in memory. +The `Box<...>` ensures that the result is of known size, and the pin is +required to keep it in the same place in memory. + +[`async`]: https://doc.rust-lang.org/std/keyword.async.html |
