diff options
author | bors <bors@rust-lang.org> | 2022-10-28 23:27:33 +0000 |
---|---|---|
committer | bors <bors@rust-lang.org> | 2022-10-28 23:27:33 +0000 |
commit | 7174231ae66aa3e938cbe0b84e23e79d867fec20 (patch) | |
tree | 7460d6911aa4b59612ba0ca595d395fb0407eab1 /tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs | |
parent | 9565dfeb4e6225177bbe78f18cd48a7982f34401 (diff) | |
parent | 17d78c4ef922f81e752feb077d66fbce80630c6c (diff) | |
download | rust-7174231ae66aa3e938cbe0b84e23e79d867fec20.tar.gz |
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.
Diffstat (limited to 'tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs')
0 files changed, 0 insertions, 0 deletions