about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/arena.rs56
-rw-r--r--src/libstd/deque.rs122
-rw-r--r--src/libstd/ebml.rs18
-rw-r--r--src/libstd/future.rs29
-rw-r--r--src/libstd/json.rs48
-rw-r--r--src/libstd/priority_queue.rs16
-rw-r--r--src/libstd/serialize.rs10
-rw-r--r--src/libstd/smallintmap.rs77
8 files changed, 0 insertions, 376 deletions
diff --git a/src/libstd/arena.rs b/src/libstd/arena.rs
index 8e2c7345045..e714af5fa18 100644
--- a/src/libstd/arena.rs
+++ b/src/libstd/arena.rs
@@ -201,21 +201,6 @@ pub impl Arena {
     }
 
     #[inline(always)]
-    #[cfg(stage0)]
-    priv fn alloc_pod<T>(&self, op: &fn() -> T) -> &'self T {
-        unsafe {
-            let tydesc = sys::get_type_desc::<T>();
-            let ptr = self.alloc_pod_inner((*tydesc).size, (*tydesc).align);
-            let ptr: *mut T = transmute(ptr);
-            rusti::move_val_init(&mut (*ptr), op());
-            return transmute(ptr);
-        }
-    }
-
-    #[inline(always)]
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
     priv fn alloc_pod<'a, T>(&'a self, op: &fn() -> T) -> &'a T {
         unsafe {
             let tydesc = sys::get_type_desc::<T>();
@@ -261,31 +246,6 @@ pub impl Arena {
     }
 
     #[inline(always)]
-    #[cfg(stage0)]
-    priv fn alloc_nonpod<T>(&self, op: &fn() -> T) -> &'self T {
-        unsafe {
-            let tydesc = sys::get_type_desc::<T>();
-            let (ty_ptr, ptr) =
-                self.alloc_nonpod_inner((*tydesc).size, (*tydesc).align);
-            let ty_ptr: *mut uint = transmute(ty_ptr);
-            let ptr: *mut T = transmute(ptr);
-            // Write in our tydesc along with a bit indicating that it
-            // has *not* been initialized yet.
-            *ty_ptr = transmute(tydesc);
-            // Actually initialize it
-            rusti::move_val_init(&mut(*ptr), op());
-            // Now that we are done, update the tydesc to indicate that
-            // the object is there.
-            *ty_ptr = bitpack_tydesc_ptr(tydesc, true);
-
-            return transmute(ptr);
-        }
-    }
-
-    #[inline(always)]
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
     priv fn alloc_nonpod<'a, T>(&'a self, op: &fn() -> T) -> &'a T {
         unsafe {
             let tydesc = sys::get_type_desc::<T>();
@@ -308,22 +268,6 @@ pub impl Arena {
 
     // The external interface
     #[inline(always)]
-    #[cfg(stage0)]
-    fn alloc<T>(&self, op: &fn() -> T) -> &'self T {
-        unsafe {
-            if !rusti::needs_drop::<T>() {
-                self.alloc_pod(op)
-            } else {
-                self.alloc_nonpod(op)
-            }
-        }
-    }
-
-    // The external interface
-    #[inline(always)]
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
     fn alloc<'a, T>(&'a self, op: &fn() -> T) -> &'a T {
         unsafe {
             if !rusti::needs_drop::<T>() {
diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs
index 5d52bb7c081..64d708e0b2e 100644
--- a/src/libstd/deque.rs
+++ b/src/libstd/deque.rs
@@ -37,128 +37,6 @@ impl<T> Mutable for Deque<T> {
     }
 }
 
-#[cfg(stage0)]
-pub impl<T> Deque<T> {
-    /// Create an empty Deque
-    fn new() -> Deque<T> {
-        Deque{nelts: 0, lo: 0, hi: 0,
-              elts: vec::from_fn(initial_capacity, |_| None)}
-    }
-
-    /// Return a reference to the first element in the deque
-    ///
-    /// Fails if the deque is empty
-    #[cfg(stage0)]
-    fn peek_front(&self) -> &'self T { get(self.elts, self.lo) }
-
-    /// Return a reference to the first element in the deque
-    ///
-    /// Fails if the deque is empty
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
-    fn peek_front<'a>(&'a self) -> &'a T { get(self.elts, self.lo) }
-
-    /// Return a reference to the last element in the deque
-    ///
-    /// Fails if the deque is empty
-    #[cfg(stage0)]
-    fn peek_back(&self) -> &'self T { get(self.elts, self.hi - 1u) }
-
-    /// Return a reference to the last element in the deque
-    ///
-    /// Fails if the deque is empty
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
-    fn peek_back<'a>(&'a self) -> &'a T { get(self.elts, self.hi - 1u) }
-
-    /// Retrieve an element in the deque by index
-    ///
-    /// Fails if there is no element with the given index
-    #[cfg(stage0)]
-    fn get(&self, i: int) -> &'self T {
-        let idx = (self.lo + (i as uint)) % self.elts.len();
-        get(self.elts, idx)
-    }
-
-    /// Retrieve an element in the deque by index
-    ///
-    /// Fails if there is no element with the given index
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
-    fn get<'a>(&'a self, i: int) -> &'a T {
-        let idx = (self.lo + (i as uint)) % self.elts.len();
-        get(self.elts, idx)
-    }
-
-    /// Iterate over the elements in the deque
-    fn each(&self, f: &fn(&T) -> bool) {
-        self.eachi(|_i, e| f(e))
-    }
-
-    /// Iterate over the elements in the deque by index
-    fn eachi(&self, f: &fn(uint, &T) -> bool) {
-        for uint::range(0, self.nelts) |i| {
-            if !f(i, self.get(i as int)) { return; }
-        }
-    }
-
-    /// Remove and return the first element in the deque
-    ///
-    /// Fails if the deque is empty
-    fn pop_front(&mut self) -> T {
-        let result = self.elts[self.lo].swap_unwrap();
-        self.lo = (self.lo + 1u) % self.elts.len();
-        self.nelts -= 1u;
-        result
-    }
-
-    /// Remove and return the last element in the deque
-    ///
-    /// Fails if the deque is empty
-    fn pop_back(&mut self) -> T {
-        if self.hi == 0u {
-            self.hi = self.elts.len() - 1u;
-        } else { self.hi -= 1u; }
-        let result = self.elts[self.hi].swap_unwrap();
-        self.elts[self.hi] = None;
-        self.nelts -= 1u;
-        result
-    }
-
-    /// Prepend an element to the deque
-    fn add_front(&mut self, t: T) {
-        let oldlo = self.lo;
-        if self.lo == 0u {
-            self.lo = self.elts.len() - 1u;
-        } else { self.lo -= 1u; }
-        if self.lo == self.hi {
-            self.elts = grow(self.nelts, oldlo, self.elts);
-            self.lo = self.elts.len() - 1u;
-            self.hi = self.nelts;
-        }
-        self.elts[self.lo] = Some(t);
-        self.nelts += 1u;
-    }
-
-    /// Append an element to the deque
-    fn add_back(&mut self, t: T) {
-        if self.lo == self.hi && self.nelts != 0u {
-            self.elts = grow(self.nelts, self.lo, self.elts);
-            self.lo = 0u;
-            self.hi = self.nelts;
-        }
-        self.elts[self.hi] = Some(t);
-        self.hi = (self.hi + 1u) % self.elts.len();
-        self.nelts += 1u;
-    }
-}
-
-#[cfg(stage1)]
-#[cfg(stage2)]
-#[cfg(stage3)]
 pub impl<T> Deque<T> {
     /// Create an empty Deque
     fn new() -> Deque<T> {
diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs
index 2598e96a141..9b89036eee5 100644
--- a/src/libstd/ebml.rs
+++ b/src/libstd/ebml.rs
@@ -400,16 +400,6 @@ pub mod reader {
             f()
         }
 
-        #[cfg(stage0)]
-        fn read_field<T>(&self, name: &str, idx: uint, f: &fn() -> T) -> T {
-            debug!("read_field(name=%?, idx=%u)", name, idx);
-            self._check_label(name);
-            f()
-        }
-
-        #[cfg(stage1)]
-        #[cfg(stage2)]
-        #[cfg(stage3)]
         fn read_struct_field<T>(&self, name: &str, idx: uint, f: &fn() -> T) -> T {
             debug!("read_struct_field(name=%?, idx=%u)", name, idx);
             self._check_label(name);
@@ -714,14 +704,6 @@ pub mod writer {
         }
 
         fn emit_struct(&self, _name: &str, _len: uint, f: &fn()) { f() }
-        #[cfg(stage0)]
-        fn emit_field(&self, name: &str, _idx: uint, f: &fn()) {
-            self._emit_label(name);
-            f()
-        }
-        #[cfg(stage1)]
-        #[cfg(stage2)]
-        #[cfg(stage3)]
         fn emit_struct_field(&self, name: &str, _idx: uint, f: &fn()) {
             self._emit_label(name);
             f()
diff --git a/src/libstd/future.rs b/src/libstd/future.rs
index f59abfa81ca..c3fc16bdf70 100644
--- a/src/libstd/future.rs
+++ b/src/libstd/future.rs
@@ -54,35 +54,6 @@ pub impl<A:Copy> Future<A> {
 }
 
 pub impl<A> Future<A> {
-    #[cfg(stage0)]
-    fn get_ref(&self) -> &'self A {
-        /*!
-        * Executes the future's closure and then returns a borrowed
-        * pointer to the result.  The borrowed pointer lasts as long as
-        * the future.
-        */
-        unsafe {
-            match self.state {
-                Forced(ref mut v) => { return cast::transmute(v); }
-                Evaluating => fail!(~"Recursive forcing of future!"),
-                Pending(_) => {}
-            }
-
-            let mut state = Evaluating;
-            self.state <-> state;
-            match state {
-                Forced(_) | Evaluating => fail!(~"Logic error."),
-                Pending(f) => {
-                    self.state = Forced(f());
-                    self.get_ref()
-                }
-            }
-        }
-    }
-
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
     fn get_ref<'a>(&'a self) -> &'a A {
         /*!
         * Executes the future's closure and then returns a borrowed
diff --git a/src/libstd/json.rs b/src/libstd/json.rs
index 7353bec7333..5d5b0bd952f 100644
--- a/src/libstd/json.rs
+++ b/src/libstd/json.rs
@@ -143,16 +143,6 @@ impl serialize::Encoder for Encoder {
         f();
         self.wr.write_char('}');
     }
-    #[cfg(stage0)]
-    fn emit_field(&self, name: &str, idx: uint, f: &fn()) {
-        if idx != 0 { self.wr.write_char(','); }
-        self.wr.write_str(escape_str(name));
-        self.wr.write_char(':');
-        f();
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
     fn emit_struct_field(&self, name: &str, idx: uint, f: &fn()) {
         if idx != 0 { self.wr.write_char(','); }
         self.wr.write_str(escape_str(name));
@@ -289,21 +279,6 @@ impl serialize::Encoder for PrettyEncoder {
             self.wr.write_char('}');
         }
     }
-    #[cfg(stage0)]
-    fn emit_field(&self, name: &str, idx: uint, f: &fn()) {
-        if idx == 0 {
-            self.wr.write_char('\n');
-        } else {
-            self.wr.write_str(",\n");
-        }
-        self.wr.write_str(spaces(self.indent));
-        self.wr.write_str(escape_str(name));
-        self.wr.write_str(": ");
-        f();
-    }
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
     fn emit_struct_field(&self, name: &str, idx: uint, f: &fn()) {
         if idx == 0 {
             self.wr.write_char('\n');
@@ -901,29 +876,6 @@ impl serialize::Decoder for Decoder {
         value
     }
 
-    #[cfg(stage0)]
-    fn read_field<T>(&self, name: &str, idx: uint, f: &fn() -> T) -> T {
-        debug!("read_field(name=%?, idx=%u)", name, idx);
-        match self.stack.pop() {
-            Object(obj) => {
-                let mut obj = obj;
-                let value = match obj.pop(&name.to_owned()) {
-                    None => fail!(fmt!("no such field: %s", name)),
-                    Some(json) => {
-                        self.stack.push(json);
-                        f()
-                    }
-                };
-                self.stack.push(Object(obj));
-                value
-            }
-            value => fail!(fmt!("not an object: %?", value))
-        }
-    }
-
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
     fn read_struct_field<T>(&self, name: &str, idx: uint, f: &fn() -> T) -> T {
         debug!("read_struct_field(name=%?, idx=%u)", name, idx);
         match self.stack.pop() {
diff --git a/src/libstd/priority_queue.rs b/src/libstd/priority_queue.rs
index 47af3576c90..33fe1cfff8e 100644
--- a/src/libstd/priority_queue.rs
+++ b/src/libstd/priority_queue.rs
@@ -45,25 +45,9 @@ impl<T:Ord> Mutable for PriorityQueue<T> {
 
 pub impl <T:Ord> PriorityQueue<T> {
     /// Returns the greatest item in the queue - fails if empty
-    #[cfg(stage0)]
-    fn top(&self) -> &'self T { &self.data[0] }
-
-    /// Returns the greatest item in the queue - fails if empty
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
     fn top<'a>(&'a self) -> &'a T { &self.data[0] }
 
     /// Returns the greatest item in the queue - None if empty
-    #[cfg(stage0)]
-    fn maybe_top(&self) -> Option<&'self T> {
-        if self.is_empty() { None } else { Some(self.top()) }
-    }
-
-    /// Returns the greatest item in the queue - None if empty
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
     fn maybe_top<'a>(&'a self) -> Option<&'a T> {
         if self.is_empty() { None } else { Some(self.top()) }
     }
diff --git a/src/libstd/serialize.rs b/src/libstd/serialize.rs
index 1ad581ba993..032df4c819c 100644
--- a/src/libstd/serialize.rs
+++ b/src/libstd/serialize.rs
@@ -55,11 +55,6 @@ pub trait Encoder {
     fn emit_enum_struct_variant_field(&self, f_name: &str, f_idx: uint, f: &fn());
 
     fn emit_struct(&self, name: &str, len: uint, f: &fn());
-    #[cfg(stage0)]
-    fn emit_field(&self, f_name: &str, f_idx: uint, f: &fn());
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
     fn emit_struct_field(&self, f_name: &str, f_idx: uint, f: &fn());
 
     fn emit_tuple(&self, len: uint, f: &fn());
@@ -111,11 +106,6 @@ pub trait Decoder {
     fn read_enum_struct_variant_field<T>(&self, &f_name: &str, f_idx: uint, f: &fn() -> T) -> T;
 
     fn read_struct<T>(&self, s_name: &str, len: uint, f: &fn() -> T) -> T;
-    #[cfg(stage0)]
-    fn read_field<T>(&self, f_name: &str, f_idx: uint, f: &fn() -> T) -> T;
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
     fn read_struct_field<T>(&self, f_name: &str, f_idx: uint, f: &fn() -> T) -> T;
 
     fn read_tuple<T>(&self, f: &fn(uint) -> T) -> T;
diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs
index fb17d4e5090..1b72300a178 100644
--- a/src/libstd/smallintmap.rs
+++ b/src/libstd/smallintmap.rs
@@ -50,20 +50,6 @@ impl<V> Map<uint, V> for SmallIntMap<V> {
     }
 
     /// Visit all key-value pairs in order
-    #[cfg(stage0)]
-    fn each(&self, it: &fn(&uint, &'self V) -> bool) {
-        for uint::range(0, self.v.len()) |i| {
-            match self.v[i] {
-              Some(ref elt) => if !it(&i, elt) { break },
-              None => ()
-            }
-        }
-    }
-
-    /// Visit all key-value pairs in order
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
     fn each<'a>(&'a self, it: &fn(&uint, &'a V) -> bool) {
         for uint::range(0, self.v.len()) |i| {
             match self.v[i] {
@@ -79,15 +65,6 @@ impl<V> Map<uint, V> for SmallIntMap<V> {
     }
 
     /// Visit all values in order
-    #[cfg(stage0)]
-    fn each_value(&self, blk: &fn(value: &V) -> bool) {
-        self.each(|_, v| blk(v))
-    }
-
-    /// Visit all values in order
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
     fn each_value<'a>(&'a self, blk: &fn(value: &'a V) -> bool) {
         self.each(|_, v| blk(v))
     }
@@ -103,22 +80,6 @@ impl<V> Map<uint, V> for SmallIntMap<V> {
     }
 
     /// Return a reference to the value corresponding to the key
-    #[cfg(stage0)]
-    fn find(&self, key: &uint) -> Option<&'self V> {
-        if *key < self.v.len() {
-            match self.v[*key] {
-              Some(ref value) => Some(value),
-              None => None
-            }
-        } else {
-            None
-        }
-    }
-
-    /// Return a reference to the value corresponding to the key
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
     fn find<'a>(&'a self, key: &uint) -> Option<&'a V> {
         if *key < self.v.len() {
             match self.v[*key] {
@@ -131,22 +92,6 @@ impl<V> Map<uint, V> for SmallIntMap<V> {
     }
 
     /// Return a mutable reference to the value corresponding to the key
-    #[cfg(stage0)]
-    fn find_mut(&mut self, key: &uint) -> Option<&'self mut V> {
-        if *key < self.v.len() {
-            match self.v[*key] {
-              Some(ref mut value) => Some(value),
-              None => None
-            }
-        } else {
-            None
-        }
-    }
-
-    /// Return a mutable reference to the value corresponding to the key
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
     fn find_mut<'a>(&'a mut self, key: &uint) -> Option<&'a mut V> {
         if *key < self.v.len() {
             match self.v[*key] {
@@ -188,20 +133,6 @@ pub impl<V> SmallIntMap<V> {
     fn new() -> SmallIntMap<V> { SmallIntMap{v: ~[]} }
 
     /// Visit all key-value pairs in reverse order
-    #[cfg(stage0)]
-    fn each_reverse(&self, it: &fn(uint, &'self V) -> bool) {
-        for uint::range_rev(self.v.len(), 0) |i| {
-            match self.v[i - 1] {
-              Some(ref elt) => if !it(i - 1, elt) { break },
-              None => ()
-            }
-        }
-    }
-
-    /// Visit all key-value pairs in reverse order
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
     fn each_reverse<'a>(&'a self, it: &fn(uint, &'a V) -> bool) {
         for uint::range_rev(self.v.len(), 0) |i| {
             match self.v[i - 1] {
@@ -211,14 +142,6 @@ pub impl<V> SmallIntMap<V> {
         }
     }
 
-    #[cfg(stage0)]
-    fn get(&self, key: &uint) -> &'self V {
-        self.find(key).expect("key not present")
-    }
-
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
     fn get<'a>(&'a self, key: &uint) -> &'a V {
         self.find(key).expect("key not present")
     }