3

FuturesUnordered: fix partial iteration by wfraser · Pull Request #2574 · rust-l...

 2 years ago
source link: https://github.com/rust-lang/futures-rs/pull/2574
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Contributor

@wfraser wfraser commented 12 days ago

The IntoIter impl advances the head pointer every iteration, but this breaks the linked list invariant that the head's prev should be null.

If the iteration is not done to completion (which sets head to null), on subsequent drop, FuturesUnordered::unlink relies on this broken invariant and ends up panicking.

The fix is to maintain the head->prev == null invariant while iterating.

Fixes #2573


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK