Skip to content

Commit c2a6c1e

Browse files
committed
some things don't need to be mutable
1 parent cb1b881 commit c2a6c1e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/stacked_borrows/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ impl<'tcx> Stack {
488488
&mut self,
489489
derived_from: ProvenanceExtra,
490490
new: Item,
491-
global: &mut GlobalStateInner,
491+
global: &GlobalStateInner,
492492
dcx: &mut DiagnosticCx<'_, '_, '_, '_, 'tcx>,
493493
exposed_tags: &FxHashSet<SbTag>,
494494
) -> InterpResult<'tcx> {
@@ -658,9 +658,9 @@ impl Stacks {
658658
range.size.bytes()
659659
);
660660
let dcx = DiagnosticCxBuilder::read(&mut current_span, threads, tag, range);
661-
let mut state = state.borrow_mut();
661+
let state = state.borrow();
662662
self.for_each(range, dcx, |stack, dcx, exposed_tags| {
663-
stack.access(AccessKind::Read, tag, &mut state, dcx, exposed_tags)
663+
stack.access(AccessKind::Read, tag, &state, dcx, exposed_tags)
664664
})
665665
}
666666

@@ -681,9 +681,9 @@ impl Stacks {
681681
range.size.bytes()
682682
);
683683
let dcx = DiagnosticCxBuilder::write(&mut current_span, threads, tag, range);
684-
let mut state = state.borrow_mut();
684+
let state = state.borrow();
685685
self.for_each(range, dcx, |stack, dcx, exposed_tags| {
686-
stack.access(AccessKind::Write, tag, &mut state, dcx, exposed_tags)
686+
stack.access(AccessKind::Write, tag, &state, dcx, exposed_tags)
687687
})
688688
}
689689

@@ -904,7 +904,7 @@ trait EvalContextPrivExt<'mir: 'ecx, 'tcx: 'mir, 'ecx>: crate::MiriInterpCxExt<'
904904
false
905905
};
906906
let item = Item::new(new_tag, perm, protected);
907-
let mut global = this.machine.stacked_borrows.as_ref().unwrap().borrow_mut();
907+
let global = this.machine.stacked_borrows.as_ref().unwrap().borrow();
908908
let dcx = DiagnosticCxBuilder::retag(
909909
&mut current_span, // FIXME avoid this `clone`
910910
&this.machine.threads,
@@ -914,7 +914,7 @@ trait EvalContextPrivExt<'mir: 'ecx, 'tcx: 'mir, 'ecx>: crate::MiriInterpCxExt<'
914914
alloc_range(base_offset, size),
915915
);
916916
stacked_borrows.for_each(range, dcx, |stack, dcx, exposed_tags| {
917-
stack.grant(orig_tag, item, &mut global, dcx, exposed_tags)
917+
stack.grant(orig_tag, item, &global, dcx, exposed_tags)
918918
})
919919
})?;
920920
return Ok(Some(alloc_id));
@@ -932,7 +932,7 @@ trait EvalContextPrivExt<'mir: 'ecx, 'tcx: 'mir, 'ecx>: crate::MiriInterpCxExt<'
932932
.borrow_mut();
933933
let item = Item::new(new_tag, perm, protect.is_some());
934934
let range = alloc_range(base_offset, size);
935-
let mut global = machine.stacked_borrows.as_ref().unwrap().borrow_mut();
935+
let global = machine.stacked_borrows.as_ref().unwrap().borrow();
936936
// FIXME: can't share this with the current_span inside log_creation
937937
let current_span = &mut machine.current_span();
938938
let dcx = DiagnosticCxBuilder::retag(
@@ -944,7 +944,7 @@ trait EvalContextPrivExt<'mir: 'ecx, 'tcx: 'mir, 'ecx>: crate::MiriInterpCxExt<'
944944
alloc_range(base_offset, size),
945945
);
946946
stacked_borrows.for_each(range, dcx, |stack, dcx, exposed_tags| {
947-
stack.grant(orig_tag, item, &mut global, dcx, exposed_tags)
947+
stack.grant(orig_tag, item, &global, dcx, exposed_tags)
948948
})?;
949949

950950
Ok(Some(alloc_id))

0 commit comments

Comments
 (0)