From 7d3b0bf3912fabf52fdd6926900e578e55af1b49 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 17 Apr 2014 15:28:14 -0700 Subject: std: Make ~[T] no longer a growable vector This removes all resizability support for ~[T] vectors in preparation of DST. The only growable vector remaining is Vec. In summary, the following methods from ~[T] and various functions were removed. Each method/function has an equivalent on the Vec type in std::vec unless otherwise stated. * slice::OwnedCloneableVector * slice::OwnedEqVector * slice::append * slice::append_one * slice::build (no replacement) * slice::bytes::push_bytes * slice::from_elem * slice::from_fn * slice::with_capacity * ~[T].capacity() * ~[T].clear() * ~[T].dedup() * ~[T].extend() * ~[T].grow() * ~[T].grow_fn() * ~[T].grow_set() * ~[T].insert() * ~[T].pop() * ~[T].push() * ~[T].push_all() * ~[T].push_all_move() * ~[T].remove() * ~[T].reserve() * ~[T].reserve_additional() * ~[T].reserve_exect() * ~[T].retain() * ~[T].set_len() * ~[T].shift() * ~[T].shrink_to_fit() * ~[T].swap_remove() * ~[T].truncate() * ~[T].unshift() * ~str.clear() * ~str.set_len() * ~str.truncate() Note that no other API changes were made. Existing apis that took or returned ~[T] continue to do so. [breaking-change] --- src/libstd/sync/arc.rs | 6 ++++-- src/libstd/sync/deque.rs | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/libstd/sync') diff --git a/src/libstd/sync/arc.rs b/src/libstd/sync/arc.rs index 0d0bd740e41..498a6252a8f 100644 --- a/src/libstd/sync/arc.rs +++ b/src/libstd/sync/arc.rs @@ -23,12 +23,13 @@ use cast; use clone::Clone; +use iter::Iterator; use kinds::Send; use ops::Drop; use ptr::RawPtr; use sync::atomics::{fence, AtomicUint, Relaxed, Acquire, Release}; -use slice; use ty::Unsafe; +use vec::Vec; /// An atomically reference counted pointer. /// @@ -73,7 +74,8 @@ impl UnsafeArc { ~[] // need to free data here } else { let ptr = new_inner(data, num_handles); - slice::from_fn(num_handles, |_| UnsafeArc { data: ptr }) + let v = Vec::from_fn(num_handles, |_| UnsafeArc { data: ptr }); + v.move_iter().collect() } } } diff --git a/src/libstd/sync/deque.rs b/src/libstd/sync/deque.rs index 8beadce2160..97239707d32 100644 --- a/src/libstd/sync/deque.rs +++ b/src/libstd/sync/deque.rs @@ -61,7 +61,7 @@ use ptr::RawPtr; use sync::arc::UnsafeArc; use sync::atomics::{AtomicInt, AtomicPtr, SeqCst}; use unstable::sync::Exclusive; -use slice::{OwnedVector, ImmutableVector}; +use slice::ImmutableVector; use vec::Vec; // Once the queue is less than 1/K full, then it will be downsized. Note that -- cgit 1.4.1-3-g733a5