rust/tests/ui/async-await/async-closures
bors 757b8efed4 Auto merge of #120712 - compiler-errors:async-closures-harmonize, r=oli-obk
Harmonize `AsyncFn` implementations, make async closures conditionally impl `Fn*` traits

This PR implements several changes to the built-in and libcore-provided implementations of `Fn*` and `AsyncFn*` to address two problems:
1. async closures do not implement the `Fn*` family traits, leading to breakage: https://crater-reports.s3.amazonaws.com/pr-120361/index.html
2. *references* to async closures do not implement `AsyncFn*`, as a consequence of the existing blanket impls of the shape `AsyncFn for F where F: Fn, F::Output: Future`.

In order to fix (1.), we implement `Fn` traits appropriately for async closures. It turns out that async closures can:
* always implement `FnOnce`, meaning that they're drop-in compatible with `FnOnce`-bound combinators like `Option::map`.
* conditionally implement `Fn`/`FnMut` if they have no captures, which means that existing usages of async closures should *probably* work without breakage (crater checking this: https://github.com/rust-lang/rust/pull/120712#issuecomment-1930587805).

In order to fix (2.), we make all of the built-in callables implement `AsyncFn*` via built-in impls, and instead adjust the blanket impls for `AsyncFn*` provided by libcore to match the blanket impls for `Fn*`.
2024-02-10 07:15:15 +00:00
..
auxiliary Make async closures test use async bound modifier 2024-02-06 17:41:48 +00:00
arg-mismatch.rs Add some tests 2024-02-06 02:22:58 +00:00
arg-mismatch.stderr Add some tests 2024-02-06 02:22:58 +00:00
async-fn-mut-for-async-fn.rs Build DebugInfo for coroutine-closure 2024-02-09 16:01:29 +00:00
async-fn-once-for-async-fn.rs Build DebugInfo for coroutine-closure 2024-02-09 16:01:29 +00:00
await-inference-guidance.rs Add some tests 2024-02-06 02:22:58 +00:00
brand.rs Make async closures test use async bound modifier 2024-02-06 17:41:48 +00:00
def-path.rs Fix drop shim for AsyncFnOnce closure, AsyncFnMut shim for AsyncFn closure 2024-02-06 02:22:58 +00:00
def-path.stderr Fix drop shim for AsyncFnOnce closure, AsyncFnMut shim for AsyncFn closure 2024-02-06 02:22:58 +00:00
drop.rs Make async closures test use async bound modifier 2024-02-06 17:41:48 +00:00
drop.run.stdout Fix drop shim for AsyncFnOnce closure, AsyncFnMut shim for AsyncFn closure 2024-02-06 02:22:58 +00:00
higher-ranked-return.rs Add some tests 2024-02-06 02:22:58 +00:00
higher-ranked-return.stderr Add some tests 2024-02-06 02:22:58 +00:00
higher-ranked.rs Add some tests 2024-02-06 02:22:58 +00:00
is-not-fn.rs Prefer AsyncFn* over Fn* for coroutine-closures 2024-02-08 15:46:00 +00:00
is-not-fn.stderr Prefer AsyncFn* over Fn* for coroutine-closures 2024-02-08 15:46:00 +00:00
mangle.rs Make async closures test use async bound modifier 2024-02-06 17:41:48 +00:00
move-consuming-capture.rs Add some tests 2024-02-06 02:22:58 +00:00
move-consuming-capture.stderr Add some tests 2024-02-06 02:22:58 +00:00
move-is-async-fn.rs Add some tests 2024-02-06 02:22:58 +00:00
mutate.rs Add some tests 2024-02-06 02:22:58 +00:00
not-lending.rs Add some tests 2024-02-06 02:22:58 +00:00
not-lending.stderr Add some tests 2024-02-06 02:22:58 +00:00
once.rs Add a couple more tests 2024-02-08 15:46:07 +00:00
refd.rs Add a couple more tests 2024-02-08 15:46:07 +00:00
return-type-mismatch.rs Add some tests 2024-02-06 02:22:58 +00:00
return-type-mismatch.stderr Add some tests 2024-02-06 02:22:58 +00:00
tainted-body.rs Don't ICE in ByMoveBody when coroutine is tainted 2024-02-09 00:36:30 +00:00
tainted-body.stderr Don't ICE in ByMoveBody when coroutine is tainted 2024-02-09 00:36:30 +00:00
wrong-fn-kind.rs Make async closures test use async bound modifier 2024-02-06 17:41:48 +00:00
wrong-fn-kind.stderr Make async closures test use async bound modifier 2024-02-06 17:41:48 +00:00