diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index c04d7b1418fd..00ec1fd9fe6e 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -1084,7 +1084,8 @@ fn encode_info_for_item(ecx: &EncodeContext, item_impl(_, ref opt_trait, ty, ref ast_methods) => { // We need to encode information about the default methods we // have inherited, so we drive this based on the impl structure. - let imp = tcx.impls.get(&def_id); + let impls = tcx.impls.borrow(); + let imp = impls.get().get(&def_id); add_to_index(); ebml_w.start_tag(tag_items_data_item); diff --git a/src/librustc/middle/trans/meth.rs b/src/librustc/middle/trans/meth.rs index 2fdc444920a7..6b7963a226cf 100644 --- a/src/librustc/middle/trans/meth.rs +++ b/src/librustc/middle/trans/meth.rs @@ -305,7 +305,8 @@ pub fn method_with_name(ccx: &CrateContext, } } - let imp = ccx.tcx.impls.find(&impl_id) + let impls = ccx.tcx.impls.borrow(); + let imp = impls.get().find(&impl_id) .expect("could not find impl while translating"); let meth = imp.methods.iter().find(|m| m.ident.name == name) .expect("could not find method while translating"); diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 976a4f3af68c..8722aba15997 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -344,7 +344,7 @@ struct ctxt_ { // Note that this contains all of the impls that we know about, // including ones in other crates. It's not clear that this is the best // way to do it. - impls: @mut HashMap, + impls: RefCell>, // Set of used unsafe nodes (functions or blocks). Unsafe nodes not // present in this set can be warned about. @@ -1007,7 +1007,7 @@ pub fn mk_ctxt(s: session::Session, destructors: RefCell::new(HashSet::new()), trait_impls: RefCell::new(HashMap::new()), inherent_impls: RefCell::new(HashMap::new()), - impls: @mut HashMap::new(), + impls: RefCell::new(HashMap::new()), used_unsafe: @mut HashSet::new(), used_mut_nodes: @mut HashSet::new(), impl_vtables: @mut HashMap::new(), @@ -4563,7 +4563,8 @@ pub fn populate_implementations_for_type_if_necessary(tcx: ctxt, } // Store the implementation info. - tcx.impls.insert(implementation_def_id, implementation); + let mut impls = tcx.impls.borrow_mut(); + impls.get().insert(implementation_def_id, implementation); }); tcx.populated_external_types.insert(type_id); @@ -4599,7 +4600,8 @@ pub fn populate_implementations_for_trait_if_necessary( } // Store the implementation info. - tcx.impls.insert(implementation_def_id, implementation); + let mut impls = tcx.impls.borrow_mut(); + impls.get().insert(implementation_def_id, implementation); }); tcx.populated_external_traits.insert(trait_id); diff --git a/src/librustc/middle/typeck/coherence.rs b/src/librustc/middle/typeck/coherence.rs index f4ffd03cf641..1fcb8d80c7bd 100644 --- a/src/librustc/middle/typeck/coherence.rs +++ b/src/librustc/middle/typeck/coherence.rs @@ -313,7 +313,8 @@ impl CoherenceChecker { } } - tcx.impls.insert(implementation.did, implementation); + let mut impls = tcx.impls.borrow_mut(); + impls.get().insert(implementation.did, implementation); } // Creates default method IDs and performs type substitutions for an impl @@ -665,7 +666,8 @@ impl CoherenceChecker { } } - tcx.impls.insert(implementation.did, implementation); + let mut impls = tcx.impls.borrow_mut(); + impls.get().insert(implementation.did, implementation); } // Adds implementations and traits from external crates to the coherence