Files
rust/library/core/src/future
Matthias Krüger 663fb5a0e9 Rollup merge of #109970 - danielhenrymantilla:add-poll-fn-pin-clarifications, r=thomcc
[doc] `poll_fn`: explain how to `pin` captured state safely

Usage of `Pin::new_unchecked(&mut …)` is dangerous with `poll_fn`, even though the `!Unpin`-infectiousness has made things smoother. Nonetheless, there are easy ways to avoid the need for any `unsafe` altogether, be it through `Box::pin`ning, or the `pin!` macro. Since the latter only works within an `async` context, showing an example artificially introducing one ought to help people navigate this subtlety with safety and confidence.

## Preview

https://user-images.githubusercontent.com/9920355/230092494-da22fdcb-0b8f-4ff4-a2ac-aa7d9ead077a.mov

```@rustbot``` label +A-docs
2023-06-19 19:26:25 +02:00
..
2023-01-03 23:50:31 +00:00
2023-04-27 17:18:12 +00:00
2023-05-19 12:45:41 +02:00
2023-05-07 10:52:01 +02:00
2022-08-30 13:39:30 +02:00