Skip to content

Commit 558099b

Browse files
committed
librustc: De-@mut the FunctionDebugContext
1 parent 13e1bf1 commit 558099b

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

src/librustc/middle/trans/debuginfo.rs

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -222,21 +222,6 @@ impl FunctionDebugContext {
222222
}
223223
}
224224

225-
fn get_mut_ref<'a>(&'a mut self,
226-
cx: &CrateContext,
227-
span: Span)
228-
-> &'a mut FunctionDebugContextData {
229-
match *self {
230-
FunctionDebugContext(~ref mut data) => data,
231-
DebugInfoDisabled => {
232-
cx.sess.span_bug(span, FunctionDebugContext::debuginfo_disabled_message());
233-
}
234-
FunctionWithoutDebugInfo => {
235-
cx.sess.span_bug(span, FunctionDebugContext::should_be_ignored_message());
236-
}
237-
}
238-
}
239-
240225
fn debuginfo_disabled_message() -> &'static str {
241226
"debuginfo: Error trying to access FunctionDebugContext although debug info is disabled!"
242227
}
@@ -459,7 +444,7 @@ pub fn create_self_argument_metadata(bcx: @Block,
459444
let scope_metadata = bcx.fcx.debug_context.get_ref(bcx.ccx(), span).fn_metadata;
460445

461446
let argument_index = {
462-
let counter = &mut bcx.fcx.debug_context.get_mut_ref(bcx.ccx(), span).argument_counter;
447+
let counter = &bcx.fcx.debug_context.get_ref(bcx.ccx(), span).argument_counter;
463448
let argument_index = counter.get();
464449
counter.set(argument_index + 1);
465450
argument_index
@@ -538,7 +523,7 @@ pub fn create_argument_metadata(bcx: @Block,
538523
let argument_ident = ast_util::path_to_ident(path_ref);
539524

540525
let argument_index = {
541-
let counter = &fcx.debug_context.get_mut_ref(cx, span).argument_counter;
526+
let counter = &fcx.debug_context.get_ref(cx, span).argument_counter;
542527
let argument_index = counter.get();
543528
counter.set(argument_index + 1);
544529
argument_index
@@ -596,9 +581,9 @@ pub fn clear_source_location(fcx: &FunctionContext) {
596581
/// when beginning to translate a new function. This functions switches source location emitting on
597582
/// and must therefore be called before the first real statement/expression of the function is
598583
/// translated.
599-
pub fn start_emitting_source_locations(fcx: &mut FunctionContext) {
584+
pub fn start_emitting_source_locations(fcx: &FunctionContext) {
600585
match fcx.debug_context {
601-
FunctionDebugContext(~ref mut data) => {
586+
FunctionDebugContext(~ref data) => {
602587
data.source_locations_enabled.set(true)
603588
},
604589
_ => { /* safe to ignore */ }

0 commit comments

Comments
 (0)