diff --git a/src/libextra/num/bigint.rs b/src/libextra/num/bigint.rs index c1959843d59..cea899b18c0 100644 --- a/src/libextra/num/bigint.rs +++ b/src/libextra/num/bigint.rs @@ -80,7 +80,7 @@ pub mod BigDigit { /** A big unsigned integer type. -A `BigUint`-typed value `BigUint { data: @[a, b, c] }` represents a number +A `BigUint`-typed value `BigUint { data: ~[a, b, c] }` represents a number `(a + b * BigDigit::base + c * BigDigit::base^2)`. */ #[deriving(Clone)] diff --git a/src/libextra/serialize.rs b/src/libextra/serialize.rs index fa2737ce75f..9b1b1e0548e 100644 --- a/src/libextra/serialize.rs +++ b/src/libextra/serialize.rs @@ -18,7 +18,6 @@ Core encoding and decoding interfaces. #[forbid(non_camel_case_types)]; -use std::at_vec; use std::hashmap::{HashMap, HashSet}; use std::rc::Rc; use std::trie::{TrieMap, TrieSet}; @@ -444,26 +443,6 @@ impl> Decodable for ~[T] { } } -impl> Encodable for @[T] { - fn encode(&self, s: &mut S) { - s.emit_seq(self.len(), |s| { - for (i, e) in self.iter().enumerate() { - s.emit_seq_elt(i, |s| e.encode(s)) - } - }) - } -} - -impl> Decodable for @[T] { - fn decode(d: &mut D) -> @[T] { - d.read_seq(|d, len| { - at_vec::from_fn(len, |i| { - d.read_seq_elt(i, |d| Decodable::decode(d)) - }) - }) - } -} - impl> Encodable for Option { fn encode(&self, s: &mut S) { s.emit_option(|s| { diff --git a/src/libstd/at_vec.rs b/src/libstd/at_vec.rs deleted file mode 100644 index 6a3c74482d3..00000000000 --- a/src/libstd/at_vec.rs +++ /dev/null @@ -1,423 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Operations on managed vectors (`@[T]` type) - -use clone::Clone; -use container::Container; -use iter::{Iterator, FromIterator}; -use option::{Option, Some, None}; -use mem; -use unstable::raw::Repr; -use vec::{ImmutableVector, OwnedVector}; - -/// Code for dealing with @-vectors. This is pretty incomplete, and -/// contains a bunch of duplication from the code for ~-vectors. - -/// Returns the number of elements the vector can hold without reallocating -#[inline] -pub fn capacity(v: @[T]) -> uint { - unsafe { - let managed_box = v.repr(); - (*managed_box).data.alloc / mem::size_of::() - } -} - -/** - * Builds a vector by calling a provided function with an argument - * function that pushes an element to the back of a vector. - * The initial size for the vector may optionally be specified - * - * # Arguments - * - * * size - An option, maybe containing initial size of the vector to reserve - * * builder - A function that will construct the vector. It receives - * as an argument a function that will push an element - * onto the vector being constructed. - */ -#[inline] -pub fn build(size: Option, builder: |push: |v: A||) -> @[A] { - let mut vec = @[]; - unsafe { raw::reserve(&mut vec, size.unwrap_or(4)); } - builder(|x| unsafe { raw::push(&mut vec, x) }); - vec -} - -// Appending - -/// Iterates over the `rhs` vector, copying each element and appending it to the -/// `lhs`. Afterwards, the `lhs` is then returned for use again. -#[inline] -pub fn append(lhs: @[T], rhs: &[T]) -> @[T] { - build(Some(lhs.len() + rhs.len()), |push| { - for x in lhs.iter() { - push((*x).clone()); - } - for elt in rhs.iter() { - push(elt.clone()); - } - }) -} - - -/// Apply a function to each element of a vector and return the results -#[inline] -pub fn map(v: &[T], f: |x: &T| -> U) -> @[U] { - build(Some(v.len()), |push| { - for elem in v.iter() { - push(f(elem)); - } - }) -} - -/** - * Creates and initializes an immutable vector. - * - * Creates an immutable vector of size `n_elts` and initializes the elements - * to the value returned by the function `op`. - */ -#[inline] -pub fn from_fn(n_elts: uint, op: |uint| -> T) -> @[T] { - build(Some(n_elts), |push| { - let mut i: uint = 0u; - while i < n_elts { push(op(i)); i += 1u; } - }) -} - -/** - * Creates and initializes an immutable vector. - * - * Creates an immutable vector of size `n_elts` and initializes the elements - * to the value `t`. - */ -#[inline] -pub fn from_elem(n_elts: uint, t: T) -> @[T] { - build(Some(n_elts), |push| { - let mut i: uint = 0u; - while i < n_elts { - push(t.clone()); - i += 1u; - } - }) -} - -/** - * Creates and initializes an immutable managed vector by moving all the - * elements from an owned vector. - */ -#[inline] -pub fn to_managed_move(v: ~[T]) -> @[T] { - let mut av = @[]; - unsafe { - raw::reserve(&mut av, v.len()); - for x in v.move_iter() { - raw::push(&mut av, x); - } - av - } -} - -/** - * Creates and initializes an immutable managed vector by copying all the - * elements of a slice. - */ -#[inline] -pub fn to_managed(v: &[T]) -> @[T] { - from_fn(v.len(), |i| v[i].clone()) -} - -impl Clone for @[T] { - fn clone(&self) -> @[T] { - *self - } -} - -impl FromIterator for @[A] { - #[inline] - fn from_iterator>(iterator: &mut T) -> @[A] { - let (lower, _) = iterator.size_hint(); - build(Some(lower), |push| { - for x in *iterator { - push(x); - } - }) - } -} - -#[cfg(not(test))] -#[allow(missing_doc)] -pub mod traits { - use at_vec::append; - use clone::Clone; - use ops::Add; - use vec::Vector; - - impl<'a,T:Clone, V: Vector> Add for @[T] { - #[inline] - fn add(&self, rhs: &V) -> @[T] { - append(*self, rhs.as_slice()) - } - } -} - -#[cfg(test)] -pub mod traits {} - -#[allow(missing_doc)] -pub mod raw { - use at_vec::capacity; - use cast; - use cast::{transmute, transmute_copy}; - use container::Container; - use option::None; - use mem; - use num::next_power_of_two; - use ptr; - use unstable::intrinsics::{move_val_init, TyDesc}; - use unstable::intrinsics; - use unstable::raw::{Box, Vec}; - - /** - * Sets the length of a vector - * - * This will explicitly set the size of the vector, without actually - * modifying its buffers, so it is up to the caller to ensure that - * the vector is actually the specified size. - */ - #[inline] - pub unsafe fn set_len(v: &mut @[T], new_len: uint) { - let repr: *mut Box> = cast::transmute_copy(v); - (*repr).data.fill = new_len * mem::size_of::(); - } - - /** - * Pushes a new value onto this vector. - */ - #[inline] - pub unsafe fn push(v: &mut @[T], initval: T) { - let full = { - let repr: *Box> = cast::transmute_copy(v); - (*repr).data.alloc > (*repr).data.fill - }; - if full { - push_fast(v, initval); - } else { - push_slow(v, initval); - } - } - - #[inline] // really pretty please - unsafe fn push_fast(v: &mut @[T], initval: T) { - let repr: *mut Box> = cast::transmute_copy(v); - let amt = v.len(); - (*repr).data.fill += mem::size_of::(); - let p = ptr::offset(&(*repr).data.data as *T, amt as int) as *mut T; - move_val_init(&mut(*p), initval); - } - - #[inline] - unsafe fn push_slow(v: &mut @[T], initval: T) { - reserve_at_least(v, v.len() + 1u); - push_fast(v, initval); - } - - /** - * Reserves capacity for exactly `n` elements in the given vector. - * - * If the capacity for `v` is already equal to or greater than the - * requested capacity, then no action is taken. - * - * # Arguments - * - * * v - A vector - * * n - The number of elements to reserve space for - */ - #[inline] - pub unsafe fn reserve(v: &mut @[T], n: uint) { - // Only make the (slow) call into the runtime if we have to - if capacity(*v) < n { - let ptr: *mut *mut Box> = transmute(v); - let ty = intrinsics::get_tydesc::(); - return reserve_raw(ty, ptr, n); - } - } - - // Implementation detail. Shouldn't be public - #[allow(missing_doc)] - #[inline] - pub fn reserve_raw(ty: *TyDesc, ptr: *mut *mut Box>, n: uint) { - // check for `uint` overflow - unsafe { - if n > (**ptr).data.alloc / (*ty).size { - let alloc = n * (*ty).size; - let total_size = alloc + mem::size_of::>(); - if alloc / (*ty).size != n || total_size < alloc { - fail!("vector size is too large: {}", n); - } - (*ptr) = local_realloc(*ptr as *(), total_size) as *mut Box>; - (**ptr).data.alloc = alloc; - } - } - - #[inline] - fn local_realloc(ptr: *(), size: uint) -> *() { - use rt::local::Local; - use rt::task::Task; - - let mut task = Local::borrow(None::); - task.get().heap.realloc(ptr as *mut Box<()>, size) as *() - } - } - - /** - * Reserves capacity for at least `n` elements in the given vector. - * - * This function will over-allocate in order to amortize the - * allocation costs in scenarios where the caller may need to - * repeatedly reserve additional space. - * - * If the capacity for `v` is already equal to or greater than the - * requested capacity, then no action is taken. - * - * # Arguments - * - * * v - A vector - * * n - The number of elements to reserve space for - */ - #[inline] - pub unsafe fn reserve_at_least(v: &mut @[T], n: uint) { - reserve(v, next_power_of_two(n)); - } -} - -#[cfg(test)] -mod test { - use super::*; - use prelude::*; - use bh = extra::test::BenchHarness; - - #[test] - fn test() { - // Some code that could use that, then: - fn seq_range(lo: uint, hi: uint) -> @[uint] { - build(None, |push| { - for i in range(lo, hi) { - push(i); - } - }) - } - - assert_eq!(seq_range(10, 15), @[10, 11, 12, 13, 14]); - assert_eq!(from_fn(5, |x| x+1), @[1, 2, 3, 4, 5]); - assert_eq!(from_elem(5, 3.14), @[3.14, 3.14, 3.14, 3.14, 3.14]); - } - - #[test] - fn append_test() { - assert_eq!(@[1,2,3] + &[4,5,6], @[1,2,3,4,5,6]); - } - - #[test] - fn test_to_managed_move() { - assert_eq!(to_managed_move::(~[]), @[]); - assert_eq!(to_managed_move(~[true]), @[true]); - assert_eq!(to_managed_move(~[1, 2, 3, 4, 5]), @[1, 2, 3, 4, 5]); - assert_eq!(to_managed_move(~[~"abc", ~"123"]), @[~"abc", ~"123"]); - assert_eq!(to_managed_move(~[~[42]]), @[~[42]]); - } - - #[test] - fn test_to_managed() { - assert_eq!(to_managed::([]), @[]); - assert_eq!(to_managed([true]), @[true]); - assert_eq!(to_managed([1, 2, 3, 4, 5]), @[1, 2, 3, 4, 5]); - assert_eq!(to_managed([@[42]]), @[@[42]]); - } - - #[bench] - fn bench_capacity(b: &mut bh) { - let x = @[1, 2, 3]; - b.iter(|| { - let _ = capacity(x); - }); - } - - #[bench] - fn bench_build_sized(b: &mut bh) { - let len = 64; - b.iter(|| { - build(Some(len), |push| for i in range(0, 1024) { push(i) }); - }); - } - - #[bench] - fn bench_build(b: &mut bh) { - b.iter(|| { - for i in range(0, 95) { - build(None, |push| push(i)); - } - }); - } - - #[bench] - fn bench_append(b: &mut bh) { - let lhs = @[7, ..128]; - let rhs = range(0, 256).to_owned_vec(); - b.iter(|| { - let _ = append(lhs, rhs); - }) - } - - #[bench] - fn bench_map(b: &mut bh) { - let elts = range(0, 256).to_owned_vec(); - b.iter(|| { - let _ = map(elts, |x| x*2); - }) - } - - #[bench] - fn bench_from_fn(b: &mut bh) { - b.iter(|| { - let _ = from_fn(1024, |x| x); - }); - } - - #[bench] - fn bench_from_elem(b: &mut bh) { - b.iter(|| { - let _ = from_elem(1024, 0u64); - }); - } - - #[bench] - fn bench_to_managed_move(b: &mut bh) { - b.iter(|| { - let elts = range(0, 1024).to_owned_vec(); // yikes! can't move out of capture, though - to_managed_move(elts); - }) - } - - #[bench] - fn bench_to_managed(b: &mut bh) { - let elts = range(0, 1024).to_owned_vec(); - b.iter(|| { - let _ = to_managed(elts); - }); - } - - #[bench] - fn bench_clone(b: &mut bh) { - let elts = to_managed(range(0, 1024).to_owned_vec()); - b.iter(|| { - let _ = elts.clone(); - }); - } -} diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index d7a7011319a..adce11fed2d 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -114,7 +114,6 @@ pub mod tuple; pub mod vec; pub mod vec_ng; -pub mod at_vec; pub mod str; pub mod ascii; diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs index 2282f97a716..c5482811a94 100644 --- a/src/libstd/path/mod.rs +++ b/src/libstd/path/mod.rs @@ -622,13 +622,6 @@ impl BytesContainer for ~[u8] { } } -impl BytesContainer for @[u8] { - #[inline] - fn container_as_bytes<'a>(&'a self) -> &'a [u8] { - self.as_slice() - } -} - impl BytesContainer for CString { #[inline] fn container_as_bytes<'a>(&'a self) -> &'a [u8] { diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index b6506b51786..ba0cd0bb521 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -807,8 +807,6 @@ mod tests { #[test] fn test_push_many() { - use to_man = at_vec::to_managed_move; - macro_rules! t( (s: $path:expr, $push:expr, $exp:expr) => ( { @@ -833,8 +831,6 @@ mod tests { t!(v: b!("a/b/c"), [b!("d"), b!("e")], b!("a/b/c/d/e")); t!(v: b!("a/b/c"), [b!("d"), b!("/e"), b!("f")], b!("/e/f")); t!(v: b!("a/b/c"), [b!("d").to_owned(), b!("e").to_owned()], b!("a/b/c/d/e")); - t!(v: b!("a/b/c"), [to_man(b!("d").to_owned()), to_man(b!("e").to_owned())], - b!("a/b/c/d/e")); } #[test] @@ -916,8 +912,6 @@ mod tests { #[test] fn test_join_many() { - use to_man = at_vec::to_managed_move; - macro_rules! t( (s: $path:expr, $join:expr, $exp:expr) => ( { @@ -941,8 +935,6 @@ mod tests { t!(s: "a/b/c", [~"d", ~"e"], "a/b/c/d/e"); t!(v: b!("a/b/c"), [b!("d"), b!("e")], b!("a/b/c/d/e")); t!(v: b!("a/b/c"), [b!("d").to_owned(), b!("e").to_owned()], b!("a/b/c/d/e")); - t!(v: b!("a/b/c"), [to_man(b!("d").to_owned()), to_man(b!("e").to_owned())], - b!("a/b/c/d/e")); } #[test] diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 2578acaf41c..eec6f37b627 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -1587,8 +1587,6 @@ mod tests { #[test] fn test_push_many() { - use to_man = at_vec::to_managed_move; - macro_rules! t( (s: $path:expr, $push:expr, $exp:expr) => ( { @@ -1613,8 +1611,6 @@ mod tests { t!(v: b!("a\\b\\c"), [b!("d"), b!("e")], b!("a\\b\\c\\d\\e")); t!(v: b!("a\\b\\c"), [b!("d"), b!("\\e"), b!("f")], b!("\\e\\f")); t!(v: b!("a\\b\\c"), [b!("d").to_owned(), b!("e").to_owned()], b!("a\\b\\c\\d\\e")); - t!(v: b!("a\\b\\c"), [to_man(b!("d").to_owned()), to_man(b!("e").to_owned())], - b!("a\\b\\c\\d\\e")); } #[test] @@ -1731,8 +1727,6 @@ mod tests { #[test] fn test_join_many() { - use to_man = at_vec::to_managed_move; - macro_rules! t( (s: $path:expr, $join:expr, $exp:expr) => ( { @@ -1756,8 +1750,6 @@ mod tests { t!(s: "a\\b\\c", [~"d", ~"e"], "a\\b\\c\\d\\e"); t!(v: b!("a\\b\\c"), [b!("d"), b!("e")], b!("a\\b\\c\\d\\e")); t!(v: b!("a\\b\\c"), [b!("d").to_owned(), b!("e").to_owned()], b!("a\\b\\c\\d\\e")); - t!(v: b!("a\\b\\c"), [to_man(b!("d").to_owned()), to_man(b!("e").to_owned())], - b!("a\\b\\c\\d\\e")); } #[test] diff --git a/src/libstd/reflect.rs b/src/libstd/reflect.rs index d0b0f0c264d..a7cea1c7e4a 100644 --- a/src/libstd/reflect.rs +++ b/src/libstd/reflect.rs @@ -251,9 +251,6 @@ impl TyVisitor for MovePtrAdaptor { } fn visit_evec_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool { - self.align_to::<@[u8]>(); - if ! self.inner.visit_evec_box(mtbl, inner) { return false; } - self.bump_past::<@[u8]>(); true } diff --git a/src/libstd/repr.rs b/src/libstd/repr.rs index 8ecb3395542..41ddf027787 100644 --- a/src/libstd/repr.rs +++ b/src/libstd/repr.rs @@ -637,12 +637,6 @@ fn test_repr() { exact_test(&(0 as *mut ()), "(0x0 as *mut ())"); exact_test(&(1,), "(1,)"); - exact_test(&(@[1,2,3,4,5,6,7,8]), - "@[1, 2, 3, 4, 5, 6, 7, 8]"); - exact_test(&(@[1u8,2u8,3u8,4u8]), - "@[1u8, 2u8, 3u8, 4u8]"); - exact_test(&(@["hi", "there"]), - "@[\"hi\", \"there\"]"); exact_test(&(~["hi", "there"]), "~[\"hi\", \"there\"]"); exact_test(&(&["hi", "there"]), diff --git a/src/libstd/rt/local_heap.rs b/src/libstd/rt/local_heap.rs index 42a7e7867f9..79936b4afad 100644 --- a/src/libstd/rt/local_heap.rs +++ b/src/libstd/rt/local_heap.rs @@ -332,6 +332,6 @@ mod bench { #[bench] fn alloc_managed_big(bh: &mut BenchHarness) { - bh.iter(|| { @[10, ..1000]; }); + bh.iter(|| { @([10, ..1000]); }); } } diff --git a/src/libstd/to_bytes.rs b/src/libstd/to_bytes.rs index 7ca1590dad0..4c545de73b4 100644 --- a/src/libstd/to_bytes.rs +++ b/src/libstd/to_bytes.rs @@ -266,13 +266,6 @@ impl IterBytes for ~[A] { } } -impl IterBytes for @[A] { - #[inline] - fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool { - self.as_slice().iter_bytes(lsb0, f) - } -} - impl<'a> IterBytes for &'a str { #[inline] fn iter_bytes(&self, _lsb0: bool, f: Cb) -> bool { diff --git a/src/libstd/to_str.rs b/src/libstd/to_str.rs index edbf3314417..87d59f09791 100644 --- a/src/libstd/to_str.rs +++ b/src/libstd/to_str.rs @@ -159,25 +159,6 @@ impl ToStr for ~[A] { } } -impl ToStr for @[A] { - #[inline] - fn to_str(&self) -> ~str { - let mut acc = ~"["; - let mut first = true; - for elt in self.iter() { - if first { - first = false; - } - else { - acc.push_str(", "); - } - acc.push_str(elt.to_str()); - } - acc.push_char(']'); - acc - } -} - #[cfg(test)] mod tests { use hashmap::HashMap; diff --git a/src/libstd/unstable/raw.rs b/src/libstd/unstable/raw.rs index c568edd09d1..63208b3f2d7 100644 --- a/src/libstd/unstable/raw.rs +++ b/src/libstd/unstable/raw.rs @@ -56,7 +56,6 @@ pub trait Repr { impl<'a, T> Repr> for &'a [T] {} impl<'a> Repr> for &'a str {} impl Repr<*Box> for @T {} -impl Repr<*Box>> for @[T] {} impl Repr<*Vec> for ~[T] {} impl Repr<*String> for ~str {} diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index 15cd5ce3343..2679ef0d46e 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -646,13 +646,6 @@ pub mod traits { fn ne(&self, other: &~[T]) -> bool { !self.eq(other) } } - impl Eq for @[T] { - #[inline] - fn eq(&self, other: &@[T]) -> bool { self.as_slice() == *other } - #[inline] - fn ne(&self, other: &@[T]) -> bool { !self.eq(other) } - } - impl<'a,T:TotalEq> TotalEq for &'a [T] { fn equals(&self, other: & &'a [T]) -> bool { self.len() == other.len() && @@ -665,11 +658,6 @@ pub mod traits { fn equals(&self, other: &~[T]) -> bool { self.as_slice().equals(&other.as_slice()) } } - impl TotalEq for @[T] { - #[inline] - fn equals(&self, other: &@[T]) -> bool { self.as_slice().equals(&other.as_slice()) } - } - impl<'a,T:Eq, V: Vector> Equiv for &'a [T] { #[inline] fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() } @@ -680,11 +668,6 @@ pub mod traits { fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() } } - impl<'a,T:Eq, V: Vector> Equiv for @[T] { - #[inline] - fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() } - } - impl<'a,T:TotalOrd> TotalOrd for &'a [T] { fn cmp(&self, other: & &'a [T]) -> Ordering { order::cmp(self.iter(), other.iter()) @@ -696,11 +679,6 @@ pub mod traits { fn cmp(&self, other: &~[T]) -> Ordering { self.as_slice().cmp(&other.as_slice()) } } - impl TotalOrd for @[T] { - #[inline] - fn cmp(&self, other: &@[T]) -> Ordering { self.as_slice().cmp(&other.as_slice()) } - } - impl<'a, T: Eq + Ord> Ord for &'a [T] { fn lt(&self, other: & &'a [T]) -> bool { order::lt(self.iter(), other.iter()) @@ -730,17 +708,6 @@ pub mod traits { fn gt(&self, other: &~[T]) -> bool { self.as_slice() > other.as_slice() } } - impl Ord for @[T] { - #[inline] - fn lt(&self, other: &@[T]) -> bool { self.as_slice() < other.as_slice() } - #[inline] - fn le(&self, other: &@[T]) -> bool { self.as_slice() <= other.as_slice() } - #[inline] - fn ge(&self, other: &@[T]) -> bool { self.as_slice() >= other.as_slice() } - #[inline] - fn gt(&self, other: &@[T]) -> bool { self.as_slice() > other.as_slice() } - } - impl<'a,T:Clone, V: Vector> Add for &'a [T] { #[inline] fn add(&self, rhs: &V) -> ~[T] { @@ -778,11 +745,6 @@ impl Vector for ~[T] { fn as_slice<'a>(&'a self) -> &'a [T] { let v: &'a [T] = *self; v } } -impl Vector for @[T] { - #[inline(always)] - fn as_slice<'a>(&'a self) -> &'a [T] { let v: &'a [T] = *self; v } -} - impl<'a, T> Container for &'a [T] { /// Returns the length of a vector #[inline] @@ -833,15 +795,6 @@ impl CloneableVector for ~[T] { fn into_owned(self) -> ~[T] { self } } -/// Extension methods for managed vectors -impl CloneableVector for @[T] { - #[inline] - fn to_owned(&self) -> ~[T] { self.as_slice().to_owned() } - - #[inline(always)] - fn into_owned(self) -> ~[T] { self.to_owned() } -} - /// Extension methods for vectors pub trait ImmutableVector<'a, T> { /** @@ -2629,10 +2582,6 @@ impl Default for ~[A] { fn default() -> ~[A] { ~[] } } -impl Default for @[A] { - fn default() -> @[A] { @[] } -} - macro_rules! iterator { (struct $name:ident -> $ptr:ty, $elem:ty) => { /// An iterator for iterating over a vector. @@ -3109,14 +3058,6 @@ mod tests { assert_eq!(v_b[0], 2); assert_eq!(v_b[1], 3); - // Test on managed heap. - let vec_managed = @[1, 2, 3, 4, 5]; - let v_c = vec_managed.slice(0u, 3u).to_owned(); - assert_eq!(v_c.len(), 3u); - assert_eq!(v_c[0], 1); - assert_eq!(v_c[1], 2); - assert_eq!(v_c[2], 3); - // Test on exchange heap. let vec_unique = ~[1, 2, 3, 4, 5, 6]; let v_d = vec_unique.slice(1u, 6u).to_owned(); @@ -4052,7 +3993,6 @@ mod tests { ); t!(&[int]); - t!(@[int]); t!(~[int]); }