From 606bd75586419948f109de313ab37e31397ca7a3 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 10 May 2013 18:20:06 -0400 Subject: [PATCH] Fix merge "failures" --- src/librustc/middle/ty.rs | 15 +++------------ src/librustc/util/enum_set.rs | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 1c2c02b21e6..737548ee868 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -4537,18 +4537,9 @@ pub fn each_bound_trait_and_supertraits(tcx: ctxt, // list. #[cfg(not(stage0))] pub fn each_bound_trait_and_supertraits(tcx: ctxt, - bounds: param_bounds, - f: &fn(&TraitRef) -> bool) -> bool { - for bounds.each |bound| { - let bound_trait_ref = match *bound { - ty::bound_trait(bound_t) => bound_t, - - ty::bound_copy | ty::bound_owned | - ty::bound_const | ty::bound_durable => { - loop; // skip non-trait bounds - } - }; - + bounds: &ParamBounds, + f: &fn(@TraitRef) -> bool) -> bool { + for bounds.trait_bounds.each |&bound_trait_ref| { let mut supertrait_set = HashMap::new(); let mut trait_refs = ~[]; let mut i = 0; diff --git a/src/librustc/util/enum_set.rs b/src/librustc/util/enum_set.rs index 859e743b43b..c589ab52874 100644 --- a/src/librustc/util/enum_set.rs +++ b/src/librustc/util/enum_set.rs @@ -49,6 +49,7 @@ fn contains_elem(&self, e: E) -> bool { (self.bits & bit(e)) != 0 } + #[cfg(stage0)] fn each(&self, f: &fn(E) -> bool) { let mut bits = self.bits; let mut index = 0; @@ -63,6 +64,22 @@ fn each(&self, f: &fn(E) -> bool) { bits >>= 1; } } + #[cfg(not(stage0))] + fn each(&self, f: &fn(E) -> bool) -> bool { + let mut bits = self.bits; + let mut index = 0; + while bits != 0 { + if (bits & 1) != 0 { + let e = CLike::from_uint(index); + if !f(e) { + return false; + } + } + index += 1; + bits >>= 1; + } + return true; + } } impl core::Sub, EnumSet> for EnumSet { -- GitLab