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
..
2024-02-10 07:15:15 +00:00
2024-02-08 15:46:00 +00:00
2023-01-19 15:46:08 +00:00
2023-11-24 19:15:52 +01:00
2023-12-12 00:00:00 +00:00
2024-02-08 09:06:32 +01:00
2024-01-30 21:28:18 +00:00
2023-05-10 19:36:02 +02:00
2024-02-09 00:13:51 +00:00
2024-01-13 12:46:58 -05:00
2023-09-23 13:34:07 +00:00
2024-01-30 21:28:18 +00:00
2024-01-05 09:30:27 +00:00
2023-09-21 22:20:58 +02:00
2024-02-06 02:22:58 +00:00
2024-02-06 02:22:58 +00:00
2023-09-23 13:47:30 +00:00
2023-09-23 13:47:30 +00:00
2023-09-23 13:47:30 +00:00
2024-01-30 21:28:18 +00:00
2023-11-24 19:15:52 +01:00
2024-01-02 15:34:37 -05:00
2024-01-02 15:34:37 -05:00
2024-01-30 21:28:18 +00:00
2023-10-13 21:01:36 +00:00
2024-01-05 10:00:59 +00:00
2024-01-05 10:00:59 +00:00
2023-09-23 13:47:30 +00:00
2023-09-23 13:34:07 +00:00
2023-11-24 19:15:52 +01:00
2023-04-27 17:18:11 +00:00
2023-04-27 17:18:11 +00:00
2023-11-24 19:15:52 +01:00
2023-09-26 20:15:28 +00:00
2023-11-24 19:15:52 +01:00
2023-10-20 21:14:02 +00:00
2023-10-20 21:14:02 +00:00
2023-10-20 21:14:02 +00:00
2023-10-20 21:14:02 +00:00
2023-09-29 22:39:02 +10:00
2024-01-30 21:28:18 +00:00
2023-08-17 14:33:24 -07:00
2023-09-23 13:47:30 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-09-23 13:47:30 +00:00
2023-09-23 13:47:30 +00:00
2024-01-30 21:28:18 +00:00
2023-09-23 13:47:30 +00:00
2024-01-30 21:28:18 +00:00
2023-09-23 13:47:30 +00:00
2023-09-23 13:47:30 +00:00
2023-10-05 01:04:41 +00:00
2023-10-13 21:01:36 +00:00
2023-10-13 21:01:36 +00:00
2024-01-13 12:46:58 -05:00
2023-12-19 16:12:17 -08:00
2024-01-13 12:46:58 -05:00
2023-09-08 03:45:36 +00:00
2023-11-24 19:15:52 +01:00
2023-09-23 13:34:07 +00:00
2024-01-30 21:28:18 +00:00
2023-09-23 13:34:07 +00:00
2023-12-19 16:12:17 -08:00
2023-12-19 16:12:17 -08:00
2023-12-22 11:01:07 -08:00
2024-01-17 12:00:27 -08:00
2024-01-17 12:00:27 -08:00
2023-08-27 22:03:16 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-01-17 16:27:57 +00:00
2024-01-17 16:27:57 +00:00
2023-10-28 23:11:03 -07:00
2023-11-18 00:40:11 +00:00
2023-11-18 00:40:11 +00:00
2023-07-10 20:09:26 +00:00
2023-10-20 21:14:01 +00:00
2023-10-20 21:14:01 +00:00
2023-09-23 13:47:30 +00:00
2024-01-30 21:28:18 +00:00
2023-09-23 13:47:30 +00:00
2024-01-30 21:28:18 +00:00
2023-09-23 13:47:30 +00:00
2024-01-30 21:28:18 +00:00
2023-09-23 13:47:30 +00:00
2024-01-30 21:28:18 +00:00
2024-02-09 15:43:08 -03:00
2024-02-09 15:43:08 -03:00
2024-02-09 15:43:08 -03:00
2023-10-20 08:46:27 +00:00
2024-01-02 14:17:56 +00:00
2023-11-24 19:15:52 +01:00
2023-09-23 13:47:30 +00:00
2024-01-30 21:28:18 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-09-23 13:47:30 +00:00
2024-01-30 21:28:18 +00:00
2023-09-22 15:58:43 +02:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-28 19:29:56 +00:00
2023-11-28 19:29:56 +00:00
2023-09-23 13:34:07 +00:00
2023-11-24 19:15:52 +01:00
2024-02-08 08:10:43 +00:00
2024-02-08 08:10:43 +00:00
2024-01-30 21:28:18 +00:00
2023-11-24 19:15:52 +01:00
2024-01-30 21:28:18 +00:00
2023-10-20 21:14:01 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-02-06 02:22:58 +00:00
2024-02-06 02:22:58 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-05-24 19:35:59 -03:00
2023-09-23 13:34:07 +00:00
2023-11-24 19:15:52 +01:00
2023-09-23 13:47:30 +00:00
2023-09-23 13:47:30 +00:00
2023-01-30 21:51:35 +00:00
2023-04-27 17:18:11 +00:00
2024-01-30 21:28:18 +00:00
2023-01-19 15:46:08 +00:00
2023-08-14 19:41:57 +00:00
2023-08-14 19:41:57 +00:00
2023-11-24 19:15:52 +01:00
2023-09-19 12:48:40 +00:00
2024-01-08 20:30:24 +00:00
2024-01-08 20:30:24 +00:00
2023-10-27 18:29:43 +00:00
2023-10-27 18:29:43 +00:00
2023-03-08 15:37:14 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-01-16 17:12:10 +00:00
2023-10-27 18:29:43 +00:00
2023-10-27 18:29:43 +00:00
2023-10-20 21:14:01 +00:00
2023-12-14 15:22:37 +01:00
2023-10-25 16:37:14 +00:00
2024-01-30 21:28:18 +00:00
2024-01-30 21:28:18 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-01-08 20:30:24 +00:00
2024-01-08 20:30:24 +00:00
2023-10-20 21:14:01 +00:00
2023-11-24 19:15:52 +01:00
2023-02-13 16:23:23 +01:00
2023-11-16 17:00:23 +00:00
2023-11-16 17:00:23 +00:00
2023-11-16 17:00:23 +00:00
2023-11-16 17:00:23 +00:00
2023-10-20 21:14:01 +00:00
2023-10-21 13:18:00 +02:00
2024-01-30 21:28:18 +00:00
2023-11-24 19:15:52 +01:00
2023-09-23 13:47:30 +00:00
2023-11-24 19:15:52 +01:00
2023-09-23 13:34:07 +00:00
2023-11-24 19:15:52 +01:00