]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #95298 - jhorstmann:fix-double-drop-of-allocator-in-vec-into-iter...
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>
Wed, 30 Mar 2022 22:26:32 +0000 (00:26 +0200)
committerGitHub <noreply@github.com>
Wed, 30 Mar 2022 22:26:32 +0000 (00:26 +0200)
Fix double drop of allocator in IntoIter impl of Vec

Fixes #95269

The `drop` impl of `IntoIter` reconstructs a `RawVec` from `buf`, `cap` and `alloc`, when that `RawVec` is dropped it also drops the allocator. To avoid dropping the allocator twice we wrap it in `ManuallyDrop` in the `InttoIter` struct.

Note this is my first contribution to the standard library, so I might be missing some details or a better way to solve this.

1  2 
library/alloc/src/vec/into_iter.rs
library/alloc/src/vec/mod.rs

Simple merge
Simple merge