Skip to content

Commit db83a95

Browse files
committed
librustc: De-@mut CrateContext::llsizingtypes
1 parent 0680520 commit db83a95

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/librustc/middle/trans/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pub struct CrateContext {
9393

9494
module_data: RefCell<HashMap<~str, ValueRef>>,
9595
lltypes: RefCell<HashMap<ty::t, Type>>,
96-
llsizingtypes: HashMap<ty::t, Type>,
96+
llsizingtypes: RefCell<HashMap<ty::t, Type>>,
9797
adt_reprs: HashMap<ty::t, @adt::Repr>,
9898
symbol_hasher: Sha256,
9999
type_hashcodes: HashMap<ty::t, @str>,
@@ -204,7 +204,7 @@ impl CrateContext {
204204
impl_method_cache: RefCell::new(HashMap::new()),
205205
module_data: RefCell::new(HashMap::new()),
206206
lltypes: RefCell::new(HashMap::new()),
207-
llsizingtypes: HashMap::new(),
207+
llsizingtypes: RefCell::new(HashMap::new()),
208208
adt_reprs: HashMap::new(),
209209
symbol_hasher: symbol_hasher,
210210
type_hashcodes: HashMap::new(),

src/librustc/middle/trans/type_of.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,12 @@ pub fn type_of_fn_from_ty(cx: &mut CrateContext, fty: ty::t) -> Type {
101101
// recursive types. For example, enum types rely on this behavior.
102102

103103
pub fn sizing_type_of(cx: &mut CrateContext, t: ty::t) -> Type {
104-
match cx.llsizingtypes.find_copy(&t) {
105-
Some(t) => return t,
106-
None => ()
104+
{
105+
let llsizingtypes = cx.llsizingtypes.borrow();
106+
match llsizingtypes.get().find_copy(&t) {
107+
Some(t) => return t,
108+
None => ()
109+
}
107110
}
108111

109112
let llsizingty = match ty::get(t).sty {
@@ -166,7 +169,8 @@ pub fn sizing_type_of(cx: &mut CrateContext, t: ty::t) -> Type {
166169
}
167170
};
168171

169-
cx.llsizingtypes.insert(t, llsizingty);
172+
let mut llsizingtypes = cx.llsizingtypes.borrow_mut();
173+
llsizingtypes.get().insert(t, llsizingty);
170174
llsizingty
171175
}
172176

0 commit comments

Comments
 (0)