Skip to content

Commit a8c2e54

Browse files
authored
Rollup merge of #143604 - nxsaken:const_float_round_methods, r=RalfJung
Stabilize `const_float_round_methods` Closes #141555, waiting for FCP.
2 parents 6d7d366 + caf4f11 commit a8c2e54

File tree

9 files changed

+32
-38
lines changed

9 files changed

+32
-38
lines changed

library/core/src/intrinsics/mod.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,27 +1379,31 @@ pub unsafe fn fmuladdf128(a: f128, b: f128, c: f128) -> f128;
13791379
///
13801380
/// The stabilized version of this intrinsic is
13811381
/// [`f16::floor`](../../std/primitive.f16.html#method.floor)
1382+
#[rustc_intrinsic_const_stable_indirect]
13821383
#[rustc_intrinsic]
13831384
#[rustc_nounwind]
13841385
pub const unsafe fn floorf16(x: f16) -> f16;
13851386
/// Returns the largest integer less than or equal to an `f32`.
13861387
///
13871388
/// The stabilized version of this intrinsic is
13881389
/// [`f32::floor`](../../std/primitive.f32.html#method.floor)
1390+
#[rustc_intrinsic_const_stable_indirect]
13891391
#[rustc_intrinsic]
13901392
#[rustc_nounwind]
13911393
pub const unsafe fn floorf32(x: f32) -> f32;
13921394
/// Returns the largest integer less than or equal to an `f64`.
13931395
///
13941396
/// The stabilized version of this intrinsic is
13951397
/// [`f64::floor`](../../std/primitive.f64.html#method.floor)
1398+
#[rustc_intrinsic_const_stable_indirect]
13961399
#[rustc_intrinsic]
13971400
#[rustc_nounwind]
13981401
pub const unsafe fn floorf64(x: f64) -> f64;
13991402
/// Returns the largest integer less than or equal to an `f128`.
14001403
///
14011404
/// The stabilized version of this intrinsic is
14021405
/// [`f128::floor`](../../std/primitive.f128.html#method.floor)
1406+
#[rustc_intrinsic_const_stable_indirect]
14031407
#[rustc_intrinsic]
14041408
#[rustc_nounwind]
14051409
pub const unsafe fn floorf128(x: f128) -> f128;
@@ -1408,27 +1412,31 @@ pub const unsafe fn floorf128(x: f128) -> f128;
14081412
///
14091413
/// The stabilized version of this intrinsic is
14101414
/// [`f16::ceil`](../../std/primitive.f16.html#method.ceil)
1415+
#[rustc_intrinsic_const_stable_indirect]
14111416
#[rustc_intrinsic]
14121417
#[rustc_nounwind]
14131418
pub const unsafe fn ceilf16(x: f16) -> f16;
14141419
/// Returns the smallest integer greater than or equal to an `f32`.
14151420
///
14161421
/// The stabilized version of this intrinsic is
14171422
/// [`f32::ceil`](../../std/primitive.f32.html#method.ceil)
1423+
#[rustc_intrinsic_const_stable_indirect]
14181424
#[rustc_intrinsic]
14191425
#[rustc_nounwind]
14201426
pub const unsafe fn ceilf32(x: f32) -> f32;
14211427
/// Returns the smallest integer greater than or equal to an `f64`.
14221428
///
14231429
/// The stabilized version of this intrinsic is
14241430
/// [`f64::ceil`](../../std/primitive.f64.html#method.ceil)
1431+
#[rustc_intrinsic_const_stable_indirect]
14251432
#[rustc_intrinsic]
14261433
#[rustc_nounwind]
14271434
pub const unsafe fn ceilf64(x: f64) -> f64;
14281435
/// Returns the smallest integer greater than or equal to an `f128`.
14291436
///
14301437
/// The stabilized version of this intrinsic is
14311438
/// [`f128::ceil`](../../std/primitive.f128.html#method.ceil)
1439+
#[rustc_intrinsic_const_stable_indirect]
14321440
#[rustc_intrinsic]
14331441
#[rustc_nounwind]
14341442
pub const unsafe fn ceilf128(x: f128) -> f128;
@@ -1437,27 +1445,31 @@ pub const unsafe fn ceilf128(x: f128) -> f128;
14371445
///
14381446
/// The stabilized version of this intrinsic is
14391447
/// [`f16::trunc`](../../std/primitive.f16.html#method.trunc)
1448+
#[rustc_intrinsic_const_stable_indirect]
14401449
#[rustc_intrinsic]
14411450
#[rustc_nounwind]
14421451
pub const unsafe fn truncf16(x: f16) -> f16;
14431452
/// Returns the integer part of an `f32`.
14441453
///
14451454
/// The stabilized version of this intrinsic is
14461455
/// [`f32::trunc`](../../std/primitive.f32.html#method.trunc)
1456+
#[rustc_intrinsic_const_stable_indirect]
14471457
#[rustc_intrinsic]
14481458
#[rustc_nounwind]
14491459
pub const unsafe fn truncf32(x: f32) -> f32;
14501460
/// Returns the integer part of an `f64`.
14511461
///
14521462
/// The stabilized version of this intrinsic is
14531463
/// [`f64::trunc`](../../std/primitive.f64.html#method.trunc)
1464+
#[rustc_intrinsic_const_stable_indirect]
14541465
#[rustc_intrinsic]
14551466
#[rustc_nounwind]
14561467
pub const unsafe fn truncf64(x: f64) -> f64;
14571468
/// Returns the integer part of an `f128`.
14581469
///
14591470
/// The stabilized version of this intrinsic is
14601471
/// [`f128::trunc`](../../std/primitive.f128.html#method.trunc)
1472+
#[rustc_intrinsic_const_stable_indirect]
14611473
#[rustc_intrinsic]
14621474
#[rustc_nounwind]
14631475
pub const unsafe fn truncf128(x: f128) -> f128;
@@ -1467,6 +1479,7 @@ pub const unsafe fn truncf128(x: f128) -> f128;
14671479
///
14681480
/// The stabilized version of this intrinsic is
14691481
/// [`f16::round_ties_even`](../../std/primitive.f16.html#method.round_ties_even)
1482+
#[rustc_intrinsic_const_stable_indirect]
14701483
#[rustc_intrinsic]
14711484
#[rustc_nounwind]
14721485
pub const fn round_ties_even_f16(x: f16) -> f16;
@@ -1476,6 +1489,7 @@ pub const fn round_ties_even_f16(x: f16) -> f16;
14761489
///
14771490
/// The stabilized version of this intrinsic is
14781491
/// [`f32::round_ties_even`](../../std/primitive.f32.html#method.round_ties_even)
1492+
#[rustc_intrinsic_const_stable_indirect]
14791493
#[rustc_intrinsic]
14801494
#[rustc_nounwind]
14811495
pub const fn round_ties_even_f32(x: f32) -> f32;
@@ -1485,6 +1499,7 @@ pub const fn round_ties_even_f32(x: f32) -> f32;
14851499
///
14861500
/// The stabilized version of this intrinsic is
14871501
/// [`f64::round_ties_even`](../../std/primitive.f64.html#method.round_ties_even)
1502+
#[rustc_intrinsic_const_stable_indirect]
14881503
#[rustc_intrinsic]
14891504
#[rustc_nounwind]
14901505
pub const fn round_ties_even_f64(x: f64) -> f64;
@@ -1494,6 +1509,7 @@ pub const fn round_ties_even_f64(x: f64) -> f64;
14941509
///
14951510
/// The stabilized version of this intrinsic is
14961511
/// [`f128::round_ties_even`](../../std/primitive.f128.html#method.round_ties_even)
1512+
#[rustc_intrinsic_const_stable_indirect]
14971513
#[rustc_intrinsic]
14981514
#[rustc_nounwind]
14991515
pub const fn round_ties_even_f128(x: f128) -> f128;
@@ -1502,27 +1518,31 @@ pub const fn round_ties_even_f128(x: f128) -> f128;
15021518
///
15031519
/// The stabilized version of this intrinsic is
15041520
/// [`f16::round`](../../std/primitive.f16.html#method.round)
1521+
#[rustc_intrinsic_const_stable_indirect]
15051522
#[rustc_intrinsic]
15061523
#[rustc_nounwind]
15071524
pub const unsafe fn roundf16(x: f16) -> f16;
15081525
/// Returns the nearest integer to an `f32`. Rounds half-way cases away from zero.
15091526
///
15101527
/// The stabilized version of this intrinsic is
15111528
/// [`f32::round`](../../std/primitive.f32.html#method.round)
1529+
#[rustc_intrinsic_const_stable_indirect]
15121530
#[rustc_intrinsic]
15131531
#[rustc_nounwind]
15141532
pub const unsafe fn roundf32(x: f32) -> f32;
15151533
/// Returns the nearest integer to an `f64`. Rounds half-way cases away from zero.
15161534
///
15171535
/// The stabilized version of this intrinsic is
15181536
/// [`f64::round`](../../std/primitive.f64.html#method.round)
1537+
#[rustc_intrinsic_const_stable_indirect]
15191538
#[rustc_intrinsic]
15201539
#[rustc_nounwind]
15211540
pub const unsafe fn roundf64(x: f64) -> f64;
15221541
/// Returns the nearest integer to an `f128`. Rounds half-way cases away from zero.
15231542
///
15241543
/// The stabilized version of this intrinsic is
15251544
/// [`f128::round`](../../std/primitive.f128.html#method.round)
1545+
#[rustc_intrinsic_const_stable_indirect]
15261546
#[rustc_intrinsic]
15271547
#[rustc_nounwind]
15281548
pub const unsafe fn roundf128(x: f128) -> f128;

