Skip to content

Commit b51e452

Browse files
committed
---
yaml --- r: 147547 b: refs/heads/try2 c: 4dc923f h: refs/heads/master i: 147545: b892e78 147543: 614ddfe v: v3
1 parent 329b4fa commit b51e452

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 5b98c66593660cfa4ee4d39aabeaa97bb36eb75f
8+
refs/heads/try2: 4dc923fbda6f55a15583ed5f60aef08c1faf2cba
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/middle/ty.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ struct ctxt_ {
313313
enum_var_cache: RefCell<HashMap<DefId, @~[@VariantInfo]>>,
314314
ty_param_defs: RefCell<HashMap<ast::NodeId, TypeParameterDef>>,
315315
adjustments: RefCell<HashMap<ast::NodeId, @AutoAdjustment>>,
316-
normalized_cache: @mut HashMap<t, t>,
316+
normalized_cache: RefCell<HashMap<t, t>>,
317317
lang_items: middle::lang_items::LanguageItems,
318318
// A mapping of fake provided method def_ids to the default implementation
319319
provided_method_sources: RefCell<HashMap<ast::DefId, ast::DefId>>,
@@ -961,10 +961,6 @@ fn mk_rcache() -> creader_cache {
961961
return @mut HashMap::new();
962962
}
963963

964-
pub fn new_ty_hash<V:'static>() -> @mut HashMap<t, V> {
965-
@mut HashMap::new()
966-
}
967-
968964
pub fn mk_ctxt(s: session::Session,
969965
dm: resolve::DefMap,
970966
named_region_map: @mut resolve_lifetime::NamedRegionMap,
@@ -1003,7 +999,7 @@ pub fn mk_ctxt(s: session::Session,
1003999
impl_trait_cache: RefCell::new(HashMap::new()),
10041000
ty_param_defs: RefCell::new(HashMap::new()),
10051001
adjustments: RefCell::new(HashMap::new()),
1006-
normalized_cache: new_ty_hash(),
1002+
normalized_cache: RefCell::new(HashMap::new()),
10071003
lang_items: lang_items,
10081004
provided_method_sources: RefCell::new(HashMap::new()),
10091005
supertraits: RefCell::new(HashMap::new()),
@@ -4265,13 +4261,20 @@ pub fn normalize_ty(cx: ctxt, t: t) -> t {
42654261
fn tcx(&self) -> ty::ctxt { **self }
42664262

42674263
fn fold_ty(&mut self, t: ty::t) -> ty::t {
4268-
match self.tcx().normalized_cache.find_copy(&t) {
4264+
let normalized_opt = {
4265+
let normalized_cache = self.tcx().normalized_cache.borrow();
4266+
normalized_cache.get().find_copy(&t)
4267+
};
4268+
match normalized_opt {
42694269
Some(u) => {
42704270
return u;
42714271
}
42724272
None => {
42734273
let t_norm = ty_fold::super_fold_ty(self, t);
4274-
self.tcx().normalized_cache.insert(t, t_norm);
4274+
let mut normalized_cache = self.tcx()
4275+
.normalized_cache
4276+
.borrow_mut();
4277+
normalized_cache.get().insert(t, t_norm);
42754278
return t_norm;
42764279
}
42774280
}

0 commit comments

Comments
 (0)