rust/library/alloc
bors 5c02926546 Auto merge of #84904 - ssomers:btree_drop_kv_in_place, r=Mark-Simulacrum
BTree: no longer copy keys and values before dropping them

When dropping BTreeMap or BTreeSet instances, keys-value pairs are up to now each copied and then dropped, at least according to source code. This is because the code for dropping and for iterators is shared.

This PR postpones the treatment of doomed key-value pairs from the intermediate functions `deallocating_next`(`_back`) to the last minute, so the we can drop the keys and values in place. According to the library/alloc benchmarks, this does make a difference, (and a positive difference with an `#[inline]` on `drop_key_val`). It does not change anything for #81444 though.

r? `@Mark-Simulacrum`
2021-05-11 19:36:54 +00:00
..
benches Try to make Vec benchmarks only run code they are benchmarking 2021-03-25 00:14:00 -04:00
src Auto merge of #84904 - ssomers:btree_drop_kv_in_place, r=Mark-Simulacrum 2021-05-11 19:36:54 +00:00
tests Stabilize vec_extend_from_within 2021-04-28 07:27:06 +01:00
Cargo.toml