]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Rollup merge of #81706 - SkiFire13:document-binaryheap-unsafe, r=Mark-Simulacrum
authorYuki Okushi <huyuumi.dev@gmail.com>
Sun, 21 Feb 2021 06:26:40 +0000 (15:26 +0900)
committerGitHub <noreply@github.com>
Sun, 21 Feb 2021 06:26:40 +0000 (15:26 +0900)
commit56ae3fb2f0888a6a6857eec5c0109fcb3eefe258
tree803e55be0e99dad3de5c5eb9e359203c2a93a8f7
parent3219a100fab579015d56411f5a50dcb7ff10f39d
parent3ec1a28418472d64518efcb72e25ff976d6ff140
Rollup merge of #81706 - SkiFire13:document-binaryheap-unsafe, r=Mark-Simulacrum

Document BinaryHeap unsafe functions

`BinaryHeap` contains some private safe functions but that are actually unsafe to call. This PR marks them `unsafe` and documents all the `unsafe` function calls inside them.

While doing this I might also have found a bug: some "SAFETY" comments in `sift_down_range` and `sift_down_to_bottom` are valid only if you assume that `child` doesn't overflow. However it may overflow if `end > isize::MAX` which can be true for ZSTs (but I think only for them). I guess the easiest fix would be to skip any sifting if `mem::size_of::<T> == 0`.

Probably conflicts with #81127 but solving the eventual merge conflict should be pretty easy.