@@ -142,6 +142,7 @@ use middle::pat_util;
142
142
use util:: ppaux;
143
143
144
144
use std:: c_str:: ToCStr ;
145
+ use std:: cell:: RefCell ;
145
146
use std:: hashmap:: HashMap ;
146
147
use std:: hashmap:: HashSet ;
147
148
use std:: libc:: { c_uint, c_ulonglong, c_longlong} ;
@@ -175,7 +176,7 @@ pub struct CrateDebugContext {
175
176
priv llcontext : ContextRef ,
176
177
priv builder : DIBuilderRef ,
177
178
priv current_debug_location : DebugLocation ,
178
- priv created_files : HashMap < ~str , DIFile > ,
179
+ priv created_files : RefCell < HashMap < ~str , DIFile > > ,
179
180
priv created_types : HashMap < uint , DIType > ,
180
181
priv namespace_map : HashMap < ~[ ast:: Ident ] , @NamespaceTreeNode > ,
181
182
// This collection is used to assert that composite types (structs, enums, ...) have their
@@ -194,7 +195,7 @@ impl CrateDebugContext {
194
195
llcontext : llcontext,
195
196
builder : builder,
196
197
current_debug_location : UnknownLocation ,
197
- created_files : HashMap :: new ( ) ,
198
+ created_files : RefCell :: new ( HashMap :: new ( ) ) ,
198
199
created_types : HashMap :: new ( ) ,
199
200
namespace_map : HashMap :: new ( ) ,
200
201
composite_types_completed : HashSet :: new ( ) ,
@@ -1031,9 +1032,12 @@ fn declare_local(bcx: @Block,
1031
1032
}
1032
1033
1033
1034
fn file_metadata ( cx : & mut CrateContext , full_path : & str ) -> DIFile {
1034
- match debug_context ( cx) . created_files . find_equiv ( & full_path) {
1035
- Some ( file_metadata) => return * file_metadata,
1036
- None => ( )
1035
+ {
1036
+ let created_files = debug_context ( cx) . created_files . borrow ( ) ;
1037
+ match created_files. get ( ) . find_equiv ( & full_path) {
1038
+ Some ( file_metadata) => return * file_metadata,
1039
+ None => ( )
1040
+ }
1037
1041
}
1038
1042
1039
1043
debug ! ( "file_metadata: {}" , full_path) ;
@@ -1056,7 +1060,8 @@ fn file_metadata(cx: &mut CrateContext, full_path: &str) -> DIFile {
1056
1060
} )
1057
1061
} ) ;
1058
1062
1059
- debug_context ( cx) . created_files . insert ( full_path. to_owned ( ) , file_metadata) ;
1063
+ let mut created_files = debug_context ( cx) . created_files . borrow_mut ( ) ;
1064
+ created_files. get ( ) . insert ( full_path. to_owned ( ) , file_metadata) ;
1060
1065
return file_metadata;
1061
1066
}
1062
1067
0 commit comments