]> git.lizzy.rs Git - rust.git/commit - src/tools/rust-analyzer
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)
commitd6c959c680df8e3a68932e42ed919f5664669cc7
tree367e984f66e6d0b2253cb0a546a9f2b0a757e2c9
parent86388f617178875af0b6a585479efa4f09abd630
parentd9a438dc73de6ff146ae3e6bc4050b7cea41b09e
Rollup merge of #95298 - jhorstmann:fix-double-drop-of-allocator-in-vec-into-iter, r=oli-obk

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.
library/alloc/src/vec/into_iter.rs
library/alloc/src/vec/mod.rs