summary refs log tree commit diff
path: root/src/libsyntax/opt_vec.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/libsyntax/opt_vec.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/libsyntax/opt_vec.rs')
-rw-r--r--src/libsyntax/opt_vec.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libsyntax/opt_vec.rs b/src/libsyntax/opt_vec.rs
index 600ab964e52..6110579863d 100644
--- a/src/libsyntax/opt_vec.rs
+++ b/src/libsyntax/opt_vec.rs
@@ -132,12 +132,20 @@ impl<A:Eq> Eq for OptVec<A> {
 }
 
 impl<A> BaseIter<A> for OptVec<A> {
+    #[cfg(stage0)]
     fn each(&self, blk: &fn(v: &A) -> bool) {
         match *self {
             Empty => {}
             Vec(ref v) => v.each(blk)
         }
     }
+    #[cfg(not(stage0))]
+    fn each(&self, blk: &fn(v: &A) -> bool) -> bool {
+        match *self {
+            Empty => true,
+            Vec(ref v) => v.each(blk)
+        }
+    }
 
     fn size_hint(&self) -> Option<uint> {
         Some(self.len())
@@ -146,10 +154,16 @@ impl<A> BaseIter<A> for OptVec<A> {
 
 impl<A> old_iter::ExtendedIter<A> for OptVec<A> {
     #[inline(always)]
+    #[cfg(stage0)]
     fn eachi(&self, blk: &fn(v: uint, v: &A) -> bool) {
         old_iter::eachi(self, blk)
     }
     #[inline(always)]
+    #[cfg(not(stage0))]
+    fn eachi(&self, blk: &fn(v: uint, v: &A) -> bool) -> bool {
+        old_iter::eachi(self, blk)
+    }
+    #[inline(always)]
     fn all(&self, blk: &fn(&A) -> bool) -> bool {
         old_iter::all(self, blk)
     }