about summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Desjardins <erikdesjardins@users.noreply.github.com>2021-08-25 17:40:57 -0400
committerErik Desjardins <erikdesjardins@users.noreply.github.com>2021-08-25 17:49:29 -0400
commitc07a2eb5b417b72583e6331e8eeca1d505f9bac8 (patch)
treea876529460c95b91467c485c37cea3e059207e3a
parent75fecd5d40654d8e81539d65495aa98d16029a79 (diff)
downloadrust-c07a2eb5b417b72583e6331e8eeca1d505f9bac8.tar.gz
rust-c07a2eb5b417b72583e6331e8eeca1d505f9bac8.zip
yet more comment improvements
-rw-r--r--compiler/rustc_middle/src/mir/interpret/allocation.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/rustc_middle/src/mir/interpret/allocation.rs b/compiler/rustc_middle/src/mir/interpret/allocation.rs
index 01f80c8d903..abc8799d102 100644
--- a/compiler/rustc_middle/src/mir/interpret/allocation.rs
+++ b/compiler/rustc_middle/src/mir/interpret/allocation.rs
@@ -766,7 +766,7 @@ impl InitMask {
             // In both cases, the block index of `end` is 1.
             // But we do want to search block 1 in (a), and we don't in (b).
             //
-            // If we subtract 1 from both end positions to make them inclusive:
+            // We subtract 1 from both end positions to make them inclusive:
             //
             //   (a) 00000000|00000000    (b) 00000000|
             //       ^~~~~~~~~~^              ^~~~~~~^
@@ -937,7 +937,12 @@ impl InitMask {
     pub fn range_as_init_chunks(&self, start: Size, end: Size) -> InitChunkIter<'_> {
         assert!(end <= self.len);
 
-        let is_init = if start < end { self.get(start) } else { false };
+        let is_init = if start < end {
+            self.get(start)
+        } else {
+            // `start..end` is empty: there are no chunks, so use some arbitrary value
+            false
+        };
 
         InitChunkIter { init_mask: self, is_init, start, end }
     }