rust/library/core
bors 7174231ae6 Auto merge of #102737 - RalfJung:poll_fn_pin, r=Mark-Simulacrum
poll_fn and Unpin: fix pinning

See [IRLO](https://internals.rust-lang.org/t/surprising-soundness-trouble-around-pollfn/17484) for details: currently `poll_fn` is very subtle to use, since it does not pin the closure, so creating a `Pin::get_unchcked(&mut capture)` inside the closure is unsound. This leads to actual miscompilations with `futures::join!`.

IMO the proper fix is to pin the closure when the future is pinned, which is achieved by changing the `Unpin` implementation. This is a breaking change though. 1.64.0 was *just* released, so maybe this is still okay?

The alternative would be to add some strong comments to the docs saying that closure captures are *not pinned* and doing `Pin::get_unchecked` on them is unsound.
2022-10-28 23:27:33 +00:00
..
benches add a benchmark for slice_iter.copied().array_chunks() 2022-10-17 23:40:21 +02:00
primitive_docs
src Auto merge of #102737 - RalfJung:poll_fn_pin, r=Mark-Simulacrum 2022-10-28 23:27:33 +00:00
tests Rollup merge of #98204 - Kixiron:stable-unzip, r=thomcc 2022-10-25 14:43:13 +05:30
Cargo.toml Avoid use of rand::thread_rng in stdlib benchmarks 2022-05-02 00:08:21 -07:00