mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 22:18:23 +03:00
librustc: De-@mut the extern_const_statics table in the type context
This commit is contained in:
@@ -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(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user