Skip to content

Commit b13d64f

Browse files
committed
---
yaml --- r: 96976 b: refs/heads/dist-snap c: 0680520 h: refs/heads/master v: v3
1 parent f39da74 commit b13d64f

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
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 8c194a013651869ae44440e319b28dabfaa08f50
9+
refs/heads/dist-snap: 06805209e4f03f32ec0e06b156bb76fbf8f7a93e
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/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,

branches/dist-snap/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)