]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Rollup merge of #83629 - the8472:fix-inplace-panic-on-drop, r=m-ou-se
authorDylan DPC <dylan.dpc@gmail.com>
Fri, 2 Apr 2021 17:57:31 +0000 (19:57 +0200)
committerGitHub <noreply@github.com>
Fri, 2 Apr 2021 17:57:31 +0000 (19:57 +0200)
commit542f441d445026d0996eebee9ddddee98f5dc3e5
tree0873cca9285235dd23dcb3d3e48132bed9a18eb4
parent31f532092c4172ba2f3764d3ef63a790ea1387e3
parent421f5d282a51e130d3ca7c4524d8ad6753437da9
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