Skip to content

Commit 0984680

Browse files
committed
Deny unreachable_pub lint
As is done in `core` since rust-lang/rust#134286 cc rust-lang/rust#138054
1 parent 74cddca commit 0984680

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

crates/core_simd/src/lib.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@
3535
feature(stdarch_x86_avx512)
3636
)]
3737
#![warn(missing_docs, clippy::missing_inline_in_public_items)] // basically all items, really
38-
#![deny(unsafe_op_in_unsafe_fn, clippy::undocumented_unsafe_blocks)]
38+
#![deny(
39+
unsafe_op_in_unsafe_fn,
40+
unreachable_pub,
41+
clippy::undocumented_unsafe_blocks
42+
)]
3943
#![doc(test(attr(deny(warnings))))]
4044
#![allow(internal_features)]
4145
#![unstable(feature = "portable_simd", issue = "86656")]

crates/core_simd/src/masks/bitmask.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use core::marker::PhantomData;
55

66
/// A mask where each lane is represented by a single bit.
77
#[repr(transparent)]
8-
pub struct Mask<T, const N: usize>(
8+
pub(crate) struct Mask<T, const N: usize>(
99
<LaneCount<N> as SupportedLaneCount>::BitMask,
1010
PhantomData<T>,
1111
)
@@ -78,7 +78,7 @@ where
7878
{
7979
#[inline]
8080
#[must_use = "method returns a new mask and does not mutate the original value"]
81-
pub fn splat(value: bool) -> Self {
81+
pub(crate) fn splat(value: bool) -> Self {
8282
let mut mask = <LaneCount<N> as SupportedLaneCount>::BitMask::default();
8383
if value {
8484
mask.as_mut().fill(u8::MAX)
@@ -93,20 +93,20 @@ where
9393

9494
#[inline]
9595
#[must_use = "method returns a new bool and does not mutate the original value"]
96-
pub unsafe fn test_unchecked(&self, lane: usize) -> bool {
96+
pub(crate) unsafe fn test_unchecked(&self, lane: usize) -> bool {
9797
(self.0.as_ref()[lane / 8] >> (lane % 8)) & 0x1 > 0
9898
}
9999

100100
#[inline]
101-
pub unsafe fn set_unchecked(&mut self, lane: usize, value: bool) {
101+
pub(crate) unsafe fn set_unchecked(&mut self, lane: usize, value: bool) {
102102
unsafe {
103103
self.0.as_mut()[lane / 8] ^= ((value ^ self.test_unchecked(lane)) as u8) << (lane % 8)
104104
}
105105
}
106106

107107
#[inline]
108108
#[must_use = "method returns a new vector and does not mutate the original value"]
109-
pub fn to_int(self) -> Simd<T, N> {
109+
pub(crate) fn to_int(self) -> Simd<T, N> {
110110
unsafe {
111111
core::intrinsics::simd::simd_select_bitmask(
112112
self.0,
@@ -118,19 +118,19 @@ where
118118

119119
#[inline]
120120
#[must_use = "method returns a new mask and does not mutate the original value"]
121-
pub unsafe fn from_int_unchecked(value: Simd<T, N>) -> Self {
121+
pub(crate) unsafe fn from_int_unchecked(value: Simd<T, N>) -> Self {
122122
unsafe { Self(core::intrinsics::simd::simd_bitmask(value), PhantomData) }
123123
}
124124

125125
#[inline]
126-
pub fn to_bitmask_integer(self) -> u64 {
126+
pub(crate) fn to_bitmask_integer(self) -> u64 {
127127
let mut bitmask = [0u8; 8];
128128
bitmask[..self.0.as_ref().len()].copy_from_slice(self.0.as_ref());
129129
u64::from_ne_bytes(bitmask)
130130
}
131131

132132
#[inline]
133-
pub fn from_bitmask_integer(bitmask: u64) -> Self {
133+
pub(crate) fn from_bitmask_integer(bitmask: u64) -> Self {
134134
let mut bytes = <LaneCount<N> as SupportedLaneCount>::BitMask::default();
135135
let len = bytes.as_mut().len();
136136
bytes
@@ -141,7 +141,7 @@ where
141141

142142
#[inline]
143143
#[must_use = "method returns a new mask and does not mutate the original value"]
144-
pub fn convert<U>(self) -> Mask<U, N>
144+
pub(crate) fn convert<U>(self) -> Mask<U, N>
145145
where
146146
U: MaskElement,
147147
{
@@ -151,13 +151,13 @@ where
151151

152152
#[inline]
153153
#[must_use = "method returns a new bool and does not mutate the original value"]
154-
pub fn any(self) -> bool {
154+
pub(crate) fn any(self) -> bool {
155155
self != Self::splat(false)
156156
}
157157

158158
#[inline]
159159
#[must_use = "method returns a new bool and does not mutate the original value"]
160-
pub fn all(self) -> bool {
160+
pub(crate) fn all(self) -> bool {
161161
self == Self::splat(true)
162162
}
163163
}

0 commit comments

Comments
 (0)