Skip to content

Commit a66fcca

Browse files
committed
librustc: De-@mut destructors in the type context
1 parent daf31d2 commit a66fcca

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/librustc/middle/ty.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ struct ctxt_ {
330330
destructor_for_type: RefCell<HashMap<ast::DefId, ast::DefId>>,
331331

332332
// A method will be in this list if and only if it is a destructor.
333-
destructors: @mut HashSet<ast::DefId>,
333+
destructors: RefCell<HashSet<ast::DefId>>,
334334

335335
// Maps a trait onto a list of impls of that trait.
336336
trait_impls: @mut HashMap<ast::DefId, @mut ~[@Impl]>,
@@ -1004,7 +1004,7 @@ pub fn mk_ctxt(s: session::Session,
10041004
provided_method_sources: RefCell::new(HashMap::new()),
10051005
supertraits: RefCell::new(HashMap::new()),
10061006
destructor_for_type: RefCell::new(HashMap::new()),
1007-
destructors: @mut HashSet::new(),
1007+
destructors: RefCell::new(HashSet::new()),
10081008
trait_impls: @mut HashMap::new(),
10091009
inherent_impls: @mut HashMap::new(),
10101010
impls: @mut HashMap::new(),

src/librustc/middle/typeck/check/method.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,8 @@ impl<'a> LookupContext<'a> {
11511151
let bad;
11521152
match candidate.origin {
11531153
method_static(method_id) => {
1154-
bad = self.tcx().destructors.contains(&method_id);
1154+
let destructors = self.tcx().destructors.borrow();
1155+
bad = destructors.get().contains(&method_id);
11551156
}
11561157
// XXX: does this properly enforce this on everything now
11571158
// that self has been merged in? -sully

src/librustc/middle/typeck/coherence.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,8 @@ impl CoherenceChecker {
709709
.borrow_mut();
710710
destructor_for_type.get().insert(type_def_id,
711711
method_def_id);
712-
tcx.destructors.insert(method_def_id);
712+
let mut destructors = tcx.destructors.borrow_mut();
713+
destructors.get().insert(method_def_id);
713714
}
714715
_ => {
715716
// Destructors only work on nominal types.

0 commit comments

Comments
 (0)