/rust/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.15.4/src/util.rs
Line | Count | Source (jump to first uncovered line) |
1 | | // FIXME: Branch prediction hint. This is currently only available on nightly |
2 | | // but it consistently improves performance by 10-15%. |
3 | | #[cfg(not(feature = "nightly"))] |
4 | | pub(crate) use core::convert::{identity as likely, identity as unlikely}; |
5 | | #[cfg(feature = "nightly")] |
6 | | pub(crate) use core::intrinsics::{likely, unlikely}; |
7 | | |
8 | | // FIXME: use strict provenance functions once they are stable. |
9 | | // Implement it with a transmute for now. |
10 | | #[inline(always)] |
11 | | #[allow(clippy::useless_transmute)] // clippy is wrong, cast and transmute are different here |
12 | 0 | pub(crate) fn invalid_mut<T>(addr: usize) -> *mut T { |
13 | 0 | unsafe { core::mem::transmute(addr) } |
14 | 0 | } |