@@ -177,7 +177,7 @@ pub struct CrateDebugContext {
177
177
priv builder : DIBuilderRef ,
178
178
priv current_debug_location : DebugLocation ,
179
179
priv created_files : RefCell < HashMap < ~str , DIFile > > ,
180
- priv created_types : HashMap < uint , DIType > ,
180
+ priv created_types : RefCell < HashMap < uint , DIType > > ,
181
181
priv namespace_map : HashMap < ~[ ast:: Ident ] , @NamespaceTreeNode > ,
182
182
// This collection is used to assert that composite types (structs, enums, ...) have their
183
183
// members only set once:
@@ -196,7 +196,7 @@ impl CrateDebugContext {
196
196
builder : builder,
197
197
current_debug_location : UnknownLocation ,
198
198
created_files : RefCell :: new ( HashMap :: new ( ) ) ,
199
- created_types : HashMap :: new ( ) ,
199
+ created_types : RefCell :: new ( HashMap :: new ( ) ) ,
200
200
namespace_map : HashMap :: new ( ) ,
201
201
composite_types_completed : HashSet :: new ( ) ,
202
202
} ;
@@ -1238,7 +1238,11 @@ impl RecursiveTypeDescription {
1238
1238
member_description_factory
1239
1239
} => {
1240
1240
// Insert the stub into the cache in order to allow recursive references ...
1241
- debug_context ( cx) . created_types . insert ( cache_id, metadata_stub) ;
1241
+ {
1242
+ let mut created_types = debug_context ( cx) . created_types
1243
+ . borrow_mut ( ) ;
1244
+ created_types. get ( ) . insert ( cache_id, metadata_stub) ;
1245
+ }
1242
1246
1243
1247
// ... then create the member descriptions ...
1244
1248
let member_descriptions = member_description_factory.
@@ -2042,9 +2046,13 @@ fn type_metadata(cx: &mut CrateContext,
2042
2046
usage_site_span : Span )
2043
2047
-> DIType {
2044
2048
let cache_id = cache_id_for_type ( t) ;
2045
- match debug_context ( cx) . created_types . find ( & cache_id) {
2046
- Some ( type_metadata) => return * type_metadata,
2047
- None => ( )
2049
+
2050
+ {
2051
+ let created_types = debug_context ( cx) . created_types . borrow ( ) ;
2052
+ match created_types. get ( ) . find ( & cache_id) {
2053
+ Some ( type_metadata) => return * type_metadata,
2054
+ None => ( )
2055
+ }
2048
2056
}
2049
2057
2050
2058
fn create_pointer_to_box_metadata ( cx : & mut CrateContext ,
@@ -2158,7 +2166,8 @@ fn type_metadata(cx: &mut CrateContext,
2158
2166
_ => cx. sess . bug ( format ! ( "debuginfo: unexpected type in type_metadata: {:?}" , sty) )
2159
2167
} ;
2160
2168
2161
- debug_context ( cx) . created_types . insert ( cache_id, type_metadata) ;
2169
+ let mut created_types = debug_context ( cx) . created_types . borrow_mut ( ) ;
2170
+ created_types. get ( ) . insert ( cache_id, type_metadata) ;
2162
2171
return type_metadata;
2163
2172
}
2164
2173
0 commit comments