2022-10-07 11:15:13 -05:00
|
|
|
//@ edition: 2021
|
|
|
|
|
|
|
|
trait MyTrait {
|
|
|
|
async fn foo_recursive(&self, n: usize) -> i32;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl MyTrait for i32 {
|
|
|
|
async fn foo_recursive(&self, n: usize) -> i32 {
|
2023-11-08 01:19:01 -06:00
|
|
|
//~^ ERROR recursion in an async fn requires boxing
|
2022-10-07 11:15:13 -05:00
|
|
|
if n > 0 {
|
|
|
|
self.foo_recursive(n - 1).await
|
|
|
|
} else {
|
|
|
|
*self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|