librustc: De-@mut the extern_const_statics table in the type context

This commit is contained in:
Patrick Walton 2013-12-19 19:21:42 -08:00
parent 55a7b2fedd
commit a5db84ce12
2 changed files with 14 additions and 7 deletions
src/librustc/middle

@ -154,9 +154,12 @@ pub fn lookup_const_by_id(tcx: ty::ctxt,
Some(_) => None
}
} else {
match tcx.extern_const_statics.find(&def_id) {
Some(&e) => return e,
None => {}
{
let extern_const_statics = tcx.extern_const_statics.borrow();
match extern_const_statics.get().find(&def_id) {
Some(&e) => return e,
None => {}
}
}
let maps = astencode::Maps {
root_map: @mut HashMap::new(),
@ -173,8 +176,12 @@ pub fn lookup_const_by_id(tcx: ty::ctxt,
},
_ => None
};
tcx.extern_const_statics.insert(def_id, e);
return e;
{
let mut extern_const_statics = tcx.extern_const_statics
.borrow_mut();
extern_const_statics.get().insert(def_id, e);
return e;
}
}
}

@ -368,7 +368,7 @@ struct ctxt_ {
// These two caches are used by const_eval when decoding external statics
// and variants that are found.
extern_const_statics: @mut HashMap<ast::DefId, Option<@ast::Expr>>,
extern_const_statics: RefCell<HashMap<ast::DefId, Option<@ast::Expr>>>,
extern_const_variants: @mut HashMap<ast::DefId, Option<@ast::Expr>>,
}
@ -1014,7 +1014,7 @@ pub fn mk_ctxt(s: session::Session,
populated_external_types: @mut HashSet::new(),
populated_external_traits: @mut HashSet::new(),
extern_const_statics: @mut HashMap::new(),
extern_const_statics: RefCell::new(HashMap::new()),
extern_const_variants: @mut HashMap::new(),
}
}