summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-09-25 20:57:18 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-09-25 20:59:14 -0700
commitfe09451a5a34931e11fa67ee83ac8deaa8d585be (patch)
tree7e1d4d49256a0276e505d9243ebf29c25fd93ca0 /src
parent3023bd872949ce4ba45e13dbcd30d6b98963d0ed (diff)
downloadrust-fe09451a5a34931e11fa67ee83ac8deaa8d585be.tar.gz
rust-fe09451a5a34931e11fa67ee83ac8deaa8d585be.zip
Revert "libcore: De-mode at_vec"
This reverts commit ab6318803e1764e6e894441c2829f9b47acbf298.
Diffstat (limited to 'src')
-rw-r--r--src/libcore/at_vec.rs34
-rw-r--r--src/libcore/iter.rs2
2 files changed, 16 insertions, 20 deletions
diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs
index 01d4fb4f33a..fdd0e4fd47e 100644
--- a/src/libcore/at_vec.rs
+++ b/src/libcore/at_vec.rs
@@ -1,9 +1,5 @@
 //! Managed vectors
 
-// NB: transitionary, de-mode-ing.
-#[forbid(deprecated_mode)];
-#[forbid(deprecated_pattern)];
-
 use ptr::addr_of;
 
 /// Code for dealing with @-vectors. This is pretty incomplete, and
@@ -25,7 +21,7 @@ extern mod rusti {
 
 /// Returns the number of elements the vector can hold without reallocating
 #[inline(always)]
-pub pure fn capacity<T>(v: @[const T]) -> uint {
+pub pure fn capacity<T>(&&v: @[const T]) -> uint {
     unsafe {
         let repr: **raw::VecRepr =
             ::cast::reinterpret_cast(&addr_of(v));
@@ -47,7 +43,7 @@ pub pure fn capacity<T>(v: @[const T]) -> uint {
  */
 #[inline(always)]
 pub pure fn build_sized<A>(size: uint,
-                           builder: &fn(push: pure fn(+v: A))) -> @[A] {
+                           builder: fn(push: pure fn(+v: A))) -> @[A] {
     let mut vec = @[];
     unsafe { raw::reserve(vec, size); }
     builder(|+x| unsafe { raw::push(vec, move x) });
@@ -65,7 +61,7 @@ pub pure fn build_sized<A>(size: uint,
  *             onto the vector being constructed.
  */
 #[inline(always)]
-pub pure fn build<A>(builder: &fn(push: pure fn(+v: A))) -> @[A] {
+pub pure fn build<A>(builder: fn(push: pure fn(+v: A))) -> @[A] {
     build_sized(4, builder)
 }
 
@@ -82,8 +78,8 @@ pub pure fn build<A>(builder: &fn(push: pure fn(+v: A))) -> @[A] {
  *             onto the vector being constructed.
  */
 #[inline(always)]
-pub pure fn build_sized_opt<A>(+size: Option<uint>,
-                               builder: &fn(push: pure fn(+v: A))) -> @[A] {
+pub pure fn build_sized_opt<A>(size: Option<uint>,
+                           builder: fn(push: pure fn(+v: A))) -> @[A] {
     build_sized(size.get_default(4), builder)
 }
 
@@ -98,10 +94,10 @@ pub pure fn append<T: Copy>(lhs: @[T], rhs: &[const T]) -> @[T] {
 
 
 /// Apply a function to each element of a vector and return the results
-pub pure fn map<T, U>(v: &[T], f: &fn(x: &T) -> U) -> @[U] {
+pub pure fn map<T, U>(v: &[T], f: fn(T) -> U) -> @[U] {
     do build_sized(v.len()) |push| {
         for vec::each(v) |elem| {
-            push(f(elem));
+            push(f(*elem));
         }
     }
 }
@@ -125,10 +121,10 @@ pub pure fn from_fn<T>(n_elts: uint, op: iter::InitOp<T>) -> @[T] {
  * Creates an immutable vector of size `n_elts` and initializes the elements
  * to the value `t`.
  */
-pub pure fn from_elem<T: Copy>(n_elts: uint, t: &T) -> @[T] {
+pub pure fn from_elem<T: Copy>(n_elts: uint, t: T) -> @[T] {
     do build_sized(n_elts) |push| {
         let mut i: uint = 0u;
-        while i < n_elts { push(copy *t); i += 1u; }
+        while i < n_elts { push(t); i += 1u; }
     }
 }
 
@@ -159,13 +155,13 @@ pub mod raw {
      * the vector is actually the specified size.
      */
     #[inline(always)]
-    pub unsafe fn set_len<T>(v: @[const T], new_len: uint) {
+    pub unsafe fn set_len<T>(&&v: @[const T], new_len: uint) {
         let repr: **VecRepr = ::cast::reinterpret_cast(&addr_of(v));
         (**repr).unboxed.fill = new_len * sys::size_of::<T>();
     }
 
     #[inline(always)]
-    pub unsafe fn push<T>(v: @[const T], +initval: T) {
+    pub unsafe fn push<T>(&v: @[const T], +initval: T) {
         let repr: **VecRepr = ::cast::reinterpret_cast(&addr_of(v));
         let fill = (**repr).unboxed.fill;
         if (**repr).unboxed.alloc > fill {
@@ -177,7 +173,7 @@ pub mod raw {
     }
     // This doesn't bother to make sure we have space.
     #[inline(always)] // really pretty please
-    pub unsafe fn push_fast<T>(v: @[const T], +initval: T) {
+    pub unsafe fn push_fast<T>(&v: @[const T], +initval: T) {
         let repr: **VecRepr = ::cast::reinterpret_cast(&addr_of(v));
         let fill = (**repr).unboxed.fill;
         (**repr).unboxed.fill += sys::size_of::<T>();
@@ -186,7 +182,7 @@ pub mod raw {
         rusti::move_val_init(*p, move initval);
     }
 
-    pub unsafe fn push_slow<T>(v: @[const T], +initval: T) {
+    pub unsafe fn push_slow<T>(&v: @[const T], +initval: T) {
         reserve_at_least(v, v.len() + 1u);
         push_fast(v, move initval);
     }
@@ -202,7 +198,7 @@ pub mod raw {
      * * v - A vector
      * * n - The number of elements to reserve space for
      */
-    pub unsafe fn reserve<T>(v: @[const T], n: uint) {
+    pub unsafe fn reserve<T>(&v: @[const T], n: uint) {
         // Only make the (slow) call into the runtime if we have to
         if capacity(v) < n {
             let ptr = addr_of(v) as **VecRepr;
@@ -226,7 +222,7 @@ pub mod raw {
      * * v - A vector
      * * n - The number of elements to reserve space for
      */
-    pub unsafe fn reserve_at_least<T>(v: @[const T], n: uint) {
+    pub unsafe fn reserve_at_least<T>(&v: @[const T], n: uint) {
         reserve(v, uint::next_power_of_two(n));
     }
 
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index b932741d6ac..8af4ce3d0b1 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -7,7 +7,7 @@ The iteration traits and common implementation
 use cmp::{Eq, Ord};
 
 /// A function used to initialize the elements of a sequence
-type InitOp<T> = &fn(uint) -> T;
+type InitOp<T> = fn(uint) -> T;
 
 trait BaseIter<A> {
     pure fn each(blk: fn(v: &A) -> bool);