Skip to content

Commit 14621c5

Browse files
authored
cmov: mark isize/usize impls of Cmov(Eq) as always available (#1387)
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.
1 parent 02c8bb9 commit 14621c5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cmov/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,17 @@ macro_rules! impl_cmov_traits_for_size_type {
201201
target_pointer_width = "32",
202202
target_pointer_width = "64"
203203
))]
204+
#[cfg_attr(docsrs, doc(cfg(true)))]
204205
impl Cmov for $size {
205206
#[cfg(target_pointer_width = "16")]
207+
#[allow(clippy::cast_possible_truncation)]
206208
#[inline]
207209
fn cmovnz(&mut self, other: &Self, condition: Condition) {
208210
(*self as $int16).cmovnz(&(*other as $int16), condition);
209211
}
210212

211213
#[cfg(target_pointer_width = "32")]
214+
#[allow(clippy::cast_possible_truncation)]
212215
#[inline]
213216
fn cmovnz(&mut self, other: &Self, condition: Condition) {
214217
(*self as $int32).cmovnz(&(*other as $int32), condition);
@@ -227,14 +230,17 @@ macro_rules! impl_cmov_traits_for_size_type {
227230
target_pointer_width = "32",
228231
target_pointer_width = "64"
229232
))]
233+
#[cfg_attr(docsrs, doc(cfg(true)))]
230234
impl CmovEq for $size {
231235
#[cfg(target_pointer_width = "16")]
236+
#[allow(clippy::cast_possible_truncation)]
232237
#[inline]
233238
fn cmovne(&self, rhs: &Self, input: Condition, output: &mut Condition) {
234239
(*self as $int16).cmovne(&(*rhs as $int16), input, output);
235240
}
236241

237242
#[cfg(target_pointer_width = "32")]
243+
#[allow(clippy::cast_possible_truncation)]
238244
#[inline]
239245
fn cmovne(&self, rhs: &Self, input: Condition, output: &mut Condition) {
240246
(*self as $int32).cmovne(&(*rhs as $int32), input, output);

0 commit comments

Comments
 (0)