If you try compiling something that includes a recursive async function with -Zmir-opt-level=3 or higher, rustc gives an error.
pub async fn foo(n: usize) {
if n > 0 {
Box::pin(foo(n - 1)).await;
}
}
error[E0733]: recursion in an async fn requires boxing
--> src/main.rs:1:1
|
1 | pub async fn foo(n: usize) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future
It looks like the responsible pass is DataflowConstProp where coroutines should probably be skipped like others do.
If you try compiling something that includes a recursive async function with -Zmir-opt-level=3 or higher, rustc gives an error.
It looks like the responsible pass is DataflowConstProp where coroutines should probably be skipped like others do.