librustc: De-@mut impl_vtables in the type context

This commit is contained in:
Patrick Walton 2013-12-19 19:40:43 -08:00
parent ea5368ce6e
commit 727fa3aa01
3 changed files with 8 additions and 4 deletions

View File

@ -1006,7 +1006,7 @@ pub fn mk_ctxt(s: session::Session,
impls: RefCell::new(HashMap::new()),
used_unsafe: @mut HashSet::new(),
used_mut_nodes: @mut HashSet::new(),
impl_vtables: @mut HashMap::new(),
impl_vtables: RefCell::new(HashMap::new()),
populated_external_types: @mut HashSet::new(),
populated_external_traits: @mut HashSet::new(),
@ -3980,8 +3980,9 @@ pub fn lookup_item_type(cx: ctxt,
pub fn lookup_impl_vtables(cx: ctxt,
did: ast::DefId)
-> typeck::impl_res {
let mut impl_vtables = cx.impl_vtables.borrow_mut();
lookup_locally_or_in_crate_store(
"impl_vtables", did, cx.impl_vtables,
"impl_vtables", did, impl_vtables.get(),
|| csearch::get_impl_vtables(cx, did) )
}

View File

@ -778,7 +778,9 @@ pub fn resolve_impl(ccx: @mut CrateCtxt,
self_vtables: self_vtable_res
};
let impl_def_id = ast_util::local_def(impl_item.id);
ccx.tcx.impl_vtables.insert(impl_def_id, res);
let mut impl_vtables = ccx.tcx.impl_vtables.borrow_mut();
impl_vtables.get().insert(impl_def_id, res);
}
impl visit::Visitor<()> for @FnCtxt {

View File

@ -68,6 +68,7 @@ use util::common::time;
use util::ppaux::Repr;
use util::ppaux;
use std::cell::RefCell;
use std::hashmap::HashMap;
use std::result;
use extra::list::List;
@ -225,7 +226,7 @@ impl Repr for impl_res {
}
}
pub type impl_vtable_map = @mut HashMap<ast::DefId, impl_res>;
pub type impl_vtable_map = RefCell<HashMap<ast::DefId, impl_res>>;
pub struct CrateCtxt {
// A mapping from method call sites to traits that have that method.