librustc: De-@mut the write guard map

This commit is contained in:
Patrick Walton 2013-12-21 14:08:22 -08:00
parent b5b403abcc
commit bc1ea7887c
4 changed files with 10 additions and 6 deletions
src/librustc/middle

@ -419,7 +419,10 @@ impl<'a> CheckLoanCtxt<'a> {
derefs: deref_count
};
debug!("Inserting write guard at {:?}", key);
this.bccx.write_guard_map.insert(key);
let mut write_guard_map = this.bccx
.write_guard_map
.borrow_mut();
write_guard_map.get().insert(key);
}
_ => {}

@ -82,7 +82,7 @@ pub fn check_crate(
moved_variables_set: moved_variables_set,
capture_map: capture_map,
root_map: root_map(),
write_guard_map: @mut HashSet::new(),
write_guard_map: @RefCell::new(HashSet::new()),
stats: @mut BorrowStats {
loaned_paths_same: 0,
loaned_paths_imm: 0,
@ -217,7 +217,7 @@ pub struct root_map_key {
// A set containing IDs of expressions of gc'd type that need to have a write
// guard.
pub type write_guard_map = @mut HashSet<root_map_key>;
pub type write_guard_map = @RefCell<HashSet<root_map_key>>;
pub type BckResult<T> = Result<T, BckError>;

@ -123,7 +123,7 @@ pub fn lookup_variant_by_id(tcx: ty::ctxt,
root_map: @RefCell::new(HashMap::new()),
method_map: @mut HashMap::new(),
vtable_map: @RefCell::new(HashMap::new()),
write_guard_map: @mut HashSet::new(),
write_guard_map: @RefCell::new(HashSet::new()),
capture_map: @RefCell::new(HashMap::new())
};
let e = match csearch::maybe_get_item_ast(tcx, enum_def,
@ -173,7 +173,7 @@ pub fn lookup_const_by_id(tcx: ty::ctxt,
root_map: @RefCell::new(HashMap::new()),
method_map: @mut HashMap::new(),
vtable_map: @RefCell::new(HashMap::new()),
write_guard_map: @mut HashSet::new(),
write_guard_map: @RefCell::new(HashSet::new()),
capture_map: @RefCell::new(HashMap::new())
};
let e = match csearch::maybe_get_item_ast(tcx, def_id,

@ -56,7 +56,8 @@ pub fn root_and_write_guard(datum: &Datum,
// Perform the write guard, if necessary.
//
// (Note: write-guarded values are always boxes)
if ccx.maps.write_guard_map.contains(&key) {
let write_guard_map = ccx.maps.write_guard_map.borrow();
if write_guard_map.get().contains(&key) {
perform_write_guard(datum, bcx, span)
} else {
bcx