diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index eaf1054231f6..b09b448e1fe0 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -449,7 +449,8 @@ fn encode_reexported_static_base_methods(ecx: &EncodeContext, let inherent_impls = ecx.tcx.inherent_impls.borrow(); match inherent_impls.get().find(&exp.def_id) { Some(implementations) => { - for &base_impl in implementations.iter() { + let implementations = implementations.borrow(); + for &base_impl in implementations.get().iter() { for &m in base_impl.methods.iter() { if m.explicit_self == ast::sty_static { encode_reexported_static_method(ecx, ebml_w, exp, @@ -884,7 +885,8 @@ fn encode_inherent_implementations(ecx: &EncodeContext, match inherent_impls.get().find(&def_id) { None => {} Some(&implementations) => { - for implementation in implementations.iter() { + let implementations = implementations.borrow(); + for implementation in implementations.get().iter() { ebml_w.start_tag(tag_items_data_item_inherent_impl); encode_def_id(ebml_w, implementation.did); ebml_w.end_tag(); diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index aa58fc569a8d..1fc95839c8d4 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -287,7 +287,8 @@ impl DeadVisitor { match inherent_impls.get().find(&def_id) { None => (), Some(ref impl_list) => { - for impl_ in impl_list.iter() { + let impl_list = impl_list.borrow(); + for impl_ in impl_list.get().iter() { for method in impl_.methods.iter() { if self.live_symbols.contains(&method.def_id.node) { return true; diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index ef7cd14ae9b5..ff925305acf1 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -338,7 +338,7 @@ struct ctxt_ { // Maps a def_id of a type to a list of its inherent impls. // Contains implementations of methods that are inherent to a type. // Methods in these implementations don't need to be exported. - inherent_impls: RefCell>, + inherent_impls: RefCell>>, // Maps a def_id of an impl to an Impl structure. // Note that this contains all of the impls that we know about, @@ -4561,14 +4561,18 @@ pub fn populate_implementations_for_type_if_necessary(tcx: ctxt, let mut inherent_impls = tcx.inherent_impls.borrow_mut(); match inherent_impls.get().find(&type_id) { None => { - implementation_list = @mut ~[]; + implementation_list = @RefCell::new(~[]); inherent_impls.get().insert(type_id, implementation_list); } Some(&existing_implementation_list) => { implementation_list = existing_implementation_list; } } - implementation_list.push(implementation); + { + let mut implementation_list = + implementation_list.borrow_mut(); + implementation_list.get().push(implementation); + } } // Store the implementation info. diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index efee8c235354..0f92cdaae63f 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -536,7 +536,8 @@ impl<'a> LookupContext<'a> { let inherent_impls = self.tcx().inherent_impls.borrow(); let opt_impl_infos = inherent_impls.get().find(&did); for impl_infos in opt_impl_infos.iter() { - for impl_info in impl_infos.iter() { + let impl_infos = impl_infos.borrow(); + for impl_info in impl_infos.get().iter() { let mut inherent_candidates = self.inherent_candidates .borrow_mut(); self.push_candidates_from_impl(inherent_candidates.get(), diff --git a/src/librustc/middle/typeck/coherence.rs b/src/librustc/middle/typeck/coherence.rs index 481d815fe7b3..b7e0e2078d93 100644 --- a/src/librustc/middle/typeck/coherence.rs +++ b/src/librustc/middle/typeck/coherence.rs @@ -45,6 +45,7 @@ use syntax::codemap::Span; use syntax::opt_vec; use syntax::visit; +use std::cell::RefCell; use std::hashmap::HashSet; use std::result::Ok; use std::vec; @@ -391,7 +392,7 @@ impl CoherenceChecker { let mut inherent_impls = tcx.inherent_impls.borrow_mut(); match inherent_impls.get().find(&base_def_id) { None => { - implementation_list = @mut ~[]; + implementation_list = @RefCell::new(~[]); inherent_impls.get().insert(base_def_id, implementation_list); } Some(&existing_implementation_list) => { @@ -399,7 +400,8 @@ impl CoherenceChecker { } } - implementation_list.push(implementation); + let mut implementation_list = implementation_list.borrow_mut(); + implementation_list.get().push(implementation); } pub fn add_trait_impl(&self,