Skip to content

Commit ffbcba0

Browse files
committed
add missing safety comments
1 parent 768d0cd commit ffbcba0

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

core/src/num/f128.rs

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

core/src/num/f16.rs

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

core/src/num/f32.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1449,6 +1449,7 @@ impl f32 {
14491449
#[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
14501450
#[inline]
14511451
pub const fn abs(self) -> f32 {
1452+
// SAFETY: this is actually a safe intrinsic
14521453
unsafe { intrinsics::fabsf32(self) }
14531454
}
14541455

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

core/src/num/f64.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1449,6 +1449,7 @@ impl f64 {
14491449
#[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
14501450
#[inline]
14511451
pub const fn abs(self) -> f64 {
1452+
// SAFETY: this is actually a safe intrinsic
14521453
unsafe { intrinsics::fabsf64(self) }
14531454
}
14541455

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

0 commit comments

Comments
 (0)