library/core/src/num/f128.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,6 @@ impl f128 {
14481448
#[rustc_allow_incoherent_impl]
14491449
#[unstable(feature = "f128", issue = "116909")]
14501450
#[rustc_const_unstable(feature = "f128", issue = "116909")]
1451-
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
14521451
#[must_use = "method returns a new number and does not mutate the original value"]
14531452
pub const fn floor(self) -> f128 {
14541453
// SAFETY: intrinsic with no preconditions
@@ -1478,7 +1477,6 @@ impl f128 {
14781477
#[rustc_allow_incoherent_impl]
14791478
#[unstable(feature = "f128", issue = "116909")]
14801479
#[rustc_const_unstable(feature = "f128", issue = "116909")]
1481-
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
14821480
#[must_use = "method returns a new number and does not mutate the original value"]
14831481
pub const fn ceil(self) -> f128 {
14841482
// SAFETY: intrinsic with no preconditions
@@ -1514,7 +1512,6 @@ impl f128 {
15141512
#[rustc_allow_incoherent_impl]
15151513
#[unstable(feature = "f128", issue = "116909")]
15161514
#[rustc_const_unstable(feature = "f128", issue = "116909")]
1517-
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
15181515
#[must_use = "method returns a new number and does not mutate the original value"]
15191516
pub const fn round(self) -> f128 {
15201517
// SAFETY: intrinsic with no preconditions
@@ -1548,7 +1545,6 @@ impl f128 {
15481545
#[rustc_allow_incoherent_impl]
15491546
#[unstable(feature = "f128", issue = "116909")]
15501547
#[rustc_const_unstable(feature = "f128", issue = "116909")]
1551-
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
15521548
#[must_use = "method returns a new number and does not mutate the original value"]
15531549
pub const fn round_ties_even(self) -> f128 {
15541550
intrinsics::round_ties_even_f128(self)
@@ -1580,7 +1576,6 @@ impl f128 {
15801576
#[rustc_allow_incoherent_impl]
15811577
#[unstable(feature = "f128", issue = "116909")]
15821578
#[rustc_const_unstable(feature = "f128", issue = "116909")]
1583-
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
15841579
#[must_use = "method returns a new number and does not mutate the original value"]
15851580
pub const fn trunc(self) -> f128 {
15861581
// SAFETY: intrinsic with no preconditions
@@ -1611,7 +1606,6 @@ impl f128 {
16111606
#[rustc_allow_incoherent_impl]
16121607
#[unstable(feature = "f128", issue = "116909")]
16131608
#[rustc_const_unstable(feature = "f128", issue = "116909")]
1614-
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
16151609
#[must_use = "method returns a new number and does not mutate the original value"]
16161610
pub const fn fract(self) -> f128 {
16171611
self - self.trunc()

library/core/src/num/f16.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,6 @@ impl f16 {
14241424
#[rustc_allow_incoherent_impl]
14251425
#[unstable(feature = "f16", issue = "116909")]
14261426
#[rustc_const_unstable(feature = "f16", issue = "116909")]
1427-
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
14281427
#[must_use = "method returns a new number and does not mutate the original value"]
14291428
pub const fn floor(self) -> f16 {
14301429
// SAFETY: intrinsic with no preconditions
@@ -1454,7 +1453,6 @@ impl f16 {
14541453
#[rustc_allow_incoherent_impl]
14551454
#[unstable(feature = "f16", issue = "116909")]
14561455
#[rustc_const_unstable(feature = "f16", issue = "116909")]
1457-
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
14581456
#[must_use = "method returns a new number and does not mutate the original value"]
14591457
pub const fn ceil(self) -> f16 {
14601458
// SAFETY: intrinsic with no preconditions
@@ -1490,7 +1488,6 @@ impl f16 {
14901488
#[rustc_allow_incoherent_impl]
14911489
#[unstable(feature = "f16", issue = "116909")]
14921490
#[rustc_const_unstable(feature = "f16", issue = "116909")]
1493-
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
14941491
#[must_use = "method returns a new number and does not mutate the original value"]
14951492
pub const fn round(self) -> f16 {
14961493
// SAFETY: intrinsic with no preconditions
@@ -1524,7 +1521,6 @@ impl f16 {
15241521
#[rustc_allow_incoherent_impl]
15251522
#[unstable(feature = "f16", issue = "116909")]
15261523
#[rustc_const_unstable(feature = "f16", issue = "116909")]
1527-
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
15281524
#[must_use = "method returns a new number and does not mutate the original value"]
15291525
pub const fn round_ties_even(self) -> f16 {
15301526
intrinsics::round_ties_even_f16(self)
@@ -1556,7 +1552,6 @@ impl f16 {
15561552
#[rustc_allow_incoherent_impl]
15571553
#[unstable(feature = "f16", issue = "116909")]
15581554
#[rustc_const_unstable(feature = "f16", issue = "116909")]
1559-
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
15601555
#[must_use = "method returns a new number and does not mutate the original value"]
15611556
pub const fn trunc(self) -> f16 {
15621557
// SAFETY: intrinsic with no preconditions
@@ -1587,7 +1582,6 @@ impl f16 {
15871582
#[rustc_allow_incoherent_impl]
15881583
#[unstable(feature = "f16", issue = "116909")]
15891584
#[rustc_const_unstable(feature = "f16", issue = "116909")]
1590-
// #[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
15911585
#[must_use = "method returns a new number and does not mutate the original value"]
15921586
pub const fn fract(self) -> f16 {
15931587
self - self.trunc()

library/core/src/num/f32.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,6 @@ pub mod math {
15911591
/// [`f32::floor`]: ../../../std/primitive.f32.html#method.floor
15921592
#[inline]
15931593
#[unstable(feature = "core_float_math", issue = "137578")]
1594-
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
15951594
#[must_use = "method returns a new number and does not mutate the original value"]
15961595
pub const fn floor(x: f32) -> f32 {
15971596
// SAFETY: intrinsic with no preconditions
@@ -1622,7 +1621,6 @@ pub mod math {
16221621
#[doc(alias = "ceiling")]
16231622
#[must_use = "method returns a new number and does not mutate the original value"]
16241623
#[unstable(feature = "core_float_math", issue = "137578")]
1625-
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
16261624
pub const fn ceil(x: f32) -> f32 {
16271625
// SAFETY: intrinsic with no preconditions
16281626
unsafe { intrinsics::ceilf32(x) }
@@ -1657,7 +1655,6 @@ pub mod math {
16571655
#[inline]
16581656
#[unstable(feature = "core_float_math", issue = "137578")]
16591657
#[must_use = "method returns a new number and does not mutate the original value"]
1660-
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
16611658
pub const fn round(x: f32) -> f32 {
16621659
// SAFETY: intrinsic with no preconditions
16631660
unsafe { intrinsics::roundf32(x) }
@@ -1691,7 +1688,6 @@ pub mod math {
16911688
#[inline]
16921689
#[unstable(feature = "core_float_math", issue = "137578")]
16931690
#[must_use = "method returns a new number and does not mutate the original value"]
1694-
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
16951691
pub const fn round_ties_even(x: f32) -> f32 {
16961692
intrinsics::round_ties_even_f32(x)
16971693
}
@@ -1722,7 +1718,6 @@ pub mod math {
17221718
#[doc(alias = "truncate")]
17231719
#[must_use = "method returns a new number and does not mutate the original value"]
17241720
#[unstable(feature = "core_float_math", issue = "137578")]
1725-
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
17261721
pub const fn trunc(x: f32) -> f32 {
17271722
// SAFETY: intrinsic with no preconditions
17281723
unsafe { intrinsics::truncf32(x) }
@@ -1752,7 +1747,6 @@ pub mod math {
17521747
/// [`f32::fract`]: ../../../std/primitive.f32.html#method.fract
17531748
#[inline]
17541749
#[unstable(feature = "core_float_math", issue = "137578")]
1755-
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
17561750
#[must_use = "method returns a new number and does not mutate the original value"]
17571751
pub const fn fract(x: f32) -> f32 {
17581752
x - trunc(x)

library/core/src/num/f64.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,7 +1589,6 @@ pub mod math {
15891589
/// [`f64::floor`]: ../../../std/primitive.f64.html#method.floor
15901590
#[inline]
15911591
#[unstable(feature = "core_float_math", issue = "137578")]
1592-
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
15931592
#[must_use = "method returns a new number and does not mutate the original value"]
15941593
pub const fn floor(x: f64) -> f64 {
15951594
// SAFETY: intrinsic with no preconditions
@@ -1619,7 +1618,6 @@ pub mod math {
16191618
#[inline]
16201619
#[doc(alias = "ceiling")]
16211620
#[unstable(feature = "core_float_math", issue = "137578")]
1622-
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
16231621
#[must_use = "method returns a new number and does not mutate the original value"]
16241622
pub const fn ceil(x: f64) -> f64 {
16251623
// SAFETY: intrinsic with no preconditions
@@ -1654,7 +1652,6 @@ pub mod math {
16541652
/// [`f64::round`]: ../../../std/primitive.f64.html#method.round
16551653
#[inline]
16561654
#[unstable(feature = "core_float_math", issue = "137578")]
1657-
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
16581655
#[must_use = "method returns a new number and does not mutate the original value"]
16591656
pub const fn round(x: f64) -> f64 {
16601657
// SAFETY: intrinsic with no preconditions
@@ -1688,7 +1685,6 @@ pub mod math {
16881685
/// [`f64::round_ties_even`]: ../../../std/primitive.f64.html#method.round_ties_even
16891686
#[inline]
16901687
#[unstable(feature = "core_float_math", issue = "137578")]
1691-
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
16921688
#[must_use = "method returns a new number and does not mutate the original value"]
16931689
pub const fn round_ties_even(x: f64) -> f64 {
16941690
intrinsics::round_ties_even_f64(x)
@@ -1719,7 +1715,6 @@ pub mod math {
17191715
#[inline]
17201716
#[doc(alias = "truncate")]
17211717
#[unstable(feature = "core_float_math", issue = "137578")]
1722-
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
17231718
#[must_use = "method returns a new number and does not mutate the original value"]
17241719
pub const fn trunc(x: f64) -> f64 {
17251720
// SAFETY: intrinsic with no preconditions
@@ -1750,7 +1745,6 @@ pub mod math {
17501745
/// [`f64::fract`]: ../../../std/primitive.f64.html#method.fract
17511746
#[inline]
17521747
#[unstable(feature = "core_float_math", issue = "137578")]
1753-
#[rustc_const_unstable(feature = "const_float_round_methods", issue = "141555")]
17541748
#[must_use = "method returns a new number and does not mutate the original value"]
17551749
pub const fn fract(x: f64) -> f64 {
17561750
x - trunc(x)

library/coretests/tests/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#![feature(const_deref)]
2020
#![feature(const_destruct)]
2121
#![feature(const_eval_select)]
22-
#![feature(const_float_round_methods)]
2322
#![feature(const_ops)]
2423
#![feature(const_ref_cell)]
2524
#![feature(const_trait_impl)]

library/std/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@
329329
#![feature(bstr_internals)]
330330
#![feature(char_internals)]
331331
#![feature(clone_to_uninit)]
332-
#![feature(const_float_round_methods)]
333332
#![feature(core_intrinsics)]
334333
#![feature(core_io_borrowed_buf)]
335334
#![feature(duration_constants)]

0 commit comments

Comments
 (0)