From 127ad53a7c3becf6a9be621c9b85c0a60815b12c Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Sat, 17 Jan 2026 20:40:33 -0700 Subject: [PATCH] cmov: mark `isize`/`usize` impls of `Cmov(Eq)` as always available Via rustc itself: expected values for `target_pointer_width` are: `16`, `32`, and `64` This adds a `doc(cfg(true))` attribute to the impls for `isize` and `usize` to hide the `cfg` gating so it doesn't show up in the rustdoc, but it's still retained to the crate compiles if rustc suddenly decides to add support for e.g. `8` or `128`-bit wide pointers. --- cmov/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmov/src/lib.rs b/cmov/src/lib.rs index 3c02bd7d..d15cb5a9 100644 --- a/cmov/src/lib.rs +++ b/cmov/src/lib.rs @@ -201,14 +201,17 @@ macro_rules! impl_cmov_traits_for_size_type { target_pointer_width = "32", target_pointer_width = "64" ))] + #[cfg_attr(docsrs, doc(cfg(true)))] impl Cmov for $size { #[cfg(target_pointer_width = "16")] + #[allow(clippy::cast_possible_truncation)] #[inline] fn cmovnz(&mut self, other: &Self, condition: Condition) { (*self as $int16).cmovnz(&(*other as $int16), condition); } #[cfg(target_pointer_width = "32")] + #[allow(clippy::cast_possible_truncation)] #[inline] fn cmovnz(&mut self, other: &Self, condition: Condition) { (*self as $int32).cmovnz(&(*other as $int32), condition); @@ -227,14 +230,17 @@ macro_rules! impl_cmov_traits_for_size_type { target_pointer_width = "32", target_pointer_width = "64" ))] + #[cfg_attr(docsrs, doc(cfg(true)))] impl CmovEq for $size { #[cfg(target_pointer_width = "16")] + #[allow(clippy::cast_possible_truncation)] #[inline] fn cmovne(&self, rhs: &Self, input: Condition, output: &mut Condition) { (*self as $int16).cmovne(&(*rhs as $int16), input, output); } #[cfg(target_pointer_width = "32")] + #[allow(clippy::cast_possible_truncation)] #[inline] fn cmovne(&self, rhs: &Self, input: Condition, output: &mut Condition) { (*self as $int32).cmovne(&(*rhs as $int32), input, output);