Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/tests/traits.rs')
| -rw-r--r-- | crates/hir-ty/src/tests/traits.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/hir-ty/src/tests/traits.rs b/crates/hir-ty/src/tests/traits.rs index 278666ef35..bcb5e5de16 100644 --- a/crates/hir-ty/src/tests/traits.rs +++ b/crates/hir-ty/src/tests/traits.rs @@ -124,6 +124,25 @@ async fn test() { } #[test] +fn infer_async_gen_closure() { + check( + r#" +//- minicore: async_iterator, fn, add, builtin_impls +//- /main.rs edition:2024 +fn test() { + let f = async gen move |x: i32| { + yield x + 42; + //^^^^^^ expected Poll<Option<{unknown}>>, got i32 + }; + let a = f(4); + a; +// ^ type: impl AsyncIterator<Item = {unknown}> +} +"#, + ); +} + +#[test] fn auto_sized_async_block() { check_no_mismatches( r#" |