librustc: De-@mut extern_const_variants in the type context

This commit is contained in:
Patrick Walton 2013-12-19 19:24:05 -08:00
parent a5db84ce12
commit b976226d52
2 changed files with 14 additions and 7 deletions

View File

@ -111,9 +111,12 @@ fn variant_expr(variants: &[ast::P<ast::variant>], id: ast::NodeId) -> Option<@E
Some(_) => None
}
} else {
match tcx.extern_const_variants.find(&variant_def) {
Some(&e) => return e,
None => {}
{
let extern_const_variants = tcx.extern_const_variants.borrow();
match extern_const_variants.get().find(&variant_def) {
Some(&e) => return e,
None => {}
}
}
let maps = astencode::Maps {
root_map: @mut HashMap::new(),
@ -136,8 +139,12 @@ fn variant_expr(variants: &[ast::P<ast::variant>], id: ast::NodeId) -> Option<@E
},
_ => None
};
tcx.extern_const_variants.insert(variant_def, e);
return e;
{
let mut extern_const_variants = tcx.extern_const_variants
.borrow_mut();
extern_const_variants.get().insert(variant_def, e);
return e;
}
}
}

View File

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