mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
Support AsyncFnX
traits
Only in calls, because to support them in bounds we need support from Chalk. However we don't yet report error from bounds anyway, so this is less severe. The returned future is shown in its name within inlay hints instead of as a nicer `impl Future`, but that can wait for another PR.
This commit is contained in:
parent
e6276c8b64
commit
4049c3b6a9
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