Skip to content

Commit b80a111

Browse files
committed
librustc: De-@mut FunctionDebugContextData::scope_map
1 parent 7437a56 commit b80a111

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/librustc/middle/trans/debuginfo.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ impl FunctionDebugContext {
248248
}
249249

250250
struct FunctionDebugContextData {
251-
scope_map: HashMap<ast::NodeId, DIScope>,
251+
scope_map: RefCell<HashMap<ast::NodeId, DIScope>>,
252252
fn_metadata: DISubprogram,
253253
argument_counter: uint,
254254
source_locations_enabled: bool,
@@ -762,14 +762,21 @@ pub fn create_function_debug_context(cx: &CrateContext,
762762

763763
// Initialize fn debug context (including scope map and namespace map)
764764
let mut fn_debug_context = ~FunctionDebugContextData {
765-
scope_map: HashMap::new(),
765+
scope_map: RefCell::new(HashMap::new()),
766766
fn_metadata: fn_metadata,
767767
argument_counter: 1,
768768
source_locations_enabled: false,
769769
};
770770

771771
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+
}
773780

774781
// Clear the debug location so we don't assign them in the function prelude
775782
set_debug_location(cx, UnknownLocation);
@@ -1089,8 +1096,9 @@ fn scope_metadata(fcx: &FunctionContext,
10891096
span: Span)
10901097
-> DIScope {
10911098
let scope_map = &fcx.debug_context.get_ref(fcx.ccx, span).scope_map;
1099+
let scope_map = scope_map.borrow();
10921100

1093-
match scope_map.find_copy(&node_id) {
1101+
match scope_map.get().find_copy(&node_id) {
10941102
Some(scope_metadata) => scope_metadata,
10951103
None => {
10961104
let node = fcx.ccx.tcx.items.get_copy(&node_id);

0 commit comments

Comments
 (0)