Add additional tests for static AFIT
This commit is contained in:
parent
11b1439380
commit
9a05081d5f
9 changed files with 169 additions and 0 deletions
21
src/test/ui/async-await/in-trait/async-recursive-generic.rs
Normal file
21
src/test/ui/async-await/in-trait/async-recursive-generic.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
// edition: 2021
|
||||
|
||||
#![feature(async_fn_in_trait)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
trait MyTrait<T> {
|
||||
async fn foo_recursive(&self, n: usize) -> T;
|
||||
}
|
||||
|
||||
impl<T> MyTrait<T> for T where T: Copy {
|
||||
async fn foo_recursive(&self, n: usize) -> T {
|
||||
//~^ ERROR recursion in an `async fn` requires boxing
|
||||
if n > 0 {
|
||||
self.foo_recursive(n - 1).await
|
||||
} else {
|
||||
*self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
Add table
Add a link
Reference in a new issue