@@ -53,7 +53,7 @@ The region maps encode information about region relationships.
53
53
pub struct RegionMaps {
54
54
priv scope_map : RefCell < HashMap < ast:: NodeId , ast:: NodeId > > ,
55
55
priv free_region_map : RefCell < HashMap < FreeRegion , ~[ FreeRegion ] > > ,
56
- priv cleanup_scopes : HashSet < ast:: NodeId >
56
+ priv cleanup_scopes : RefCell < HashSet < ast:: NodeId > > ,
57
57
}
58
58
59
59
#[ deriving( Clone ) ]
@@ -105,7 +105,8 @@ impl RegionMaps {
105
105
//! not know which operators are overloaded until that point,
106
106
//! and only overloaded operators result in cleanup scopes.
107
107
108
- self . cleanup_scopes . insert ( scope_id) ;
108
+ let mut cleanup_scopes = self . cleanup_scopes . borrow_mut ( ) ;
109
+ cleanup_scopes. get ( ) . insert ( scope_id) ;
109
110
}
110
111
111
112
pub fn opt_encl_scope ( & self , id : ast:: NodeId ) -> Option < ast:: NodeId > {
@@ -126,14 +127,16 @@ impl RegionMaps {
126
127
}
127
128
128
129
pub fn is_cleanup_scope ( & self , scope_id : ast:: NodeId ) -> bool {
129
- self . cleanup_scopes . contains ( & scope_id)
130
+ let cleanup_scopes = self . cleanup_scopes . borrow ( ) ;
131
+ cleanup_scopes. get ( ) . contains ( & scope_id)
130
132
}
131
133
132
134
pub fn cleanup_scope ( & self , expr_id : ast:: NodeId ) -> ast:: NodeId {
133
135
//! Returns the scope when temps in expr will be cleaned up
134
136
135
137
let mut id = self . encl_scope ( expr_id) ;
136
- while !self . cleanup_scopes . contains ( & id) {
138
+ let cleanup_scopes = self . cleanup_scopes . borrow ( ) ;
139
+ while !cleanup_scopes. get ( ) . contains ( & id) {
137
140
id = self . encl_scope ( id) ;
138
141
}
139
142
return id;
@@ -507,7 +510,7 @@ pub fn resolve_crate(sess: Session,
507
510
let region_maps = @mut RegionMaps {
508
511
scope_map : RefCell :: new ( HashMap :: new ( ) ) ,
509
512
free_region_map : RefCell :: new ( HashMap :: new ( ) ) ,
510
- cleanup_scopes : HashSet :: new ( ) ,
513
+ cleanup_scopes : RefCell :: new ( HashSet :: new ( ) ) ,
511
514
} ;
512
515
let cx = Context { parent : None ,
513
516
var_parent : None } ;
0 commit comments