Skip to content

Commit a74138e

Browse files
committed
librustc: De-@mut FunctionDebugContextData::argument_counter
1 parent b80a111 commit a74138e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/librustc/middle/trans/debuginfo.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl FunctionDebugContext {
250250
struct FunctionDebugContextData {
251251
scope_map: RefCell<HashMap<ast::NodeId, DIScope>>,
252252
fn_metadata: DISubprogram,
253-
argument_counter: uint,
253+
argument_counter: Cell<uint>,
254254
source_locations_enabled: bool,
255255
}
256256

@@ -460,8 +460,8 @@ pub fn create_self_argument_metadata(bcx: @Block,
460460

461461
let argument_index = {
462462
let counter = &mut bcx.fcx.debug_context.get_mut_ref(bcx.ccx(), span).argument_counter;
463-
let argument_index = *counter;
464-
*counter += 1;
463+
let argument_index = counter.get();
464+
counter.set(argument_index + 1);
465465
argument_index
466466
};
467467

@@ -538,9 +538,9 @@ pub fn create_argument_metadata(bcx: @Block,
538538
let argument_ident = ast_util::path_to_ident(path_ref);
539539

540540
let argument_index = {
541-
let counter = &mut fcx.debug_context.get_mut_ref(cx, span).argument_counter;
542-
let argument_index = *counter;
543-
*counter += 1;
541+
let counter = &fcx.debug_context.get_mut_ref(cx, span).argument_counter;
542+
let argument_index = counter.get();
543+
counter.set(argument_index + 1);
544544
argument_index
545545
};
546546

@@ -761,10 +761,10 @@ pub fn create_function_debug_context(cx: &CrateContext,
761761
});
762762

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

0 commit comments

Comments
 (0)