diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2024-12-10 13:51:10 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-10 13:51:10 +0100 |
| commit | 193a95d30bc10c8fca8124cad23ea3cd38eaf440 (patch) | |
| tree | 23e252f27412dce509831fc4944b2de495d5f6a1 /tests | |
| parent | 3eaa785daa92be680d8549c87f1b68b811904abd (diff) | |
| parent | 88669aed22aeeef5fb7ecdb7f43ed33e674f8fcb (diff) | |
| download | rust-193a95d30bc10c8fca8124cad23ea3cd38eaf440.tar.gz rust-193a95d30bc10c8fca8124cad23ea3cd38eaf440.zip | |
Rollup merge of #134017 - compiler-errors:call-once-deduction, r=jieyouxu
Don't use `AsyncFnOnce::CallOnceFuture` bounds for signature deduction We shouldn't be using `AsyncFnOnce::CallOnceFuture` projection bounds to deduce anything about the return type of an async closure, **only** `AsyncFnOnce::Output`. This was accidental b/c all we were looking at was the def id of the trait, rather than the projection. This PR fixes that. This doesn't affect stable code, since `CallOnceFuture` bounds cannot be written on stable. Fixes #134015
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/async-await/async-closures/call-once-deduction.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/async-await/async-closures/call-once-deduction.rs b/tests/ui/async-await/async-closures/call-once-deduction.rs new file mode 100644 index 00000000000..41d92bc3d78 --- /dev/null +++ b/tests/ui/async-await/async-closures/call-once-deduction.rs @@ -0,0 +1,14 @@ +//@ edition: 2021 +//@ check-pass + +#![feature(async_closure, async_fn_traits, unboxed_closures)] + +fn bar<F, O>(_: F) +where + F: AsyncFnOnce<(), CallOnceFuture = O>, +{ +} + +fn main() { + bar(async move || {}); +} |
