Skip to content

Commit 5323b9f

Browse files
authored
Rollup merge of #74781 - GuillaumeGomez:cleanup-e0733, r=jyn514
Clean up E0733 explanation r? @Dylan-DPC
2 parents 814b31e + 507f403 commit 5323b9f

File tree

1 file changed

+9
-5
lines changed
  • src/librustc_error_codes/error_codes

1 file changed

+9
-5
lines changed

src/librustc_error_codes/error_codes/E0733.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
Recursion in an `async fn` requires boxing. For example, this will not compile:
1+
An [`async`] function used recursion without boxing.
2+
3+
Erroneous code example:
24

35
```edition2018,compile_fail,E0733
46
async fn foo(n: usize) {
@@ -8,8 +10,8 @@ async fn foo(n: usize) {
810
}
911
```
1012

11-
To achieve async recursion, the `async fn` needs to be desugared
12-
such that the `Future` is explicit in the return type:
13+
To perform async recursion, the `async fn` needs to be desugared such that the
14+
`Future` is explicit in the return type:
1315

1416
```edition2018,compile_fail,E0720
1517
use std::future::Future;
@@ -36,5 +38,7 @@ fn foo_recursive(n: usize) -> Pin<Box<dyn Future<Output = ()>>> {
3638
}
3739
```
3840

39-
The `Box<...>` ensures that the result is of known size,
40-
and the pin is required to keep it in the same place in memory.
41+
The `Box<...>` ensures that the result is of known size, and the pin is
42+
required to keep it in the same place in memory.
43+
44+
[`async`]: https://doc.rust-lang.org/std/keyword.async.html

0 commit comments

Comments
 (0)