We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e2e72cd + 15286f2 commit 567c51dCopy full SHA for 567c51d
compiler/rustc_data_structures/src/vec_cache.rs
@@ -76,8 +76,8 @@ impl SlotIndex {
76
index_in_bucket: idx as usize,
77
};
78
}
79
- // SAFETY: We already ruled out idx 0, so `checked_ilog2` can't return `None`.
80
- let bucket = unsafe { idx.checked_ilog2().unwrap_unchecked() as usize };
+ // We already ruled out idx 0, so this `ilog2` never panics (and the check optimizes away)
+ let bucket = idx.ilog2() as usize;
81
let entries = 1 << bucket;
82
SlotIndex {
83
bucket_idx: bucket - FIRST_BUCKET_SHIFT + 1,
0 commit comments