From 5eb6d19803ebcb5279f8a42b584a4d81152fa82d Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 2 May 2013 18:33:33 -0400 Subject: syntax: Use the new `for` protocol --- src/libsyntax/opt_vec.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/libsyntax/opt_vec.rs') 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 Eq for OptVec { } impl BaseIter for OptVec { + #[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 { Some(self.len()) @@ -146,10 +154,16 @@ impl BaseIter for OptVec { impl old_iter::ExtendedIter for OptVec { #[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) } -- cgit 1.4.1-3-g733a5