Skip to content

Commit 310c380

Browse files
committed
---
yaml --- r: 90729 b: refs/heads/master c: 0680520 h: refs/heads/master i: 90727: 17ff87b v: v3
1 parent 2fd40c5 commit 310c380

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 8c194a013651869ae44440e319b28dabfaa08f50
2+
refs/heads/master: 06805209e4f03f32ec0e06b156bb76fbf8f7a93e
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8

trunk/src/librustc/middle/trans/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub struct CrateContext {
9292
impl_method_cache: RefCell<HashMap<(ast::DefId, ast::Name), ast::DefId>>,
9393

9494
module_data: RefCell<HashMap<~str, ValueRef>>,
95-
lltypes: HashMap<ty::t, Type>,
95+
lltypes: RefCell<HashMap<ty::t, Type>>,
9696
llsizingtypes: HashMap<ty::t, Type>,
9797
adt_reprs: HashMap<ty::t, @adt::Repr>,
9898
symbol_hasher: Sha256,
@@ -203,7 +203,7 @@ impl CrateContext {
203203
extern_const_values: RefCell::new(HashMap::new()),
204204
impl_method_cache: RefCell::new(HashMap::new()),
205205
module_data: RefCell::new(HashMap::new()),
206-
lltypes: HashMap::new(),
206+
lltypes: RefCell::new(HashMap::new()),
207207
llsizingtypes: HashMap::new(),
208208
adt_reprs: HashMap::new(),
209209
symbol_hasher: symbol_hasher,

trunk/src/librustc/middle/trans/type_of.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,12 @@ pub fn sizing_type_of(cx: &mut CrateContext, t: ty::t) -> Type {
173173
// NB: If you update this, be sure to update `sizing_type_of()` as well.
174174
pub fn type_of(cx: &mut CrateContext, t: ty::t) -> Type {
175175
// Check the cache.
176-
match cx.lltypes.find(&t) {
177-
Some(&llty) => {
178-
return llty;
176+
{
177+
let lltypes = cx.lltypes.borrow();
178+
match lltypes.get().find(&t) {
179+
Some(&llty) => return llty,
180+
None => ()
179181
}
180-
None => ()
181182
}
182183

183184
debug!("type_of {} {:?}", t.repr(cx.tcx), t);
@@ -197,7 +198,8 @@ pub fn type_of(cx: &mut CrateContext, t: ty::t) -> Type {
197198
t_norm.repr(cx.tcx),
198199
t_norm,
199200
cx.tn.type_to_str(llty));
200-
cx.lltypes.insert(t, llty);
201+
let mut lltypes = cx.lltypes.borrow_mut();
202+
lltypes.get().insert(t, llty);
201203
return llty;
202204
}
203205

@@ -316,7 +318,10 @@ pub fn type_of(cx: &mut CrateContext, t: ty::t) -> Type {
316318
t.repr(cx.tcx),
317319
t,
318320
cx.tn.type_to_str(llty));
319-
cx.lltypes.insert(t, llty);
321+
{
322+
let mut lltypes = cx.lltypes.borrow_mut();
323+
lltypes.get().insert(t, llty);
324+
}
320325

321326
// If this was an enum or struct, fill in the type now.
322327
match ty::get(t).sty {

0 commit comments

Comments
 (0)