mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
Merge pull request #18594 from ChayimFriedman2/async-closures
feat: Support `AsyncFnX` traits
This commit is contained in:
commit
abc7147bb7
9 changed files with 289 additions and 66 deletions
|
@ -37,4 +37,25 @@ fn foo() {
|
|||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_error_for_async_fn_traits() {
|
||||
check_diagnostics(
|
||||
r#"
|
||||
//- minicore: async_fn
|
||||
async fn f(it: impl AsyncFn(u32) -> i32) {
|
||||
let fut = it(0);
|
||||
let _: i32 = fut.await;
|
||||
}
|
||||
async fn g(mut it: impl AsyncFnMut(u32) -> i32) {
|
||||
let fut = it(0);
|
||||
let _: i32 = fut.await;
|
||||
}
|
||||
async fn h(it: impl AsyncFnOnce(u32) -> i32) {
|
||||
let fut = it(0);
|
||||
let _: i32 = fut.await;
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue