librustc: De-@mut CrateContext::llsizingtypes

This commit is contained in:
Patrick Walton 2013-12-18 17:53:54 -08:00
parent 06805209e4
commit db83a957b6
2 changed files with 10 additions and 6 deletions

View file

@ -93,7 +93,7 @@ pub struct CrateContext {
module_data: RefCell<HashMap<~str, ValueRef>>,
lltypes: RefCell<HashMap<ty::t, Type>>,
llsizingtypes: HashMap<ty::t, Type>,
llsizingtypes: RefCell<HashMap<ty::t, Type>>,
adt_reprs: HashMap<ty::t, @adt::Repr>,
symbol_hasher: Sha256,
type_hashcodes: HashMap<ty::t, @str>,
@ -204,7 +204,7 @@ impl CrateContext {
impl_method_cache: RefCell::new(HashMap::new()),
module_data: RefCell::new(HashMap::new()),
lltypes: RefCell::new(HashMap::new()),
llsizingtypes: HashMap::new(),
llsizingtypes: RefCell::new(HashMap::new()),
adt_reprs: HashMap::new(),
symbol_hasher: symbol_hasher,
type_hashcodes: HashMap::new(),

View file

@ -101,9 +101,12 @@ pub fn type_of_fn_from_ty(cx: &mut CrateContext, fty: ty::t) -> Type {
// recursive types. For example, enum types rely on this behavior.
pub fn sizing_type_of(cx: &mut CrateContext, t: ty::t) -> Type {
match cx.llsizingtypes.find_copy(&t) {
Some(t) => return t,
None => ()
{
let llsizingtypes = cx.llsizingtypes.borrow();
match llsizingtypes.get().find_copy(&t) {
Some(t) => return t,
None => ()
}
}
let llsizingty = match ty::get(t).sty {
@ -166,7 +169,8 @@ pub fn sizing_type_of(cx: &mut CrateContext, t: ty::t) -> Type {
}
};
cx.llsizingtypes.insert(t, llsizingty);
let mut llsizingtypes = cx.llsizingtypes.borrow_mut();
llsizingtypes.get().insert(t, llsizingty);
llsizingty
}