Closed conradludgate closed 1 year ago
Thanks for the PR! Considering the overflow of isize (which can actually happen on 32-bit targets), this still seems broken, but this seems more correct than the current one.
Yeah. I have some ideas how to fix the overflow too, but it's not as trivial a fix
Essentially, if the next_outgoing_index has the MSB set, then it flips the MSB of every task/output. This preserves the order and ensures that the outgoing is <= isize::MAX
. The length of the queue would have to be another isize::MAX+1
in order to overflow, but you'd OOM before that.
It should be possible to implement here too, but it might not be super efficient with the task linked list
Thanks! Opened https://github.com/rust-lang/futures-rs/issues/2689 to track overflow issue.
fixes #2663