Skip to content

Commit be1e2c0

Browse files
committed
---
yaml --- r: 88880 b: refs/heads/snap-stage3 c: efdbd60 h: refs/heads/master v: v3
1 parent d309cc8 commit be1e2c0

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: deeca5d586bfaa4aa60246f671a8d611d38f6248
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 02f13adaa34fea513ea6d3b48e8f47eff93e47a7
4+
refs/heads/snap-stage3: efdbd60a87d8a997df39907cf11ecfa5a8ba707e
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/middle/ty.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ struct ctxt_ {
295295
// A cache for the trait_methods() routine
296296
trait_methods_cache: RefCell<HashMap<DefId, @~[@Method]>>,
297297

298-
impl_trait_cache: @mut HashMap<ast::DefId, Option<@ty::TraitRef>>,
298+
impl_trait_cache: RefCell<HashMap<ast::DefId, Option<@ty::TraitRef>>>,
299299

300300
trait_refs: @mut HashMap<NodeId, @TraitRef>,
301301
trait_defs: @mut HashMap<DefId, @TraitDef>,
@@ -1001,7 +1001,7 @@ pub fn mk_ctxt(s: session::Session,
10011001
methods: RefCell::new(HashMap::new()),
10021002
trait_method_def_ids: RefCell::new(HashMap::new()),
10031003
trait_methods_cache: RefCell::new(HashMap::new()),
1004-
impl_trait_cache: @mut HashMap::new(),
1004+
impl_trait_cache: RefCell::new(HashMap::new()),
10051005
ty_param_defs: @mut HashMap::new(),
10061006
adjustments: @mut HashMap::new(),
10071007
normalized_cache: new_ty_hash(),
@@ -3621,10 +3621,14 @@ pub fn trait_method_def_ids(cx: ctxt, id: ast::DefId) -> @~[DefId] {
36213621
}
36223622

36233623
pub fn impl_trait_ref(cx: ctxt, id: ast::DefId) -> Option<@TraitRef> {
3624-
match cx.impl_trait_cache.find(&id) {
3625-
Some(&ret) => { return ret; }
3626-
None => {}
3624+
{
3625+
let mut impl_trait_cache = cx.impl_trait_cache.borrow_mut();
3626+
match impl_trait_cache.get().find(&id) {
3627+
Some(&ret) => { return ret; }
3628+
None => {}
3629+
}
36273630
}
3631+
36283632
let ret = if id.crate == ast::LOCAL_CRATE {
36293633
debug!("(impl_trait_ref) searching for trait impl {:?}", id);
36303634
match cx.items.find(&id.node) {
@@ -3642,7 +3646,9 @@ pub fn impl_trait_ref(cx: ctxt, id: ast::DefId) -> Option<@TraitRef> {
36423646
} else {
36433647
csearch::get_impl_trait(cx, id)
36443648
};
3645-
cx.impl_trait_cache.insert(id, ret);
3649+
3650+
let mut impl_trait_cache = cx.impl_trait_cache.borrow_mut();
3651+
impl_trait_cache.get().insert(id, ret);
36463652
return ret;
36473653
}
36483654

0 commit comments

Comments
 (0)