Skip to content

Commit ef79d2a

Browse files
committed
---
yaml --- r: 88886 b: refs/heads/snap-stage3 c: 6a0450c h: refs/heads/master v: v3
1 parent 9240a77 commit ef79d2a

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
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: ba2e6c1e9516ecf01378e4e54fd857e069535826
4+
refs/heads/snap-stage3: 6a0450c67d81c6969fa43c01d37a2f196b7d58ce
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: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ struct ctxt_ {
309309
rcache: creader_cache,
310310
short_names_cache: RefCell<HashMap<t, @str>>,
311311
needs_unwind_cleanup_cache: RefCell<HashMap<t, bool>>,
312-
tc_cache: @mut HashMap<uint, TypeContents>,
312+
tc_cache: RefCell<HashMap<uint, TypeContents>>,
313313
ast_ty_to_ty_cache: @mut HashMap<NodeId, ast_ty_to_ty_cache_entry>,
314314
enum_var_cache: @mut HashMap<DefId, @~[@VariantInfo]>,
315315
ty_param_defs: @mut HashMap<ast::NodeId, TypeParameterDef>,
@@ -995,7 +995,7 @@ pub fn mk_ctxt(s: session::Session,
995995
rcache: mk_rcache(),
996996
short_names_cache: RefCell::new(HashMap::new()),
997997
needs_unwind_cleanup_cache: RefCell::new(HashMap::new()),
998-
tc_cache: @mut HashMap::new(),
998+
tc_cache: RefCell::new(HashMap::new()),
999999
ast_ty_to_ty_cache: @mut HashMap::new(),
10001000
enum_var_cache: @mut HashMap::new(),
10011001
methods: RefCell::new(HashMap::new()),
@@ -1970,14 +1970,20 @@ pub fn type_is_freezable(cx: ctxt, t: ty::t) -> bool {
19701970

19711971
pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
19721972
let ty_id = type_id(ty);
1973-
match cx.tc_cache.find(&ty_id) {
1974-
Some(tc) => { return *tc; }
1975-
None => {}
1973+
1974+
{
1975+
let tc_cache = cx.tc_cache.borrow();
1976+
match tc_cache.get().find(&ty_id) {
1977+
Some(tc) => { return *tc; }
1978+
None => {}
1979+
}
19761980
}
19771981

19781982
let mut cache = HashMap::new();
19791983
let result = tc_ty(cx, ty, &mut cache);
1980-
cx.tc_cache.insert(ty_id, result);
1984+
1985+
let mut tc_cache = cx.tc_cache.borrow_mut();
1986+
tc_cache.get().insert(ty_id, result);
19811987
return result;
19821988

19831989
fn tc_ty(cx: ctxt,
@@ -2010,9 +2016,12 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
20102016
Some(tc) => { return *tc; }
20112017
None => {}
20122018
}
2013-
match cx.tc_cache.find(&ty_id) { // Must check both caches!
2014-
Some(tc) => { return *tc; }
2015-
None => {}
2019+
{
2020+
let tc_cache = cx.tc_cache.borrow();
2021+
match tc_cache.get().find(&ty_id) { // Must check both caches!
2022+
Some(tc) => { return *tc; }
2023+
None => {}
2024+
}
20162025
}
20172026
cache.insert(ty_id, TC::None);
20182027

0 commit comments

Comments
 (0)