Respect stacked borrows when polling#11
Conversation
Polling the wrapped future previously had several reborrow operations, such as in the use of `map_unchecked_mut` and in the implementation of `as_mut_ptr`. This caused issues when running under miri in the `stress_drop_sender` test. This change re-implements these problematic cases to avoid reborrows, either through using `Pin::get_unchecked_mut` or transmuting pointers rather than borrowing and casting. Fixes microsoft#9
|
As much as I'd love to rubber-stamp this PR, I'm not all too familiar with stacked borrow rules myself, so i'll leave it to Wesley to sign off here. |
|
I see Miri is enabled on CI, but the Miri docs mention stacked borrows is still experimental — does Miri in CI here validate against the stacked borrows rules, or does that need to be enabled somehow? |
|
I've just been running Miri in the default settings and was able to repro the bug locally. We're using the defaults in CI too, so we should be good there too. |
|
Gotcha! Yay, great! |
Stacked borrows is the model used to detect aliasing violations so it's enabled by default. There's actually an option to disable it |
Polling the wrapped future previously had several reborrow operations, such as in the use of
map_unchecked_mutand in the implementation ofas_mut_ptr. This caused issues when running under miri in thestress_drop_sendertest.This change re-implements these problematic cases to avoid reborrows, either through using
Pin::get_unchecked_mutor transmuting pointers rather than borrowing and casting.Fixes #9