Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.    By clickin

rust-lang / rust

submited by
Style Pass
2021-05-30 06:30:05

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

The behavior of binary_search_by changed in #74024 such that the result of the function after the patch is not the same as before.

While not directly responsible for the downtime, Polkadot ran into this problem while trying to recover from a network failure this week: https://polkadot.network/a-polkadot-postmortem-24-05-2021/

It being valid for a binary search to return any element is a sufficiently well-known property of the underlying algorithm that even Wikipedia mentions it.

And from there we can find that C's bsearch does not specify which element should be returned. java.util.Array.binarySearch also does not specify. C#'s List.BinarySearch also does not specify.

Leave a Comment
Related Posts