Skip to content

Commit f172046

Browse files
make new_unchecked unsafe
1 parent 3b2f766 commit f172046

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

pulp/src/core_arch/aarch64/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ macro_rules! __impl {
1111

1212
impl $name {
1313
#[inline(always)]
14-
pub fn new_unchecked() -> Self {
14+
pub unsafe fn new_unchecked() -> Self {
1515
Self { __private: () }
1616
}
1717

pulp/src/core_arch/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,19 +234,19 @@ macro_rules! simd_type {
234234
/// - the required CPU features must be available.
235235
#[inline]
236236
pub unsafe fn new_unchecked() -> Self {
237-
Self{
237+
unsafe{Self{
238238
$($ident: <$crate::core_arch::__impl_type!($feature)>::new_unchecked(),)*
239-
}
239+
}}
240240
}
241241

242242
/// Returns a SIMD token type if the required CPU features for this type are
243243
/// available, otherwise returns `None`.
244244
#[inline]
245245
pub fn try_new() -> Option<Self> {
246246
if Self::is_available() {
247-
Some(Self{
247+
Some(unsafe{Self{
248248
$($ident: <$crate::core_arch::__impl_type!($feature)>::new_unchecked(),)*
249-
})
249+
}})
250250
} else {
251251
None
252252
}
@@ -287,6 +287,7 @@ macro_rules! simd_type {
287287
pub fn vectorize<F: $crate::NullaryFnOnce>(self, f: F) -> F::Output {
288288
$(#[target_feature(enable = $feature)])*
289289
#[inline]
290+
#[allow(clippy::too_many_arguments)]
290291
unsafe fn imp_fastcall<F: $crate::NullaryFnOnce>(
291292
f0: ::core::mem::MaybeUninit<::core::primitive::usize>,
292293
f1: ::core::mem::MaybeUninit<::core::primitive::usize>,

pulp/src/core_arch/x86/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ macro_rules! __impl {
55
($name: ident, $feature: tt) => {
66
impl $name {
77
#[inline(always)]
8-
pub fn new_unchecked() -> Self {
8+
pub unsafe fn new_unchecked() -> Self {
99
Self { __private: () }
1010
}
1111

0 commit comments

Comments
 (0)