]> git.lizzy.rs Git - rust.git/commit
remove dead and broken tvec ~[T] code path
authorDaniel Micay <danielmicay@gmail.com>
Fri, 12 Sep 2014 07:08:48 +0000 (03:08 -0400)
committerDaniel Micay <danielmicay@gmail.com>
Fri, 12 Sep 2014 07:37:20 +0000 (03:37 -0400)
commit0fc06b14c5fcbf6efb26c48c9d396e63dca02946
tree14fb96c5e201faf2ed4826029fb731838cfc83c1
parent06c0b1d28ac28ca42d6c179293e333a012a8a3fc
remove dead and broken tvec ~[T] code path

`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.
src/librustc/middle/trans/expr.rs
src/librustc/middle/trans/tvec.rs