diff options
| author | Ralf Jung <post@ralfj.de> | 2025-07-05 07:36:55 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-05 07:36:55 +0000 |
| commit | 6e3e05befcd71ca01f73cc5c3ed6a62f768f0497 (patch) | |
| tree | 930e08c5f944973fe520ff75298b858ca17fdf74 /compiler/rustc_data_structures/src/vec_cache.rs | |
| parent | 23b3be5ada3ca3ba98b99e1145f4e771b71d7fad (diff) | |
| parent | 72043e3181a4050f02cdb1d6e2574c54c1b47013 (diff) | |
| download | rust-6e3e05befcd71ca01f73cc5c3ed6a62f768f0497.tar.gz rust-6e3e05befcd71ca01f73cc5c3ed6a62f768f0497.zip | |
Merge pull request #4445 from RalfJung/rustup
Rustup
Diffstat (limited to 'compiler/rustc_data_structures/src/vec_cache.rs')
| -rw-r--r-- | compiler/rustc_data_structures/src/vec_cache.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_data_structures/src/vec_cache.rs b/compiler/rustc_data_structures/src/vec_cache.rs index 0ffa6b3205f..599970663db 100644 --- a/compiler/rustc_data_structures/src/vec_cache.rs +++ b/compiler/rustc_data_structures/src/vec_cache.rs @@ -76,8 +76,8 @@ impl SlotIndex { index_in_bucket: idx as usize, }; } - // SAFETY: We already ruled out idx 0, so `checked_ilog2` can't return `None`. - 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; let entries = 1 << bucket; SlotIndex { bucket_idx: bucket - FIRST_BUCKET_SHIFT + 1, |
