rust/library/alloc
bors 124eb966e3 Auto merge of #132597 - lukas-code:btree-plug-leak, r=jhpratt
btree: don't leak value if destructor of key panics

This PR fixes a regression from https://github.com/rust-lang/rust/pull/84904.

The `BTreeMap` already attempts to handle panicking destructors of the key-value pairs by continuing to execute the remaining destructors after one destructor panicked. However, after #84904 the destructor of a value in a key-value pair gets skipped if the destructor of the key panics, only continuing with the next key-value pair. This PR reverts to the behavior before #84904 to also drop the corresponding value if the destructor of a key panics.

This avoids potential memory leaks and can fix the soundness of programs that rely on the destructors being executed (even though this should not be relied upon, because the std collections currently do not guarantee that the remaining elements are dropped after a panic in a destructor).

cc `@Amanieu` because you had opinions on panicking destructors
2024-11-24 02:08:58 +00:00
..
benches move strict provenance lints to new feature gate, remove old feature gates 2024-10-21 15:22:17 +01:00
src Auto merge of #132597 - lukas-code:btree-plug-leak, r=jhpratt 2024-11-24 02:08:58 +00:00
tests Auto merge of #132231 - lukas-code:rc-plug-leaks, r=tgross35 2024-10-29 16:26:00 +00:00
Cargo.toml Update compiler_builtins to 0.1.138 and pin it 2024-11-03 17:43:16 -06:00