librustc: De-@mut
destructor_for_type
in the type context
This commit is contained in:
parent
4dc923fbda
commit
752283889c
@ -374,7 +374,8 @@ impl ReachableContext {
|
||||
// this properly would result in the necessity of computing *type*
|
||||
// reachability, which might result in a compile time loss.
|
||||
fn mark_destructors_reachable(&self) {
|
||||
for (_, destructor_def_id) in self.tcx.destructor_for_type.iter() {
|
||||
let destructor_for_type = self.tcx.destructor_for_type.borrow();
|
||||
for (_, destructor_def_id) in destructor_for_type.get().iter() {
|
||||
if destructor_def_id.crate == ast::LOCAL_CRATE {
|
||||
self.reachable_symbols.insert(destructor_def_id.node);
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ struct ctxt_ {
|
||||
// of the method that implements its destructor. If the type is not
|
||||
// present in this map, it does not have a destructor. This map is
|
||||
// populated during the coherence phase of typechecking.
|
||||
destructor_for_type: @mut HashMap<ast::DefId, ast::DefId>,
|
||||
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>,
|
||||
@ -1003,7 +1003,7 @@ pub fn mk_ctxt(s: session::Session,
|
||||
lang_items: lang_items,
|
||||
provided_method_sources: RefCell::new(HashMap::new()),
|
||||
supertraits: RefCell::new(HashMap::new()),
|
||||
destructor_for_type: @mut HashMap::new(),
|
||||
destructor_for_type: RefCell::new(HashMap::new()),
|
||||
destructors: @mut HashSet::new(),
|
||||
trait_impls: @mut HashMap::new(),
|
||||
inherent_impls: @mut HashMap::new(),
|
||||
@ -3813,7 +3813,8 @@ impl DtorKind {
|
||||
/* If struct_id names a struct with a dtor, return Some(the dtor's id).
|
||||
Otherwise return none. */
|
||||
pub fn ty_dtor(cx: ctxt, struct_id: DefId) -> DtorKind {
|
||||
match cx.destructor_for_type.find(&struct_id) {
|
||||
let destructor_for_type = cx.destructor_for_type.borrow();
|
||||
match destructor_for_type.get().find(&struct_id) {
|
||||
Some(&method_def_id) => {
|
||||
let flag = !has_attr(cx, struct_id, "unsafe_no_drop_flag");
|
||||
|
||||
|
@ -1157,7 +1157,10 @@ impl<'a> LookupContext<'a> {
|
||||
// that self has been merged in? -sully
|
||||
method_param(method_param { trait_id: trait_id, .. }) |
|
||||
method_object(method_object { trait_id: trait_id, .. }) => {
|
||||
bad = self.tcx().destructor_for_type.contains_key(&trait_id);
|
||||
let destructor_for_type = self.tcx()
|
||||
.destructor_for_type
|
||||
.borrow();
|
||||
bad = destructor_for_type.get().contains_key(&trait_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -705,8 +705,10 @@ impl CoherenceChecker {
|
||||
let self_type = self.get_self_type_for_implementation(*impl_info);
|
||||
match ty::get(self_type.ty).sty {
|
||||
ty::ty_struct(type_def_id, _) => {
|
||||
tcx.destructor_for_type.insert(type_def_id,
|
||||
method_def_id);
|
||||
let mut destructor_for_type = tcx.destructor_for_type
|
||||
.borrow_mut();
|
||||
destructor_for_type.get().insert(type_def_id,
|
||||
method_def_id);
|
||||
tcx.destructors.insert(method_def_id);
|
||||
}
|
||||
_ => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user