about summary refs log tree commit diff
path: root/compiler/rustc_span
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-11-24 02:08:58 +0000
committerbors <bors@rust-lang.org>2024-11-24 02:08:58 +0000
commit124eb966e3782c26b42cbf779f712771a1aa5727 (patch)
tree476e8b567706aa2c7563dc10c8f9dfa34451a221 /compiler/rustc_span
parente48241b5d15da7491d3c8fd4d87f7a183a15b6b4 (diff)
parente32a118e6cec5cfbd3552559787c98f6371d5ac1 (diff)
downloadrust-124eb966e3782c26b42cbf779f712771a1aa5727.tar.gz
rust-124eb966e3782c26b42cbf779f712771a1aa5727.zip
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
Diffstat (limited to 'compiler/rustc_span')
0 files changed, 0 insertions, 0 deletions