librustc: De-@mut destructors in the type context

This commit is contained in:
Patrick Walton 2013-12-19 19:05:11 -08:00
parent daf31d2b4f
commit a66fcca9c9
3 changed files with 6 additions and 4 deletions
src/librustc/middle

@ -330,7 +330,7 @@ struct ctxt_ {
destructor_for_type: RefCell<HashMap<ast::DefId, ast::DefId>>,
// A method will be in this list if and only if it is a destructor.
destructors: @mut HashSet<ast::DefId>,
destructors: RefCell<HashSet<ast::DefId>>,
// Maps a trait onto a list of impls of that trait.
trait_impls: @mut HashMap<ast::DefId, @mut ~[@Impl]>,
@ -1004,7 +1004,7 @@ pub fn mk_ctxt(s: session::Session,
provided_method_sources: RefCell::new(HashMap::new()),
supertraits: RefCell::new(HashMap::new()),
destructor_for_type: RefCell::new(HashMap::new()),
destructors: @mut HashSet::new(),
destructors: RefCell::new(HashSet::new()),
trait_impls: @mut HashMap::new(),
inherent_impls: @mut HashMap::new(),
impls: @mut HashMap::new(),

@ -1151,7 +1151,8 @@ impl<'a> LookupContext<'a> {
let bad;
match candidate.origin {
method_static(method_id) => {
bad = self.tcx().destructors.contains(&method_id);
let destructors = self.tcx().destructors.borrow();
bad = destructors.get().contains(&method_id);
}
// XXX: does this properly enforce this on everything now
// that self has been merged in? -sully

@ -709,7 +709,8 @@ impl CoherenceChecker {
.borrow_mut();
destructor_for_type.get().insert(type_def_id,
method_def_id);
tcx.destructors.insert(method_def_id);
let mut destructors = tcx.destructors.borrow_mut();
destructors.get().insert(method_def_id);
}
_ => {
// Destructors only work on nominal types.