Skip to content

Commit 727fa3a

Browse files
committed
librustc: De-@mut impl_vtables in the type context
1 parent ea5368c commit 727fa3a

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/librustc/middle/ty.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ pub fn mk_ctxt(s: session::Session,
10061006
impls: RefCell::new(HashMap::new()),
10071007
used_unsafe: @mut HashSet::new(),
10081008
used_mut_nodes: @mut HashSet::new(),
1009-
impl_vtables: @mut HashMap::new(),
1009+
impl_vtables: RefCell::new(HashMap::new()),
10101010
populated_external_types: @mut HashSet::new(),
10111011
populated_external_traits: @mut HashSet::new(),
10121012

@@ -3980,8 +3980,9 @@ pub fn lookup_item_type(cx: ctxt,
39803980
pub fn lookup_impl_vtables(cx: ctxt,
39813981
did: ast::DefId)
39823982
-> typeck::impl_res {
3983+
let mut impl_vtables = cx.impl_vtables.borrow_mut();
39833984
lookup_locally_or_in_crate_store(
3984-
"impl_vtables", did, cx.impl_vtables,
3985+
"impl_vtables", did, impl_vtables.get(),
39853986
|| csearch::get_impl_vtables(cx, did) )
39863987
}
39873988

src/librustc/middle/typeck/check/vtable.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,9 @@ pub fn resolve_impl(ccx: @mut CrateCtxt,
778778
self_vtables: self_vtable_res
779779
};
780780
let impl_def_id = ast_util::local_def(impl_item.id);
781-
ccx.tcx.impl_vtables.insert(impl_def_id, res);
781+
782+
let mut impl_vtables = ccx.tcx.impl_vtables.borrow_mut();
783+
impl_vtables.get().insert(impl_def_id, res);
782784
}
783785

784786
impl visit::Visitor<()> for @FnCtxt {

src/librustc/middle/typeck/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ use util::common::time;
6868
use util::ppaux::Repr;
6969
use util::ppaux;
7070

71+
use std::cell::RefCell;
7172
use std::hashmap::HashMap;
7273
use std::result;
7374
use extra::list::List;
@@ -225,7 +226,7 @@ impl Repr for impl_res {
225226
}
226227
}
227228

228-
pub type impl_vtable_map = @mut HashMap<ast::DefId, impl_res>;
229+
pub type impl_vtable_map = RefCell<HashMap<ast::DefId, impl_res>>;
229230

230231
pub struct CrateCtxt {
231232
// A mapping from method call sites to traits that have that method.

0 commit comments

Comments
 (0)