about summary refs log tree commit diff
path: root/src/test/incremental/thinlto
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2018-12-16 14:08:19 +0100
committerGitHub <noreply@github.com>2018-12-16 14:08:19 +0100
commit9133798b924a4ef6b9f2d602a5f3df0c8a228f57 (patch)
tree71f0e8002920d0c6b75bfb712ebdc696536e5e1b /src/test/incremental/thinlto
parent32f922e526aeac4006df19bc2e1cacf8d0acfaab (diff)
parentd9c64e50a07dec062c273f4ec4c8f5985af13273 (diff)
downloadrust-9133798b924a4ef6b9f2d602a5f3df0c8a228f57.tar.gz
rust-9133798b924a4ef6b9f2d602a5f3df0c8a228f57.zip
Rollup merge of #56648 - RalfJung:btree, r=sfackler
Fix BTreeMap UB

BTreeMap currently causes UB by created a shared reference to a too-small allocation.  This PR fixes that by introducing a `NodeHeader` type and using that until we really need access to the key/value arrays.  Avoiding run-time checks in `into_key_slice` was somewhat tricky, see the comments embedded in the code.

I also adjusted `as_leaf_mut` to return a raw pointer, because creating a mutable reference asserts that there are no aliases to the pointee, but that's not always correct: We use `as_leaf_mut` twice to create two mutable slices for keys and values; the second call overlaps with the first slice and hence is not a unique pointer.

Fixes https://github.com/rust-lang/rust/issues/54957

Cc @nikomatsakis @Gankro
Diffstat (limited to 'src/test/incremental/thinlto')
0 files changed, 0 insertions, 0 deletions