diff --git a/compiler/rustc_hir_analysis/src/check/intrinsic.rs b/compiler/rustc_hir_analysis/src/check/intrinsic.rs index acdd2facc24..5c0c7a86a0c 100644 --- a/compiler/rustc_hir_analysis/src/check/intrinsic.rs +++ b/compiler/rustc_hir_analysis/src/check/intrinsic.rs @@ -137,6 +137,10 @@ pub fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) - | sym::fmul_algebraic | sym::fdiv_algebraic | sym::frem_algebraic + | sym::round_ties_even_f16 + | sym::round_ties_even_f32 + | sym::round_ties_even_f64 + | sym::round_ties_even_f128 | sym::const_eval_select => hir::Safety::Safe, _ => hir::Safety::Unsafe, }; diff --git a/library/core/src/intrinsics/mod.rs b/library/core/src/intrinsics/mod.rs index 320122a53e9..a52f2b20246 100644 --- a/library/core/src/intrinsics/mod.rs +++ b/library/core/src/intrinsics/mod.rs @@ -2748,13 +2748,13 @@ pub unsafe fn truncf128(_x: f128) -> f128 { #[rustc_intrinsic_must_be_overridden] #[rustc_nounwind] #[cfg(not(bootstrap))] -pub unsafe fn round_ties_even_f16(_x: f16) -> f16 { +pub fn round_ties_even_f16(_x: f16) -> f16 { unreachable!() } /// To be removed on next bootstrap bump. #[cfg(bootstrap)] -pub unsafe fn round_ties_even_f16(x: f16) -> f16 { +pub fn round_ties_even_f16(x: f16) -> f16 { #[rustc_intrinsic] #[rustc_intrinsic_must_be_overridden] #[rustc_nounwind] @@ -2775,13 +2775,13 @@ pub unsafe fn round_ties_even_f16(x: f16) -> f16 { #[rustc_intrinsic_must_be_overridden] #[rustc_nounwind] #[cfg(not(bootstrap))] -pub unsafe fn round_ties_even_f32(_x: f32) -> f32 { +pub fn round_ties_even_f32(_x: f32) -> f32 { unreachable!() } /// To be removed on next bootstrap bump. #[cfg(bootstrap)] -pub unsafe fn round_ties_even_f32(x: f32) -> f32 { +pub fn round_ties_even_f32(x: f32) -> f32 { #[rustc_intrinsic] #[rustc_intrinsic_must_be_overridden] #[rustc_nounwind] @@ -2802,13 +2802,13 @@ pub unsafe fn round_ties_even_f32(x: f32) -> f32 { #[rustc_intrinsic_must_be_overridden] #[rustc_nounwind] #[cfg(not(bootstrap))] -pub unsafe fn round_ties_even_f64(_x: f64) -> f64 { +pub fn round_ties_even_f64(_x: f64) -> f64 { unreachable!() } /// To be removed on next bootstrap bump. #[cfg(bootstrap)] -pub unsafe fn round_ties_even_f64(x: f64) -> f64 { +pub fn round_ties_even_f64(x: f64) -> f64 { #[rustc_intrinsic] #[rustc_intrinsic_must_be_overridden] #[rustc_nounwind] @@ -2829,13 +2829,13 @@ pub unsafe fn round_ties_even_f64(x: f64) -> f64 { #[rustc_intrinsic_must_be_overridden] #[rustc_nounwind] #[cfg(not(bootstrap))] -pub unsafe fn round_ties_even_f128(_x: f128) -> f128 { +pub fn round_ties_even_f128(_x: f128) -> f128 { unreachable!() } /// To be removed on next bootstrap bump. #[cfg(bootstrap)] -pub unsafe fn round_ties_even_f128(x: f128) -> f128 { +pub fn round_ties_even_f128(x: f128) -> f128 { #[rustc_intrinsic] #[rustc_intrinsic_must_be_overridden] #[rustc_nounwind] diff --git a/library/std/src/f128.rs b/library/std/src/f128.rs index 615c4fd3348..d4aa174cee5 100644 --- a/library/std/src/f128.rs +++ b/library/std/src/f128.rs @@ -129,7 +129,7 @@ impl f128 { #[unstable(feature = "f128", issue = "116909")] #[must_use = "method returns a new number and does not mutate the original value"] pub fn round_ties_even(self) -> f128 { - unsafe { intrinsics::round_ties_even_f128(self) } + intrinsics::round_ties_even_f128(self) } /// Returns the integer part of `self`. diff --git a/library/std/src/f16.rs b/library/std/src/f16.rs index 85b82b91fab..c0678732365 100644 --- a/library/std/src/f16.rs +++ b/library/std/src/f16.rs @@ -129,7 +129,7 @@ impl f16 { #[unstable(feature = "f16", issue = "116909")] #[must_use = "method returns a new number and does not mutate the original value"] pub fn round_ties_even(self) -> f16 { - unsafe { intrinsics::round_ties_even_f16(self) } + intrinsics::round_ties_even_f16(self) } /// Returns the integer part of `self`. diff --git a/library/std/src/f32.rs b/library/std/src/f32.rs index da1f000278d..bdcbd8b30b6 100644 --- a/library/std/src/f32.rs +++ b/library/std/src/f32.rs @@ -125,7 +125,7 @@ impl f32 { #[stable(feature = "round_ties_even", since = "1.77.0")] #[inline] pub fn round_ties_even(self) -> f32 { - unsafe { intrinsics::round_ties_even_f32(self) } + intrinsics::round_ties_even_f32(self) } /// Returns the integer part of `self`. diff --git a/library/std/src/f64.rs b/library/std/src/f64.rs index 8a9f693a7a8..11acc13d657 100644 --- a/library/std/src/f64.rs +++ b/library/std/src/f64.rs @@ -125,7 +125,7 @@ impl f64 { #[stable(feature = "round_ties_even", since = "1.77.0")] #[inline] pub fn round_ties_even(self) -> f64 { - unsafe { intrinsics::round_ties_even_f64(self) } + intrinsics::round_ties_even_f64(self) } /// Returns the integer part of `self`.