rust/library/alloc/src/vec
Dylan DPC 542f441d44
Rollup merge of #83629 - the8472:fix-inplace-panic-on-drop, r=m-ou-se
Fix double-drop in `Vec::from_iter(vec.into_iter())` specialization when items drop during panic

This fixes the double-drop but it leaves a behavioral difference compared to the default implementation intact: In the default implementation the source and the destination vec are separate objects, so they get dropped separately. Here they share an allocation and the latter only exists as a pointer into the former. So if dropping the former panics then this fix will leak more items than the default implementation would. Is this acceptable or should the specialization also mimic the default implementation's drops-during-panic behavior?

Fixes #83618

`@rustbot` label T-libs-impl
2021-04-02 19:57:31 +02:00
..
cow.rs style: applying Rust style 2020-12-29 14:03:30 +00:00
drain.rs style: applying Rust style 2020-12-29 14:03:30 +00:00
drain_filter.rs style: applying Rust style 2020-12-29 14:03:30 +00:00
in_place_drop.rs style: applying Rust style 2020-12-29 14:03:30 +00:00
into_iter.rs fix double-drop in in-place collect specialization 2021-03-29 04:48:13 +02:00
is_zero.rs style: applying Rust style 2020-12-29 14:03:30 +00:00
mod.rs panic early when TrustedLen indicates a length > usize::MAX 2021-03-31 23:09:28 +02:00
partial_eq.rs style: applying Rust style 2020-12-29 14:03:30 +00:00
set_len_on_drop.rs refactor: moved SetLenOnDrop to set_len_on_drop 2020-12-29 14:03:30 +00:00
source_iter_marker.rs fix double-drop in in-place collect specialization 2021-03-29 04:48:13 +02:00
spec_extend.rs panic early when TrustedLen indicates a length > usize::MAX 2021-03-31 23:09:28 +02:00
spec_from_elem.rs style: applying Rust style 2020-12-29 14:03:30 +00:00
spec_from_iter.rs fix: moved import into #[cfg(test)] 2020-12-29 14:03:30 +00:00
spec_from_iter_nested.rs panic early when TrustedLen indicates a length > usize::MAX 2021-03-31 23:09:28 +02:00
splice.rs style: applying Rust style 2020-12-29 14:03:30 +00:00