librustc: De-@mut the impls table in the type context
This commit is contained in:
parent
42f7f7f437
commit
55a7b2fedd
4 changed files with 14 additions and 8 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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<ast::DefId, @Impl>,
|
||||
impls: RefCell<HashMap<ast::DefId, @Impl>>,
|
||||
|
||||
// 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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue