Re:Futurelock: A subtle risk in async Rust
by oconnor663 on Friday October 31, 2025 @05:16PM
(#45776791)
There's nothing `select!` could do here to force `future1` to drop, because it doesn't receive ownership of `future1`. If we wanted to force this, we'd have to forbid `select!` from polling futures by reference, but that's a pretty fundamental capability that we often rely on to `select!` in a loop for example. The blanket `impl<F> Future for &mut F where F: Future ...` isn't a Tokio thing either; that's in the standard library.
[ Parent
| on HN ]
Re:Futurelock: A subtle risk in async Rust
by kibwen on Saturday November 01, 2025 @09:19AM
(#45781430)
Surely not every use of `select!` needs this ability. If you can design a more restrictive interface that makes correctness easier to determine, then you should use that interface where you can, and reserve `select!` for only those cases where you can't.