@@ -248,7 +248,7 @@ impl FunctionDebugContext {
248
248
}
249
249
250
250
struct FunctionDebugContextData {
251
- scope_map : HashMap < ast:: NodeId , DIScope > ,
251
+ scope_map : RefCell < HashMap < ast:: NodeId , DIScope > > ,
252
252
fn_metadata : DISubprogram ,
253
253
argument_counter : uint ,
254
254
source_locations_enabled : bool ,
@@ -762,14 +762,21 @@ pub fn create_function_debug_context(cx: &CrateContext,
762
762
763
763
// Initialize fn debug context (including scope map and namespace map)
764
764
let mut fn_debug_context = ~FunctionDebugContextData {
765
- scope_map : HashMap :: new ( ) ,
765
+ scope_map : RefCell :: new ( HashMap :: new ( ) ) ,
766
766
fn_metadata : fn_metadata,
767
767
argument_counter : 1 ,
768
768
source_locations_enabled : false ,
769
769
} ;
770
770
771
771
let arg_pats = fn_decl. inputs . map ( |arg_ref| arg_ref. pat ) ;
772
- populate_scope_map ( cx, arg_pats, top_level_block, fn_metadata, & mut fn_debug_context. scope_map ) ;
772
+ {
773
+ let mut scope_map = fn_debug_context. scope_map . borrow_mut ( ) ;
774
+ populate_scope_map ( cx,
775
+ arg_pats,
776
+ top_level_block,
777
+ fn_metadata,
778
+ scope_map. get ( ) ) ;
779
+ }
773
780
774
781
// Clear the debug location so we don't assign them in the function prelude
775
782
set_debug_location ( cx, UnknownLocation ) ;
@@ -1089,8 +1096,9 @@ fn scope_metadata(fcx: &FunctionContext,
1089
1096
span : Span )
1090
1097
-> DIScope {
1091
1098
let scope_map = & fcx. debug_context . get_ref ( fcx. ccx , span) . scope_map ;
1099
+ let scope_map = scope_map. borrow ( ) ;
1092
1100
1093
- match scope_map. find_copy ( & node_id) {
1101
+ match scope_map. get ( ) . find_copy ( & node_id) {
1094
1102
Some ( scope_metadata) => scope_metadata,
1095
1103
None => {
1096
1104
let node = fcx. ccx . tcx . items . get_copy ( & node_id) ;
0 commit comments