]> git.lizzy.rs Git - rust.git/commit
auto merge of #17188 : thestinger/rust/tvec, r=pcwalton
authorbors <bors@rust-lang.org>
Sat, 13 Sep 2014 20:36:02 +0000 (20:36 +0000)
committerbors <bors@rust-lang.org>
Sat, 13 Sep 2014 20:36:02 +0000 (20:36 +0000)
commit79a5448f41dcc6ab52663105a6b02fc5af4c503e
tree3cbc563de1bf23fc598bfe078e24333724bd7f92
parent7277fe9ee790a5f2fe2131b62a21537ac04e4cfd
parent0fc06b14c5fcbf6efb26c48c9d396e63dca02946
auto merge of #17188 : thestinger/rust/tvec, r=pcwalton

`Box<[T]>` is created by allocating `Box<[T, ..n]>` and coercing it so
this code path is never used. It's also broken because it clamps the
capacity of the memory allocations to 4 elements and that's incompatible
with sized deallocation. This dates back to when `~[T]` was a growable
vector type implemented as:

*{ { tydesc, ref_count, prev, next }, { length, capacity, data[] } }

Since even empty vectors had to allocate, it started off the capacity of
all vectors at 4 as a heuristic. It's not possible to grow `Box<[T]>`
and there is no need for a memory allocation when it's empty, so it
would be a terrible heuristic today even if it worked.