Skip to content

Stabilize const_float_round_methods #143604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions library/core/src/intrinsics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1379,27 +1379,31 @@ pub unsafe fn fmuladdf128(a: f128, b: f128, c: f128) -> f128;
///
/// The stabilized version of this intrinsic is
/// [`f16::floor`](../../std/primitive.f16.html#method.floor)
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn floorf16(x: f16) -> f16;
/// Returns the largest integer less than or equal to an `f32`.
///
/// The stabilized version of this intrinsic is
/// [`f32::floor`](../../std/primitive.f32.html#method.floor)
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn floorf32(x: f32) -> f32;
/// Returns the largest integer less than or equal to an `f64`.
///
/// The stabilized version of this intrinsic is
/// [`f64::floor`](../../std/primitive.f64.html#method.floor)
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn floorf64(x: f64) -> f64;
/// Returns the largest integer less than or equal to an `f128`.
///
/// The stabilized version of this intrinsic is
/// [`f128::floor`](../../std/primitive.f128.html#method.floor)
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn floorf128(x: f128) -> f128;
Expand All @@ -1408,27 +1412,31 @@ pub const unsafe fn floorf128(x: f128) -> f128;
///
/// The stabilized version of this intrinsic is
/// [`f16::ceil`](../../std/primitive.f16.html#method.ceil)
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn ceilf16(x: f16) -> f16;
/// Returns the smallest integer greater than or equal to an `f32`.
///
/// The stabilized version of this intrinsic is
/// [`f32::ceil`](../../std/primitive.f32.html#method.ceil)
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn ceilf32(x: f32) -> f32;
/// Returns the smallest integer greater than or equal to an `f64`.
///
/// The stabilized version of this intrinsic is
/// [`f64::ceil`](../../std/primitive.f64.html#method.ceil)
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn ceilf64(x: f64) -> f64;
/// Returns the smallest integer greater than or equal to an `f128`.
///
/// The stabilized version of this intrinsic is
/// [`f128::ceil`](../../std/primitive.f128.html#method.ceil)
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn ceilf128(x: f128) -> f128;
Expand All @@ -1437,27 +1445,31 @@ pub const unsafe fn ceilf128(x: f128) -> f128;
///
/// The stabilized version of this intrinsic is
/// [`f16::trunc`](../../std/primitive.f16.html#method.trunc)
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn truncf16(x: f16) -> f16;
/// Returns the integer part of an `f32`.
///
/// The stabilized version of this intrinsic is
/// [`f32::trunc`](../../std/primitive.f32.html#method.trunc)
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn truncf32(x: f32) -> f32;
/// Returns the integer part of an `f64`.
///
/// The stabilized version of this intrinsic is
/// [`f64::trunc`](../../std/primitive.f64.html#method.trunc)
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn truncf64(x: f64) -> f64;
/// Returns the integer part of an `f128`.
///
/// The stabilized version of this intrinsic is
/// [`f128::trunc`](../../std/primitive.f128.html#method.trunc)
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn truncf128(x: f128) -> f128;
Expand All @@ -1467,6 +1479,7 @@ pub const unsafe fn truncf128(x: f128) -> f128;
///
/// The stabilized version of this intrinsic is
/// [`f16::round_ties_even`](../../std/primitive.f16.html#method.round_ties_even)
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const fn round_ties_even_f16(x: f16) -> f16;
Expand All @@ -1476,6 +1489,7 @@ pub const fn round_ties_even_f16(x: f16) -> f16;
///
/// The stabilized version of this intrinsic is
/// [`f32::round_ties_even`](../../std/primitive.f32.html#method.round_ties_even)
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const fn round_ties_even_f32(x: f32) -> f32;
Expand All @@ -1485,6 +1499,7 @@ pub const fn round_ties_even_f32(x: f32) -> f32;
///
/// The stabilized version of this intrinsic is
/// [`f64::round_ties_even`](../../std/primitive.f64.html#method.round_ties_even)
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const fn round_ties_even_f64(x: f64) -> f64;
Expand All @@ -1494,6 +1509,7 @@ pub const fn round_ties_even_f64(x: f64) -> f64;
///
/// The stabilized version of this intrinsic is
/// [`f128::round_ties_even`](../../std/primitive.f128.html#method.round_ties_even)
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const fn round_ties_even_f128(x: f128) -> f128;
Expand All @@ -1502,27 +1518,31 @@ pub const fn round_ties_even_f128(x: f128) -> f128;
///
/// The stabilized version of this intrinsic is
/// [`f16::round`](../../std/primitive.f16.html#method.round)
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn roundf16(x: f16) -> f16;
/// Returns the nearest integer to an `f32`. Rounds half-way cases away from zero.
///
/// The stabilized version of this intrinsic is
/// [`f32::round`](../../std/primitive.f32.html#method.round)
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn roundf32(x: f32) -> f32;
/// Returns the nearest integer to an `f64`. Rounds half-way cases away from zero.
///
/// The stabilized version of this intrinsic is
/// [`f64::round`](../../std/primitive.f64.html#method.round)
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn roundf64(x: f64) -> f64;
/// Returns the nearest integer to an `f128`. Rounds half-way cases away from zero.
///
/// The stabilized version of this intrinsic is
/// [`f128::round`](../../std/primitive.f128.html#method.round)
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn roundf128(x: f128) -> f128;
Expand Down
6 changes: 0 additions & 6 deletions library/core/src/num/f128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1448,7 +1448,6 @@ impl f128 {
#[rustc_allow_incoherent_impl]
#[unstable(feature = "f128", issue = "116909")]
#[rustc_const_unstable(feature = "f128", issue = "116909")]
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn floor(self) -> f128 {
// SAFETY: intrinsic with no preconditions
Expand Down Expand Up @@ -1478,7 +1477,6 @@ impl f128 {
#[rustc_allow_incoherent_impl]
#[unstable(feature = "f128", issue = "116909")]
#[rustc_const_unstable(feature = "f128", issue = "116909")]
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn ceil(self) -> f128 {
// SAFETY: intrinsic with no preconditions
Expand Down Expand Up @@ -1514,7 +1512,6 @@ impl f128 {
#[rustc_allow_incoherent_impl]
#[unstable(feature = "f128", issue = "116909")]
#[rustc_const_unstable(feature = "f128", issue = "116909")]
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn round(self) -> f128 {
// SAFETY: intrinsic with no preconditions
Expand Down Expand Up @@ -1548,7 +1545,6 @@ impl f128 {
#[rustc_allow_incoherent_impl]
#[unstable(feature = "f128", issue = "116909")]
#[rustc_const_unstable(feature = "f128", issue = "116909")]
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn round_ties_even(self) -> f128 {
intrinsics::round_ties_even_f128(self)
Expand Down Expand Up @@ -1580,7 +1576,6 @@ impl f128 {
#[rustc_allow_incoherent_impl]
#[unstable(feature = "f128", issue = "116909")]
#[rustc_const_unstable(feature = "f128", issue = "116909")]
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn trunc(self) -> f128 {
// SAFETY: intrinsic with no preconditions
Expand Down Expand Up @@ -1611,7 +1606,6 @@ impl f128 {
#[rustc_allow_incoherent_impl]
#[unstable(feature = "f128", issue = "116909")]
#[rustc_const_unstable(feature = "f128", issue = "116909")]
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn fract(self) -> f128 {
self - self.trunc()
Expand Down
6 changes: 0 additions & 6 deletions library/core/src/num/f16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,6 @@ impl f16 {
#[rustc_allow_incoherent_impl]
#[unstable(feature = "f16", issue = "116909")]
#[rustc_const_unstable(feature = "f16", issue = "116909")]
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn floor(self) -> f16 {
// SAFETY: intrinsic with no preconditions
Expand Down Expand Up @@ -1454,7 +1453,6 @@ impl f16 {
#[rustc_allow_incoherent_impl]
#[unstable(feature = "f16", issue = "116909")]
#[rustc_const_unstable(feature = "f16", issue = "116909")]
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn ceil(self) -> f16 {
// SAFETY: intrinsic with no preconditions
Expand Down Expand Up @@ -1490,7 +1488,6 @@ impl f16 {
#[rustc_allow_incoherent_impl]
#[unstable(feature = "f16", issue = "116909")]
#[rustc_const_unstable(feature = "f16", issue = "116909")]
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn round(self) -> f16 {
// SAFETY: intrinsic with no preconditions
Expand Down Expand Up @@ -1524,7 +1521,6 @@ impl f16 {
#[rustc_allow_incoherent_impl]
#[unstable(feature = "f16", issue = "116909")]
#[rustc_const_unstable(feature = "f16", issue = "116909")]
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn round_ties_even(self) -> f16 {
intrinsics::round_ties_even_f16(self)
Expand Down Expand Up @@ -1556,7 +1552,6 @@ impl f16 {
#[rustc_allow_incoherent_impl]
#[unstable(feature = "f16", issue = "116909")]
#[rustc_const_unstable(feature = "f16", issue = "116909")]
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn trunc(self) -> f16 {
// SAFETY: intrinsic with no preconditions
Expand Down Expand Up @@ -1587,7 +1582,6 @@ impl f16 {
#[rustc_allow_incoherent_impl]
#[unstable(feature = "f16", issue = "116909")]
#[rustc_const_unstable(feature = "f16", issue = "116909")]
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn fract(self) -> f16 {
self - self.trunc()
Expand Down
6 changes: 0 additions & 6 deletions library/core/src/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,6 @@ pub mod math {
/// [`f32::floor`]: ../../../std/primitive.f32.html#method.floor
#[inline]
#[unstable(feature = "core_float_math", issue = "137578")]
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn floor(x: f32) -> f32 {
// SAFETY: intrinsic with no preconditions
Expand Down Expand Up @@ -1622,7 +1621,6 @@ pub mod math {
#[doc(alias = "ceiling")]
#[must_use = "method returns a new number and does not mutate the original value"]
#[unstable(feature = "core_float_math", issue = "137578")]
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
pub const fn ceil(x: f32) -> f32 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::ceilf32(x) }
Expand Down Expand Up @@ -1657,7 +1655,6 @@ pub mod math {
#[inline]
#[unstable(feature = "core_float_math", issue = "137578")]
#[must_use = "method returns a new number and does not mutate the original value"]
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
pub const fn round(x: f32) -> f32 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::roundf32(x) }
Expand Down Expand Up @@ -1691,7 +1688,6 @@ pub mod math {
#[inline]
#[unstable(feature = "core_float_math", issue = "137578")]
#[must_use = "method returns a new number and does not mutate the original value"]
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
pub const fn round_ties_even(x: f32) -> f32 {
intrinsics::round_ties_even_f32(x)
}
Expand Down Expand Up @@ -1722,7 +1718,6 @@ pub mod math {
#[doc(alias = "truncate")]
#[must_use = "method returns a new number and does not mutate the original value"]
#[unstable(feature = "core_float_math", issue = "137578")]
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
pub const fn trunc(x: f32) -> f32 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::truncf32(x) }
Expand Down Expand Up @@ -1752,7 +1747,6 @@ pub mod math {
/// [`f32::fract`]: ../../../std/primitive.f32.html#method.fract
#[inline]
#[unstable(feature = "core_float_math", issue = "137578")]
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn fract(x: f32) -> f32 {
x - trunc(x)
Expand Down
6 changes: 0 additions & 6 deletions library/core/src/num/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,6 @@ pub mod math {
/// [`f64::floor`]: ../../../std/primitive.f64.html#method.floor
#[inline]
#[unstable(feature = "core_float_math", issue = "137578")]
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn floor(x: f64) -> f64 {
// SAFETY: intrinsic with no preconditions
Expand Down Expand Up @@ -1619,7 +1618,6 @@ pub mod math {
#[inline]
#[doc(alias = "ceiling")]
#[unstable(feature = "core_float_math", issue = "137578")]
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn ceil(x: f64) -> f64 {
// SAFETY: intrinsic with no preconditions
Expand Down Expand Up @@ -1654,7 +1652,6 @@ pub mod math {
/// [`f64::round`]: ../../../std/primitive.f64.html#method.round
#[inline]
#[unstable(feature = "core_float_math", issue = "137578")]
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn round(x: f64) -> f64 {
// SAFETY: intrinsic with no preconditions
Expand Down Expand Up @@ -1688,7 +1685,6 @@ pub mod math {
/// [`f64::round_ties_even`]: ../../../std/primitive.f64.html#method.round_ties_even
#[inline]
#[unstable(feature = "core_float_math", issue = "137578")]
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn round_ties_even(x: f64) -> f64 {
intrinsics::round_ties_even_f64(x)
Expand Down Expand Up @@ -1719,7 +1715,6 @@ pub mod math {
#[inline]
#[doc(alias = "truncate")]
#[unstable(feature = "core_float_math", issue = "137578")]
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn trunc(x: f64) -> f64 {
// SAFETY: intrinsic with no preconditions
Expand Down Expand Up @@ -1750,7 +1745,6 @@ pub mod math {
/// [`f64::fract`]: ../../../std/primitive.f64.html#method.fract
#[inline]
#[unstable(feature = "core_float_math", issue = "137578")]
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn fract(x: f64) -> f64 {
x - trunc(x)
Expand Down
1 change: 0 additions & 1 deletion library/coretests/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#![feature(const_deref)]
#![feature(const_destruct)]
#![feature(const_eval_select)]
#![feature(const_float_round_methods)]
#![feature(const_ref_cell)]
#![feature(const_trait_impl)]
#![feature(core_float_math)]
Expand Down
1 change: 0 additions & 1 deletion library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@
#![feature(bstr_internals)]
#![feature(char_internals)]
#![feature(clone_to_uninit)]
#![feature(const_float_round_methods)]
#![feature(core_intrinsics)]
#![feature(core_io_borrowed_buf)]
#![feature(duration_constants)]
Expand Down
Loading
Loading