add missing safety comments

This commit is contained in:
Ralf Jung 2024-10-05 21:35:04 +02:00
parent f512051c0e
commit b0224fb794
4 changed files with 6 additions and 0 deletions

View File

@ -1378,6 +1378,7 @@ impl f128 {
#[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn copysign(self, sign: f128) -> f128 {
// SAFETY: this is actually a safe intrinsic
unsafe { intrinsics::copysignf128(self, sign) }
}
}

View File

@ -1352,6 +1352,7 @@ impl f16 {
#[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn copysign(self, sign: f16) -> f16 {
// SAFETY: this is actually a safe intrinsic
unsafe { intrinsics::copysignf16(self, sign) }
}
}

View File

@ -1449,6 +1449,7 @@ impl f32 {
#[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
#[inline]
pub const fn abs(self) -> f32 {
// SAFETY: this is actually a safe intrinsic
unsafe { intrinsics::fabsf32(self) }
}
@ -1509,6 +1510,7 @@ impl f32 {
#[stable(feature = "copysign", since = "1.35.0")]
#[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
pub const fn copysign(self, sign: f32) -> f32 {
// SAFETY: this is actually a safe intrinsic
unsafe { intrinsics::copysignf32(self, sign) }
}
}

View File

@ -1449,6 +1449,7 @@ impl f64 {
#[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
#[inline]
pub const fn abs(self) -> f64 {
// SAFETY: this is actually a safe intrinsic
unsafe { intrinsics::fabsf64(self) }
}
@ -1509,6 +1510,7 @@ impl f64 {
#[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
#[inline]
pub const fn copysign(self, sign: f64) -> f64 {
// SAFETY: this is actually a safe intrinsic
unsafe { intrinsics::copysignf64(self, sign) }
}
}