mozilla/rust — pull request #13963 by kballard (2014-05-06 06:38:57+00:00)
Title: Remote FromIterator impl for ~[T], and the ensuing fallout

With `~[T]` no longer growable, the `FromIterator` impl for `~[T]` doesn't make
much sense. Not only that, but nearly everywhere it is used is to convert from
a `Vec` into a `~[T]`, for the sake of maintaining existing APIs. This turns
out to be a performance loss, as it means every API that returns `~[T]`, even a
supposedly non-copying one, is in fact doing extra allocations and memcpy's.
Even `&[T].to_owned()` is going through `Vec` first.

Remove the `FromIterator` impl for `~[T]`, and adjust all the APIs that relied
on it to start using `Vec` instead. This includes rewriting
`&[T].to_owned()` to be more efficient, among other performance wins.