Skip to content

Commit

Permalink
update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed May 29, 2019
1 parent 1a7ce02 commit 5a8f6db
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/librustc_mir/interpret/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,13 +529,15 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M>
let op = match val.val {
ConstValue::ByRef(ptr, _alloc) => {
// We rely on mutability being set correctly in that allocation to prevent writes
// where none should happen -- and for `static mut`, we copy on demand anyway.
// where none should happen.
let ptr = self.tag_static_base_pointer(ptr);
Operand::Indirect(MemPlace::from_ptr(ptr, layout.align.abi))
},
ConstValue::Scalar(x) =>
Operand::Immediate(Immediate::Scalar(tag_scalar(x).into())),
ConstValue::Slice { data, start, end } => {
// We rely on mutability being set correctly in `data` to prevent writes
// where none should happen.
let ptr = Pointer::new(
self.tcx.alloc_map.lock().allocate(data),
Size::from_bytes(start as u64), // offset: `start`
Expand Down

0 comments on commit 5a8f6db

Please sign in to comment.