Skip to content

Commit 9260e2a

Browse files
committed
---
yaml --- r: 97005 b: refs/heads/dist-snap c: 7f5e57a h: refs/heads/master i: 97003: 2fb851f v: v3
1 parent 8d0274d commit 9260e2a

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
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: 84e450347b00ca9a06b3f763fdebff8257e210e8
9+
refs/heads/dist-snap: 7f5e57a5a93a868b5bd9485b9c9d45e997a78e41
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/ty.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ struct ctxt_ {
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>>,
320-
supertraits: @mut HashMap<ast::DefId, @~[@TraitRef]>,
320+
supertraits: RefCell<HashMap<ast::DefId, @~[@TraitRef]>>,
321321

322322
// Maps from def-id of a type or region parameter to its
323323
// (inferred) variance.
@@ -1006,7 +1006,7 @@ pub fn mk_ctxt(s: session::Session,
10061006
normalized_cache: new_ty_hash(),
10071007
lang_items: lang_items,
10081008
provided_method_sources: RefCell::new(HashMap::new()),
1009-
supertraits: @mut HashMap::new(),
1009+
supertraits: RefCell::new(HashMap::new()),
10101010
destructor_for_type: @mut HashMap::new(),
10111011
destructors: @mut HashSet::new(),
10121012
trait_impls: @mut HashMap::new(),
@@ -3552,13 +3552,14 @@ pub fn provided_trait_methods(cx: ctxt, id: ast::DefId) -> ~[@Method] {
35523552
}
35533553
}
35543554

3555-
pub fn trait_supertraits(cx: ctxt,
3556-
id: ast::DefId) -> @~[@TraitRef]
3557-
{
3555+
pub fn trait_supertraits(cx: ctxt, id: ast::DefId) -> @~[@TraitRef] {
35583556
// Check the cache.
3559-
match cx.supertraits.find(&id) {
3560-
Some(&trait_refs) => { return trait_refs; }
3561-
None => {} // Continue.
3557+
{
3558+
let supertraits = cx.supertraits.borrow();
3559+
match supertraits.get().find(&id) {
3560+
Some(&trait_refs) => { return trait_refs; }
3561+
None => {} // Continue.
3562+
}
35623563
}
35633564

35643565
// Not in the cache. It had better be in the metadata, which means it
@@ -3568,7 +3569,8 @@ pub fn trait_supertraits(cx: ctxt,
35683569
// Get the supertraits out of the metadata and create the
35693570
// TraitRef for each.
35703571
let result = @csearch::get_supertraits(cx, id);
3571-
cx.supertraits.insert(id, result);
3572+
let mut supertraits = cx.supertraits.borrow_mut();
3573+
supertraits.get().insert(id, result);
35723574
return result;
35733575
}
35743576

branches/dist-snap/src/librustc/middle/typeck/collect.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,10 @@ pub fn ensure_supertraits(ccx: &CrateCtxt,
401401

402402
// Called only the first time trait_def_of_item is called.
403403
// Supertraits are ensured at the same time.
404-
assert!(!tcx.supertraits.contains_key(&local_def(id)));
404+
{
405+
let supertraits = tcx.supertraits.borrow();
406+
assert!(!supertraits.get().contains_key(&local_def(id)));
407+
}
405408

406409
let self_ty = ty::mk_self(ccx.tcx, local_def(id));
407410
let mut ty_trait_refs: ~[@ty::TraitRef] = ~[];
@@ -425,7 +428,9 @@ pub fn ensure_supertraits(ccx: &CrateCtxt,
425428
}
426429
}
427430
}
428-
tcx.supertraits.insert(local_def(id), @ty_trait_refs);
431+
432+
let mut supertraits = tcx.supertraits.borrow_mut();
433+
supertraits.get().insert(local_def(id), @ty_trait_refs);
429434
bounds
430435
}
431436

0 commit comments

Comments
 (0)