Description
I recently had a pretty nasty logic bug in my code, involving the select!
macro. This is unusual, because in Rust I'm expecting that APIs are hard to use incorrectly, and that potential pitfalls are documented. It turns out that I'd run into (pretty much) exactly the same issue as described in this blog post: https://carllerche.com/2021/06/17/six-ways-to-make-async-rust-easier/
Please add a paragraph to the documentation that explains how futures of the other branches get dropped, and that this may have unexpected consequences if the operation has side effects that are not idempotent (e.g. reading data). Maybe also add an example that somehow works around the issue (either by spawning a task, or by storing the future in a variable across loop iterations).
The blog post suggests to limit the select!
macro to Stream
s only. We could only deprecate the usage of plain Future
s due to backwards compatibility, but I think that this option should be at least considered too.