Skip to content

Commit 85d6b7b

Browse files
committed
Address naming and comments from reviews
1 parent df58fcf commit 85d6b7b

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/librustc/mir/interpret/allocation.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,15 @@ impl<Tag, Extra> Allocation<Tag, Extra> {
136136
self.size.bytes() as usize
137137
}
138138

139-
/// Look at a slice which may describe undefined bytes or describe a relocation. This differs
139+
/// Looks at a slice which may describe undefined bytes or describe a relocation. This differs
140140
/// from `get_bytes_with_undef_and_ptr` in that it does no relocation checks (even on the
141141
/// edges) at all. It further ignores `AllocationExtra` callbacks.
142142
/// This must not be used for reads affecting the interpreter execution.
143143
pub fn inspect_with_undef_and_ptr_outside_interpreter(&self, range: Range<usize>) -> &[u8] {
144144
&self.bytes[range]
145145
}
146146

147-
/// View the undef mask.
147+
/// Returns the undef mask.
148148
pub fn undef_mask(&self) -> &UndefMask {
149149
&self.undef_mask
150150
}
@@ -583,7 +583,7 @@ pub struct AllocationDefinedness {
583583
/// Transferring the definedness mask to other allocations.
584584
impl<Tag, Extra> Allocation<Tag, Extra> {
585585
/// Creates a run-length encoding of the undef_mask.
586-
pub fn compress_defined_range(
586+
pub fn compress_undef_range(
587587
&self,
588588
src: Pointer<Tag>,
589589
size: Size,
@@ -622,7 +622,7 @@ impl<Tag, Extra> Allocation<Tag, Extra> {
622622
}
623623

624624
/// Apply multiple instances of the run-length encoding to the undef_mask.
625-
pub fn mark_compressed_range(
625+
pub fn mark_compressed_undef_range(
626626
&mut self,
627627
defined: &AllocationDefinedness,
628628
dest: Pointer<Tag>,

src/librustc_codegen_llvm/consts.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ pub fn const_alloc_to_llvm(cx: &CodegenCx<'ll, '_>, alloc: &Allocation) -> &'ll
3535
assert_eq!(offset as usize as u64, offset);
3636
let offset = offset as usize;
3737
if offset > next_offset {
38-
// This `inspect` is okay since we have check that it is not within a relocation, it is
39-
// within the bounds of the allocation, and it doesn't affect interpreter execution (we
40-
// inspect the result after interpreter execution). Any undef byte is replaced with
38+
// This `inspect` is okay since we have checked that it is not within a relocation, it
39+
// is within the bounds of the allocation, and it doesn't affect interpreter execution
40+
// (we inspect the result after interpreter execution). Any undef byte is replaced with
4141
// some arbitrary byte value.
4242
//
4343
// FIXME: relay undef bytes to codegen as undef const bytes

src/librustc_mir/interpret/memory.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -900,11 +900,11 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
900900
assert_eq!(size.bytes() as usize as u64, size.bytes());
901901

902902
let src_alloc = self.get(src.alloc_id)?;
903-
let compressed = src_alloc.compress_defined_range(src, size);
903+
let compressed = src_alloc.compress_undef_range(src, size);
904904

905905
// now fill in all the data
906906
let dest_allocation = self.get_mut(dest.alloc_id)?;
907-
dest_allocation.mark_compressed_range(&compressed, dest, size, repeat);
907+
dest_allocation.mark_compressed_undef_range(&compressed, dest, size, repeat);
908908

909909
Ok(())
910910
}

0 commit comments

Comments
 (0)