diff options
| author | bors <bors@rust-lang.org> | 2014-05-08 21:01:42 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-05-08 21:01:42 -0700 |
| commit | a990920c6fff9b762c3d0968ff0a5fdcce6d2b39 (patch) | |
| tree | 8b4cb2edb2e48660ca6e6c0f6a660951f00c1e02 /src/libstd/lib.rs | |
| parent | c0a25e4fdc1fcdde8378b4177a6f06c58001a3be (diff) | |
| parent | dc30c483810ca0ee3641f4bab8e6f2a44a883fee (diff) | |
| download | rust-a990920c6fff9b762c3d0968ff0a5fdcce6d2b39.tar.gz rust-a990920c6fff9b762c3d0968ff0a5fdcce6d2b39.zip | |
auto merge of #13963 : kballard/rust/remove_owned_vec_from_iterator, r=pcwalton
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<T>` 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<T>` first. Remove the `FromIterator` impl for `~[T]`, and adjust all the APIs that relied on it to start using `Vec<T>` instead. This includes rewriting `&[T].to_owned()` to be more efficient, among other performance wins. Also add a new mechanism to go from `Vec<T>` -> `~[T]`, just in case anyone truly needs that, using the new trait `FromVec`. [breaking-change]
Diffstat (limited to 'src/libstd/lib.rs')
| -rw-r--r-- | src/libstd/lib.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 72d41ae1dd2..8a783b6f378 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -278,4 +278,7 @@ mod std { pub use ty; pub use unstable; pub use vec; + + // The test runner requires std::slice::Vector, so re-export std::slice just for it. + #[cfg(test)] pub use slice; } |
