File tree Expand file tree Collapse file tree 4 files changed +10
-6
lines changed Expand file tree Collapse file tree 4 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -419,7 +419,10 @@ impl<'a> CheckLoanCtxt<'a> {
419
419
derefs : deref_count
420
420
} ;
421
421
debug ! ( "Inserting write guard at {:?}" , key) ;
422
- this. bccx . write_guard_map . insert ( key) ;
422
+ let mut write_guard_map = this. bccx
423
+ . write_guard_map
424
+ . borrow_mut ( ) ;
425
+ write_guard_map. get ( ) . insert ( key) ;
423
426
}
424
427
425
428
_ => { }
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ pub fn check_crate(
82
82
moved_variables_set : moved_variables_set,
83
83
capture_map : capture_map,
84
84
root_map : root_map ( ) ,
85
- write_guard_map : @mut HashSet :: new ( ) ,
85
+ write_guard_map : @RefCell :: new ( HashSet :: new ( ) ) ,
86
86
stats : @mut BorrowStats {
87
87
loaned_paths_same : 0 ,
88
88
loaned_paths_imm : 0 ,
@@ -217,7 +217,7 @@ pub struct root_map_key {
217
217
218
218
// A set containing IDs of expressions of gc'd type that need to have a write
219
219
// guard.
220
- pub type write_guard_map = @mut HashSet < root_map_key > ;
220
+ pub type write_guard_map = @RefCell < HashSet < root_map_key > > ;
221
221
222
222
pub type BckResult < T > = Result < T , BckError > ;
223
223
Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ pub fn lookup_variant_by_id(tcx: ty::ctxt,
123
123
root_map : @RefCell :: new ( HashMap :: new ( ) ) ,
124
124
method_map : @mut HashMap :: new ( ) ,
125
125
vtable_map : @RefCell :: new ( HashMap :: new ( ) ) ,
126
- write_guard_map : @mut HashSet :: new ( ) ,
126
+ write_guard_map : @RefCell :: new ( HashSet :: new ( ) ) ,
127
127
capture_map : @RefCell :: new ( HashMap :: new ( ) )
128
128
} ;
129
129
let e = match csearch:: maybe_get_item_ast ( tcx, enum_def,
@@ -173,7 +173,7 @@ pub fn lookup_const_by_id(tcx: ty::ctxt,
173
173
root_map : @RefCell :: new ( HashMap :: new ( ) ) ,
174
174
method_map : @mut HashMap :: new ( ) ,
175
175
vtable_map : @RefCell :: new ( HashMap :: new ( ) ) ,
176
- write_guard_map : @mut HashSet :: new ( ) ,
176
+ write_guard_map : @RefCell :: new ( HashSet :: new ( ) ) ,
177
177
capture_map : @RefCell :: new ( HashMap :: new ( ) )
178
178
} ;
179
179
let e = match csearch:: maybe_get_item_ast ( tcx, def_id,
Original file line number Diff line number Diff line change @@ -56,7 +56,8 @@ pub fn root_and_write_guard(datum: &Datum,
56
56
// Perform the write guard, if necessary.
57
57
//
58
58
// (Note: write-guarded values are always boxes)
59
- if ccx. maps . write_guard_map . contains ( & key) {
59
+ let write_guard_map = ccx. maps . write_guard_map . borrow ( ) ;
60
+ if write_guard_map. get ( ) . contains ( & key) {
60
61
perform_write_guard ( datum, bcx, span)
61
62
} else {
62
63
bcx
You can’t perform that action at this time.
0 commit comments