about summary refs log tree commit diff
path: root/tests/ui/array-slice-vec/check-static-mut-slices.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-10 07:15:15 +0000
committerbors <bors@rust-lang.org>2024-02-10 07:15:15 +0000
commit757b8efed44eacbbc6baf4a393f77d23d5be90c8 (patch)
tree3d1898c476ccb02da378740f1440ebf590084fcb /tests/ui/array-slice-vec/check-static-mut-slices.rs
parent68125c72d389060fe9aaee8d87ebd834f417c9fc (diff)
parent540be28f6c2571e7be3ab3936b62635fa0d3caf3 (diff)
downloadrust-757b8efed44eacbbc6baf4a393f77d23d5be90c8.tar.gz
rust-757b8efed44eacbbc6baf4a393f77d23d5be90c8.zip
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*`.
Diffstat (limited to 'tests/ui/array-slice-vec/check-static-mut-slices.rs')
0 files changed, 0 insertions, 0 deletions