about summary refs log tree commit diff
path: root/src/libcore/option.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-05-10 17:56:02 -0700
committerbors <bors@rust-lang.org>2013-05-10 17:56:02 -0700
commit3e0400fb86170baff30282edcdccff73e243fd6e (patch)
treeec7cc5de5ce7c80845c77fdcbb670cd54c120783 /src/libcore/option.rs
parentd546493096f35e68cbcd9b5d3d7654e7a9345744 (diff)
parent606bd75586419948f109de313ab37e31397ca7a3 (diff)
downloadrust-3e0400fb86170baff30282edcdccff73e243fd6e.tar.gz
rust-3e0400fb86170baff30282edcdccff73e243fd6e.zip
auto merge of #6223 : alexcrichton/rust/issue-6183, r=pcwalton
Closes #6183.

The first commit changes the compiler's method of treating a `for` loop, and all the remaining commits are just dealing with the fallout.

The biggest fallout was the `IterBytes` trait, although it's really a whole lot nicer now because all of the `iter_bytes_XX` methods are just and-ed together. Sadly there was a huge amount of stuff that's `cfg(stage0)` gated, but whoever lands the next snapshot is going to have a lot of fun deleting all this code!

Diffstat (limited to 'src/libcore/option.rs')
-rw-r--r--src/libcore/option.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index b7c51147fba..7cb40876705 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -101,9 +101,16 @@ impl<T: Copy + Add<T,T>> Add<Option<T>, Option<T>> for Option<T> {
 impl<T> BaseIter<T> for Option<T> {
     /// Performs an operation on the contained value by reference
     #[inline(always)]
+    #[cfg(stage0)]
     fn each<'a>(&'a self, f: &fn(x: &'a T) -> bool) {
         match *self { None => (), Some(ref t) => { f(t); } }
     }
+    /// Performs an operation on the contained value by reference
+    #[inline(always)]
+    #[cfg(not(stage0))]
+    fn each<'a>(&'a self, f: &fn(x: &'a T) -> bool) -> bool {
+        match *self { None => true, Some(ref t) => { f(t) } }
+    }
 
     #[inline(always)]
     fn size_hint(&self) -> Option<uint> {
@@ -112,16 +119,27 @@ impl<T> BaseIter<T> for Option<T> {
 }
 
 impl<T> MutableIter<T> for Option<T> {
+    #[cfg(stage0)]
     #[inline(always)]
     fn each_mut<'a>(&'a mut self, f: &fn(&'a mut T) -> bool) {
         match *self { None => (), Some(ref mut t) => { f(t); } }
     }
+    #[cfg(not(stage0))]
+    #[inline(always)]
+    fn each_mut<'a>(&'a mut self, f: &fn(&'a mut T) -> bool) -> bool {
+        match *self { None => true, Some(ref mut t) => { f(t) } }
+    }
 }
 
 impl<A> ExtendedIter<A> for Option<A> {
+    #[cfg(stage0)]
     pub fn eachi(&self, blk: &fn(uint, v: &A) -> bool) {
         old_iter::eachi(self, blk)
     }
+    #[cfg(not(stage0))]
+    pub fn eachi(&self, blk: &fn(uint, v: &A) -> bool) -> bool {
+        old_iter::eachi(self, blk)
+    }
     pub fn all(&self, blk: &fn(&A) -> bool) -> bool {
         old_iter::all(self, blk)
     }