about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src/vec_cache
diff options
context:
space:
mode:
authorTshepang Mbambo <hopsi@tuta.io>2025-06-09 07:19:50 +0200
committerGitHub <noreply@github.com>2025-06-09 07:19:50 +0200
commit4967fd24dec0b178e8766c0d5ce6146d2fd2c152 (patch)
tree84784da83b710a97f9944b753c9d7717e37b631b /compiler/rustc_data_structures/src/vec_cache
parent8290ab531ce162a920da5d3c625889697ff65375 (diff)
parent7565e75591c2ef184bc7a359b3a436a62d45358a (diff)
downloadrust-4967fd24dec0b178e8766c0d5ce6146d2fd2c152.tar.gz
rust-4967fd24dec0b178e8766c0d5ce6146d2fd2c152.zip
Merge pull request #2461 from rust-lang/rustc-pull
Rustc pull update
Diffstat (limited to 'compiler/rustc_data_structures/src/vec_cache')
-rw-r--r--compiler/rustc_data_structures/src/vec_cache/tests.rs19
1 files changed, 8 insertions, 11 deletions
diff --git a/compiler/rustc_data_structures/src/vec_cache/tests.rs b/compiler/rustc_data_structures/src/vec_cache/tests.rs
index 3b65c14162e..9b60913ec92 100644
--- a/compiler/rustc_data_structures/src/vec_cache/tests.rs
+++ b/compiler/rustc_data_structures/src/vec_cache/tests.rs
@@ -75,24 +75,21 @@ fn slot_index_exhaustive() {
     for idx in 0..=u32::MAX {
         buckets[SlotIndex::from_index(idx).bucket_idx] += 1;
     }
-    let mut prev = None::<SlotIndex>;
-    for idx in 0..=u32::MAX {
+    let slot_idx = SlotIndex::from_index(0);
+    assert_eq!(slot_idx.index_in_bucket, 0);
+    assert_eq!(slot_idx.bucket_idx, 0);
+    let mut prev = slot_idx;
+    for idx in 1..=u32::MAX {
         let slot_idx = SlotIndex::from_index(idx);
-        if let Some(p) = prev {
-            if p.bucket_idx == slot_idx.bucket_idx {
-                assert_eq!(p.index_in_bucket + 1, slot_idx.index_in_bucket);
-            } else {
-                assert_eq!(slot_idx.index_in_bucket, 0);
-            }
+        if prev.bucket_idx == slot_idx.bucket_idx {
+            assert_eq!(prev.index_in_bucket + 1, slot_idx.index_in_bucket);
         } else {
-            assert_eq!(idx, 0);
             assert_eq!(slot_idx.index_in_bucket, 0);
-            assert_eq!(slot_idx.bucket_idx, 0);
         }
 
         assert_eq!(buckets[slot_idx.bucket_idx], slot_idx.entries as u32);
         assert_eq!(ENTRIES_BY_BUCKET[slot_idx.bucket_idx], slot_idx.entries, "{}", idx);
 
-        prev = Some(slot_idx);
+        prev = slot_idx;
     }
 }