Skip to content

Commit c07a2eb

Browse files
yet more comment improvements
1 parent 75fecd5 commit c07a2eb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Diff for: compiler/rustc_middle/src/mir/interpret/allocation.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ impl InitMask {
766766
// In both cases, the block index of `end` is 1.
767767
// But we do want to search block 1 in (a), and we don't in (b).
768768
//
769-
// If we subtract 1 from both end positions to make them inclusive:
769+
// We subtract 1 from both end positions to make them inclusive:
770770
//
771771
// (a) 00000000|00000000 (b) 00000000|
772772
// ^~~~~~~~~~^ ^~~~~~~^
@@ -937,7 +937,12 @@ impl InitMask {
937937
pub fn range_as_init_chunks(&self, start: Size, end: Size) -> InitChunkIter<'_> {
938938
assert!(end <= self.len);
939939

940-
let is_init = if start < end { self.get(start) } else { false };
940+
let is_init = if start < end {
941+
self.get(start)
942+
} else {
943+
// `start..end` is empty: there are no chunks, so use some arbitrary value
944+
false
945+
};
941946

942947
InitChunkIter { init_mask: self, is_init, start, end }
943948
}

0 commit comments

Comments
 (0)