diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index dbf548bed98..5dc18bc08f1 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -46,7 +46,7 @@ struct binding_info { type BindingMap = HashMap; // Trait method resolution -pub type TraitMap = HashMap>; +pub type TraitMap = HashMap; // This is the replacement export map. It maps a module to all of the exports // within. @@ -5255,14 +5255,14 @@ impl Resolver { // the field name so that we can do some nice error reporting // later on in typeck. let traits = self.search_for_traits_containing_method(ident); - self.trait_map.insert(expr.id, @RefCell::new(traits)); + self.trait_map.insert(expr.id, traits); } ExprMethodCall(_, ident, _, _) => { debug!("(recording candidate traits for expr) recording \ traits for {}", expr.id); let traits = self.search_for_traits_containing_method(ident); - self.trait_map.insert(expr.id, @RefCell::new(traits)); + self.trait_map.insert(expr.id, traits); } _ => { // Nothing to do. diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index 0dd0041344f..4695521d0d9 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -81,7 +81,6 @@ obtained the type `Foo`, we would never match this method. use middle::subst::Subst; -use middle::resolve; use middle::ty::*; use middle::ty; use middle::typeck::astconv::AstConv; @@ -396,28 +395,10 @@ impl<'a> LookupContext<'a> { // If the method being called is associated with a trait, then // find all the impls of that trait. Each of those are // candidates. - let trait_map: &resolve::TraitMap = &self.fcx.ccx.trait_map; - let opt_applicable_traits = trait_map.find(&self.expr.id); - for applicable_traits in opt_applicable_traits.iter() { - let applicable_traits = applicable_traits.borrow(); - for trait_did in applicable_traits.get().iter() { - ty::populate_implementations_for_trait_if_necessary( - self.tcx(), - *trait_did); - - // Look for explicit implementations. - let trait_impls = self.tcx().trait_impls.borrow(); - let opt_impl_infos = trait_impls.get().find(trait_did); - for impl_infos in opt_impl_infos.iter() { - let impl_infos = impl_infos.borrow(); - for impl_info in impl_infos.get().iter() { - let mut extension_candidates = - self.extension_candidates.borrow_mut(); - self.push_candidates_from_impl( - extension_candidates.get(), *impl_info); - - } - } + let opt_applicable_traits = self.fcx.ccx.trait_map.find(&self.expr.id); + for applicable_traits in opt_applicable_traits.move_iter() { + for trait_did in applicable_traits.iter() { + self.push_extension_candidate(*trait_did); } } }