Skip to content
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

Stabilize remaining integer methods as const fn #80962

Merged
merged 2 commits into from
Feb 8, 2021
Merged

Stabilize remaining integer methods as const fn #80962

merged 2 commits into from
Feb 8, 2021

Conversation

jhpratt
Copy link
Member

@jhpratt jhpratt commented Jan 13, 2021

This pull request stabilizes the following methods as const fn:

  • i*::checked_div
  • i*::checked_div_euclid
  • i*::checked_rem
  • i*::checked_rem_euclid
  • i*::div_euclid
  • i*::overflowing_div
  • i*::overflowing_div_euclid
  • i*::overflowing_rem
  • i*::overflowing_rem_euclid
  • i*::rem_euclid
  • i*::wrapping_div
  • i*::wrapping_div_euclid
  • i*::wrapping_rem
  • i*::wrapping_rem_euclid
  • u*::checked_div
  • u*::checked_div_euclid
  • u*::checked_rem
  • u*::checked_rem_euclid
  • u*::div_euclid
  • u*::overflowing_div
  • u*::overflowing_div_euclid
  • u*::overflowing_rem
  • u*::overflowing_rem_euclid
  • u*::rem_euclid
  • u*::wrapping_div
  • u*::wrapping_div_euclid
  • u*::wrapping_rem
  • u*::wrapping_rem_euclid

These can all be implemented on the current stable (1.49). There are two unstable details: const likely/unlikely and unchecked division/remainder. Both of these are for optimizations, and are in no way required to make the methods function; there is no exposure of these details publicly. Per comments below, it seems best practice is to stabilize the intrinsics. As such, intrinsics::unchecked_div and intrinsics::unchecked_rem have been stabilized as const as part of this pull request as well. The methods themselves remain unstable.

I believe part of the reason these were not stabilized previously was the behavior around division by 0 and modulo 0. After testing on nightly, the diagnostic for something like const _: i8 = 5i8 % 0i8; is similar to that of const _: i8 = 5i8.rem_euclid(0i8); (assuming the appropriate feature flag is enabled). As such, I believe these methods are ready to be stabilized as const fn.

This pull request represents the final methods mentioned in #53718. As such, this PR closes #53718.

@rustbot modify labels to +A-const-fn, +T-libs

@rustbot rustbot added A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jan 13, 2021
@rust-highfive
Copy link
Collaborator

r? @m-ou-se

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 13, 2021
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling libc v0.2.79
   Compiling std v0.0.0 (/checkout/library/std)
   Compiling compiler_builtins v0.1.39
   Compiling unwind v0.0.0 (/checkout/library/unwind)
error: `intrinsics::unchecked_div` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
525  |  |                 Some(unsafe { intrinsics::unchecked_div(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2007 |  |     }
2008 |  | }
2008 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:91:5
     |
     |
91   | /      int_impl! { i8, i8, u8, 8, -128, 127, 2, "-0x7e", "0xa", "0x12", "0x12", "0x48",
92   | |      "[0x12]", "[0x12]", "", "" }
     | |_________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `intrinsics::unchecked_div` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
525  |  |                 Some(unsafe { intrinsics::unchecked_div(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2007 |  |     }
2008 |  | }
2008 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:97:5
     |
     |
97   | /      int_impl! { i16, i16, u16, 16, -32768, 32767, 4, "-0x5ffd", "0x3a", "0x1234", "0x3412",
98   | |      "0x2c48", "[0x34, 0x12]", "[0x12, 0x34]", "", "" }
     | |_______________________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `intrinsics::unchecked_div` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
525  |  |                 Some(unsafe { intrinsics::unchecked_div(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2007 |  |     }
2008 |  | }
2008 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:103:5
     |
     |
103  | /      int_impl! { i32, i32, u32, 32, -2147483648, 2147483647, 8, "0x10000b3", "0xb301",
104  | |      "0x12345678", "0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]",
105  | |      "[0x12, 0x34, 0x56, 0x78]", "", "" }
     | |_________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `intrinsics::unchecked_div` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
525  |  |                 Some(unsafe { intrinsics::unchecked_div(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2007 |  |     }
2008 |  | }
2008 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:110:5
     |
     |
110  | /      int_impl! { i64, i64, u64, 64, -9223372036854775808, 9223372036854775807, 12,
111  | |      "0xaa00000000006e1", "0x6e10aa", "0x1234567890123456", "0x5634129078563412",
112  | |      "0x6a2c48091e6a2c48", "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
113  | |      "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]", "", "" }
     | |_________________________________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `intrinsics::unchecked_div` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
525  |  |                 Some(unsafe { intrinsics::unchecked_div(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2007 |  |     }
2008 |  | }
2008 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:118:5
     |
     |
118  | /      int_impl! { i128, i128, u128, 128, -170141183460469231731687303715884105728,
119  | |      170141183460469231731687303715884105727, 16,
120  | |      "0x13f40000000000000000000000004f76", "0x4f7613f4", "0x12345678901234567890123456789012",
121  | |      "0x12907856341290785634129078563412", "0x48091e6a2c48091e6a2c48091e6a2c48",
...    |
124  | |      "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, \
125  | |        0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12]", "", "" }
     | |_________________________________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `intrinsics::unchecked_div` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
525  |  |                 Some(unsafe { intrinsics::unchecked_div(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2007 |  |     }
2008 |  | }
2008 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:148:5
     |
     |
148  | /      int_impl! { isize, i64, usize, 64, -9223372036854775808, 9223372036854775807,
149  | |      12, "0xaa00000000006e1", "0x6e10aa",  "0x1234567890123456", "0x5634129078563412",
150  | |       "0x6a2c48091e6a2c48", "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
151  | |       "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]",
152  | |       usize_isize_to_xe_bytes_doc!(), usize_isize_from_xe_bytes_doc!() }
     | |________________________________________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `intrinsics::unchecked_rem` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
577  |  |                 Some(unsafe { intrinsics::unchecked_rem(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2007 |  |     }
2008 |  | }
2008 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:91:5
     |
     |
91   | /      int_impl! { i8, i8, u8, 8, -128, 127, 2, "-0x7e", "0xa", "0x12", "0x12", "0x48",
92   | |      "[0x12]", "[0x12]", "", "" }
     | |_________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `intrinsics::unchecked_rem` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
577  |  |                 Some(unsafe { intrinsics::unchecked_rem(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2007 |  |     }
2008 |  | }
2008 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:97:5
     |
     |
97   | /      int_impl! { i16, i16, u16, 16, -32768, 32767, 4, "-0x5ffd", "0x3a", "0x1234", "0x3412",
98   | |      "0x2c48", "[0x34, 0x12]", "[0x12, 0x34]", "", "" }
     | |_______________________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `intrinsics::unchecked_rem` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
577  |  |                 Some(unsafe { intrinsics::unchecked_rem(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2007 |  |     }
2008 |  | }
2008 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:103:5
     |
     |
103  | /      int_impl! { i32, i32, u32, 32, -2147483648, 2147483647, 8, "0x10000b3", "0xb301",
104  | |      "0x12345678", "0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]",
105  | |      "[0x12, 0x34, 0x56, 0x78]", "", "" }
     | |_________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `intrinsics::unchecked_rem` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
577  |  |                 Some(unsafe { intrinsics::unchecked_rem(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2007 |  |     }
2008 |  | }
2008 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:110:5
     |
     |
110  | /      int_impl! { i64, i64, u64, 64, -9223372036854775808, 9223372036854775807, 12,
111  | |      "0xaa00000000006e1", "0x6e10aa", "0x1234567890123456", "0x5634129078563412",
112  | |      "0x6a2c48091e6a2c48", "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
113  | |      "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]", "", "" }
     | |_________________________________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `intrinsics::unchecked_rem` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
577  |  |                 Some(unsafe { intrinsics::unchecked_rem(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2007 |  |     }
2008 |  | }
2008 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:118:5
     |
     |
118  | /      int_impl! { i128, i128, u128, 128, -170141183460469231731687303715884105728,
119  | |      170141183460469231731687303715884105727, 16,
120  | |      "0x13f40000000000000000000000004f76", "0x4f7613f4", "0x12345678901234567890123456789012",
121  | |      "0x12907856341290785634129078563412", "0x48091e6a2c48091e6a2c48091e6a2c48",
...    |
124  | |      "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, \
125  | |        0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12]", "", "" }
     | |_________________________________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `intrinsics::unchecked_rem` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
577  |  |                 Some(unsafe { intrinsics::unchecked_rem(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2007 |  |     }
2008 |  | }
2008 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:148:5
     |
     |
148  | /      int_impl! { isize, i64, usize, 64, -9223372036854775808, 9223372036854775807,
149  | |      12, "0xaa00000000006e1", "0x6e10aa",  "0x1234567890123456", "0x5634129078563412",
150  | |       "0x6a2c48091e6a2c48", "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
151  | |       "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]",
152  | |       usize_isize_to_xe_bytes_doc!(), usize_isize_from_xe_bytes_doc!() }
     | |________________________________________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `intrinsics::unchecked_div` is not yet stable as a const fn
    --> library/core/src/num/uint_macros.rs:535:31
     |
1    |  / macro_rules! uint_impl {
2    |  |     ($SelfT:ty, $ActualT:ty, $BITS:expr, $MaxV:expr,
3    |  |         $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |         $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
535  |  |                 Some(unsafe { intrinsics::unchecked_div(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1833 |  |     }
1834 |  | }
1834 |  | }
     |  |_- in this expansion of `uint_impl!`
    ::: library/core/src/num/mod.rs:157:5
     |
     |
157  | /      uint_impl! { u8, u8, 8, 255, 2, "0x82", "0xa", "0x12", "0x12", "0x48", "[0x12]",
158  | |      "[0x12]", "", "" }
     | |_______________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `intrinsics::unchecked_div` is not yet stable as a const fn
    --> library/core/src/num/uint_macros.rs:535:31
     |
1    |  / macro_rules! uint_impl {
2    |  |     ($SelfT:ty, $ActualT:ty, $BITS:expr, $MaxV:expr,
3    |  |         $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |         $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
535  |  |                 Some(unsafe { intrinsics::unchecked_div(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1833 |  |     }
1834 |  | }
1834 |  | }
     |  |_- in this expansion of `uint_impl!`
    ::: library/core/src/num/mod.rs:656:5
     |
     |
656  | /      uint_impl! { u16, u16, 16, 65535, 4, "0xa003", "0x3a", "0x1234", "0x3412", "0x2c48",
657  | |      "[0x34, 0x12]", "[0x12, 0x34]", "", "" }
     | |_____________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `intrinsics::unchecked_div` is not yet stable as a const fn
    --> library/core/src/num/uint_macros.rs:535:31
     |
1    |  / macro_rules! uint_impl {
2    |  |     ($SelfT:ty, $ActualT:ty, $BITS:expr, $MaxV:expr,
3    |  |         $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |         $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
535  |  |                 Some(unsafe { intrinsics::unchecked_div(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1833 |  |     }
1834 |  | }
1834 |  | }
     |  |_- in this expansion of `uint_impl!`
    ::: library/core/src/num/mod.rs:662:5
     |
     |
662  | /      uint_impl! { u32, u32, 32, 4294967295, 8, "0x10000b3", "0xb301", "0x12345678",
663  | |      "0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]", "[0x12, 0x34, 0x56, 0x78]", "", "" }
     | |_________________________________________________________________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `intrinsics::unchecked_div` is not yet stable as a const fn
    --> library/core/src/num/uint_macros.rs:535:31
     |
1    |  / macro_rules! uint_impl {
2    |  |     ($SelfT:ty, $ActualT:ty, $BITS:expr, $MaxV:expr,
3    |  |         $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |         $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
535  |  |                 Some(unsafe { intrinsics::unchecked_div(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1833 |  |     }
1834 |  | }
1834 |  | }
     |  |_- in this expansion of `uint_impl!`
    ::: library/core/src/num/mod.rs:668:5
     |
     |
668  | /      uint_impl! { u64, u64, 64, 18446744073709551615, 12, "0xaa00000000006e1", "0x6e10aa",
669  | |      "0x1234567890123456", "0x5634129078563412", "0x6a2c48091e6a2c48",
670  | |      "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
671  | |      "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]",
672  | |      "", ""}
     | |____________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `intrinsics::unchecked_div` is not yet stable as a const fn
    --> library/core/src/num/uint_macros.rs:535:31
     |
1    |  / macro_rules! uint_impl {
2    |  |     ($SelfT:ty, $ActualT:ty, $BITS:expr, $MaxV:expr,
3    |  |         $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |         $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
535  |  |                 Some(unsafe { intrinsics::unchecked_div(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1833 |  |     }
1834 |  | }
1834 |  | }
     |  |_- in this expansion of `uint_impl!`
    ::: library/core/src/num/mod.rs:677:5
     |
     |
677  | /      uint_impl! { u128, u128, 128, 340282366920938463463374607431768211455, 16,
678  | |      "0x13f40000000000000000000000004f76", "0x4f7613f4", "0x12345678901234567890123456789012",
679  | |      "0x12907856341290785634129078563412", "0x48091e6a2c48091e6a2c48091e6a2c48",
680  | |      "[0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, \
683  | |        0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12]",
684  | |       "", ""}
     | |_____________- in this macro invocation
     |
     |
     = help: Const-stable functions can only call other const-stable functions

error: `intrinsics::unchecked_div` is not yet stable as a const fn
    --> library/core/src/num/uint_macros.rs:535:31
     |
1    |  / macro_rules! uint_impl {
2    |  |     ($SelfT:ty, $ActualT:ty, $BITS:expr, $MaxV:expr,
3    |  |         $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |         $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
535  |  |                 Some(unsafe { intrinsics::unchecked_div(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1833 |  |     }
1834 |  | }
1834 |  | }
     |  |_- in this expansion of `uint_impl!`
    ::: library/core/src/num/mod.rs:705:5
     |
     |
705  | /      uint_impl! { usize, u64, 64, 18446744073709551615, 12, "0xaa00000000006e1", "0x6e10aa",
706  | |      "0x1234567890123456", "0x5634129078563412", "0x6a2c48091e6a2c48",
707  | |      "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
708  | |       "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]",
709  | |      usize_isize_to_xe_bytes_doc!(), usize_isize_from_xe_bytes_doc!() }
     | |_______________________________________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `intrinsics::unchecked_rem` is not yet stable as a const fn
    --> library/core/src/num/uint_macros.rs:586:31
     |
1    |  / macro_rules! uint_impl {
2    |  |     ($SelfT:ty, $ActualT:ty, $BITS:expr, $MaxV:expr,
3    |  |         $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |         $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
586  |  |                 Some(unsafe { intrinsics::unchecked_rem(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1833 |  |     }
1834 |  | }
1834 |  | }
     |  |_- in this expansion of `uint_impl!`
    ::: library/core/src/num/mod.rs:157:5
     |
     |
157  | /      uint_impl! { u8, u8, 8, 255, 2, "0x82", "0xa", "0x12", "0x12", "0x48", "[0x12]",
158  | |      "[0x12]", "", "" }
     | |_______________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `intrinsics::unchecked_rem` is not yet stable as a const fn
    --> library/core/src/num/uint_macros.rs:586:31
     |
1    |  / macro_rules! uint_impl {
2    |  |     ($SelfT:ty, $ActualT:ty, $BITS:expr, $MaxV:expr,
3    |  |         $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |         $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
586  |  |                 Some(unsafe { intrinsics::unchecked_rem(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1833 |  |     }
1834 |  | }
1834 |  | }
     |  |_- in this expansion of `uint_impl!`
    ::: library/core/src/num/mod.rs:656:5
     |
     |
656  | /      uint_impl! { u16, u16, 16, 65535, 4, "0xa003", "0x3a", "0x1234", "0x3412", "0x2c48",
657  | |      "[0x34, 0x12]", "[0x12, 0x34]", "", "" }
     | |_____________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `intrinsics::unchecked_rem` is not yet stable as a const fn
    --> library/core/src/num/uint_macros.rs:586:31
     |

@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling unwind v0.0.0 (/checkout/library/unwind)
error: attribute should be applied to a macro
    --> library/core/src/num/int_macros.rs:517:9
     |
1    |   / macro_rules! int_impl {
2    |   |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |   |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |   |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...      |
517  |   |         #[allow_internal_unstable(const_int_unchecked_arith)]
     |   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...      |
521  | / |         pub const fn checked_div(self, rhs: Self) -> Option<Self> {
522  | | |             if unlikely!(rhs == 0 || (self == Self::MIN && rhs == -1)) {
523  | | |                 None
524  | | |             } else {
527  | | |             }
528  | | |         }
528  | | |         }
     | |_|_________- not a macro
2009 |   |     }
2010 |   | }
2010 |   | }
     |   |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:91:5
     |
     |
91   | /       int_impl! { i8, i8, u8, 8, -128, 127, 2, "-0x7e", "0xa", "0x12", "0x12", "0x48",
92   | |       "[0x12]", "[0x12]", "", "" }
     | |__________________________________- in this macro invocation
error: attribute should be applied to a macro
    --> library/core/src/num/int_macros.rs:570:9
     |
     |
1    |   / macro_rules! int_impl {
2    |   |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |   |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |   |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...      |
570  |   |         #[allow_internal_unstable(const_int_unchecked_arith)]
     |   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...      |
574  | / |         pub const fn checked_rem(self, rhs: Self) -> Option<Self> {
575  | | |             if unlikely!(rhs == 0 || (self == Self::MIN && rhs == -1)) {
576  | | |                 None
577  | | |             } else {
580  | | |             }
581  | | |         }
581  | | |         }
     | |_|_________- not a macro
2009 |   |     }
2010 |   | }
2010 |   | }
     |   |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:91:5
     |
     |
91   | /       int_impl! { i8, i8, u8, 8, -128, 127, 2, "-0x7e", "0xa", "0x12", "0x12", "0x48",
92   | |       "[0x12]", "[0x12]", "", "" }
     | |__________________________________- in this macro invocation
error: attribute should be applied to a macro
    --> library/core/src/num/int_macros.rs:517:9
     |
     |
1    |   / macro_rules! int_impl {
2    |   |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |   |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |   |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...      |
517  |   |         #[allow_internal_unstable(const_int_unchecked_arith)]
     |   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...      |
521  | / |         pub const fn checked_div(self, rhs: Self) -> Option<Self> {
522  | | |             if unlikely!(rhs == 0 || (self == Self::MIN && rhs == -1)) {
523  | | |                 None
524  | | |             } else {
527  | | |             }
528  | | |         }
528  | | |         }
     | |_|_________- not a macro
2009 |   |     }
2010 |   | }
2010 |   | }
     |   |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:97:5
     |
     |
97   | /       int_impl! { i16, i16, u16, 16, -32768, 32767, 4, "-0x5ffd", "0x3a", "0x1234", "0x3412",
98   | |       "0x2c48", "[0x34, 0x12]", "[0x12, 0x34]", "", "" }
     | |________________________________________________________- in this macro invocation
error: attribute should be applied to a macro
    --> library/core/src/num/int_macros.rs:570:9
     |
     |
1    |   / macro_rules! int_impl {
2    |   |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |   |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |   |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...      |
570  |   |         #[allow_internal_unstable(const_int_unchecked_arith)]
     |   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...      |
574  | / |         pub const fn checked_rem(self, rhs: Self) -> Option<Self> {
575  | | |             if unlikely!(rhs == 0 || (self == Self::MIN && rhs == -1)) {
576  | | |                 None
577  | | |             } else {
580  | | |             }
581  | | |         }
581  | | |         }
     | |_|_________- not a macro
2009 |   |     }
2010 |   | }
2010 |   | }
     |   |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:97:5
     |
     |
97   | /       int_impl! { i16, i16, u16, 16, -32768, 32767, 4, "-0x5ffd", "0x3a", "0x1234", "0x3412",
98   | |       "0x2c48", "[0x34, 0x12]", "[0x12, 0x34]", "", "" }
     | |________________________________________________________- in this macro invocation
error: attribute should be applied to a macro
    --> library/core/src/num/int_macros.rs:517:9
     |
     |
1    |   / macro_rules! int_impl {
2    |   |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |   |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |   |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...      |
517  |   |         #[allow_internal_unstable(const_int_unchecked_arith)]
     |   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...      |
521  | / |         pub const fn checked_div(self, rhs: Self) -> Option<Self> {
522  | | |             if unlikely!(rhs == 0 || (self == Self::MIN && rhs == -1)) {
523  | | |                 None
524  | | |             } else {
527  | | |             }
528  | | |         }
528  | | |         }
     | |_|_________- not a macro
2009 |   |     }
2010 |   | }
2010 |   | }
     |   |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:103:5
     |
     |
103  | /       int_impl! { i32, i32, u32, 32, -2147483648, 2147483647, 8, "0x10000b3", "0xb301",
104  | |       "0x12345678", "0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]",
105  | |       "[0x12, 0x34, 0x56, 0x78]", "", "" }
     | |__________________________________________- in this macro invocation
error: attribute should be applied to a macro
    --> library/core/src/num/int_macros.rs:570:9
     |
     |
1    |   / macro_rules! int_impl {
2    |   |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |   |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |   |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...      |
570  |   |         #[allow_internal_unstable(const_int_unchecked_arith)]
     |   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...      |
574  | / |         pub const fn checked_rem(self, rhs: Self) -> Option<Self> {
575  | | |             if unlikely!(rhs == 0 || (self == Self::MIN && rhs == -1)) {
576  | | |                 None
577  | | |             } else {
580  | | |             }
581  | | |         }
581  | | |         }
     | |_|_________- not a macro
2009 |   |     }
2010 |   | }
2010 |   | }
     |   |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:103:5
     |
     |
103  | /       int_impl! { i32, i32, u32, 32, -2147483648, 2147483647, 8, "0x10000b3", "0xb301",
104  | |       "0x12345678", "0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]",
105  | |       "[0x12, 0x34, 0x56, 0x78]", "", "" }
     | |__________________________________________- in this macro invocation
error: attribute should be applied to a macro
    --> library/core/src/num/int_macros.rs:517:9
     |
     |
1    |   / macro_rules! int_impl {
2    |   |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |   |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |   |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...      |
517  |   |         #[allow_internal_unstable(const_int_unchecked_arith)]
     |   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...      |
521  | / |         pub const fn checked_div(self, rhs: Self) -> Option<Self> {
522  | | |             if unlikely!(rhs == 0 || (self == Self::MIN && rhs == -1)) {
523  | | |                 None
524  | | |             } else {
527  | | |             }
528  | | |         }
528  | | |         }
     | |_|_________- not a macro
2009 |   |     }
2010 |   | }
2010 |   | }
     |   |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:110:5
     |
     |
110  | /       int_impl! { i64, i64, u64, 64, -9223372036854775808, 9223372036854775807, 12,
111  | |       "0xaa00000000006e1", "0x6e10aa", "0x1234567890123456", "0x5634129078563412",
112  | |       "0x6a2c48091e6a2c48", "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
113  | |       "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]", "", "" }
     | |__________________________________________________________________- in this macro invocation
error: attribute should be applied to a macro
    --> library/core/src/num/int_macros.rs:570:9
     |
     |
1    |   / macro_rules! int_impl {
2    |   |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |   |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |   |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...      |
570  |   |         #[allow_internal_unstable(const_int_unchecked_arith)]
     |   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...      |
574  | / |         pub const fn checked_rem(self, rhs: Self) -> Option<Self> {
575  | | |             if unlikely!(rhs == 0 || (self == Self::MIN && rhs == -1)) {
576  | | |                 None
577  | | |             } else {
580  | | |             }
581  | | |         }
581  | | |         }
     | |_|_________- not a macro
2009 |   |     }
2010 |   | }
2010 |   | }
     |   |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:110:5
     |
     |
110  | /       int_impl! { i64, i64, u64, 64, -9223372036854775808, 9223372036854775807, 12,
111  | |       "0xaa00000000006e1", "0x6e10aa", "0x1234567890123456", "0x5634129078563412",
112  | |       "0x6a2c48091e6a2c48", "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
113  | |       "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]", "", "" }
     | |__________________________________________________________________- in this macro invocation
error: attribute should be applied to a macro
    --> library/core/src/num/int_macros.rs:517:9
     |
     |
1    |   / macro_rules! int_impl {
2    |   |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |   |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |   |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...      |
517  |   |         #[allow_internal_unstable(const_int_unchecked_arith)]
     |   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...      |
521  | / |         pub const fn checked_div(self, rhs: Self) -> Option<Self> {
522  | | |             if unlikely!(rhs == 0 || (self == Self::MIN && rhs == -1)) {
523  | | |                 None
524  | | |             } else {
527  | | |             }
528  | | |         }
528  | | |         }
     | |_|_________- not a macro
2009 |   |     }
2010 |   | }
2010 |   | }
     |   |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:118:5
     |
     |
118  | /       int_impl! { i128, i128, u128, 128, -170141183460469231731687303715884105728,
119  | |       170141183460469231731687303715884105727, 16,
120  | |       "0x13f40000000000000000000000004f76", "0x4f7613f4", "0x12345678901234567890123456789012",
121  | |       "0x12907856341290785634129078563412", "0x48091e6a2c48091e6a2c48091e6a2c48",
...    |
124  | |       "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, \
125  | |         0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12]", "", "" }
     | |__________________________________________________________________- in this macro invocation
error: attribute should be applied to a macro
    --> library/core/src/num/int_macros.rs:570:9
     |
     |
1    |   / macro_rules! int_impl {
2    |   |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |   |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |   |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...      |
570  |   |         #[allow_internal_unstable(const_int_unchecked_arith)]
     |   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...      |
574  | / |         pub const fn checked_rem(self, rhs: Self) -> Option<Self> {
575  | | |             if unlikely!(rhs == 0 || (self == Self::MIN && rhs == -1)) {
576  | | |                 None
577  | | |             } else {
580  | | |             }
581  | | |         }
581  | | |         }
     | |_|_________- not a macro
2009 |   |     }
2010 |   | }
2010 |   | }
     |   |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:118:5
     |
     |
118  | /       int_impl! { i128, i128, u128, 128, -170141183460469231731687303715884105728,
119  | |       170141183460469231731687303715884105727, 16,
120  | |       "0x13f40000000000000000000000004f76", "0x4f7613f4", "0x12345678901234567890123456789012",
121  | |       "0x12907856341290785634129078563412", "0x48091e6a2c48091e6a2c48091e6a2c48",
...    |
124  | |       "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, \
125  | |         0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12]", "", "" }
     | |__________________________________________________________________- in this macro invocation
error: attribute should be applied to a macro
    --> library/core/src/num/int_macros.rs:517:9
     |
     |
1    |   / macro_rules! int_impl {
2    |   |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |   |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |   |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...      |
517  |   |         #[allow_internal_unstable(const_int_unchecked_arith)]
     |   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...      |
521  | / |         pub const fn checked_div(self, rhs: Self) -> Option<Self> {
522  | | |             if unlikely!(rhs == 0 || (self == Self::MIN && rhs == -1)) {
523  | | |                 None
524  | | |             } else {
527  | | |             }
528  | | |         }
528  | | |         }
     | |_|_________- not a macro
2009 |   |     }
2010 |   | }
2010 |   | }
     |   |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:148:5
     |
     |
148  | /       int_impl! { isize, i64, usize, 64, -9223372036854775808, 9223372036854775807,
149  | |       12, "0xaa00000000006e1", "0x6e10aa",  "0x1234567890123456", "0x5634129078563412",
150  | |        "0x6a2c48091e6a2c48", "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
151  | |        "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]",
152  | |        usize_isize_to_xe_bytes_doc!(), usize_isize_from_xe_bytes_doc!() }
     | |_________________________________________________________________________- in this macro invocation
error: attribute should be applied to a macro
    --> library/core/src/num/int_macros.rs:570:9
     |
     |
1    |   / macro_rules! int_impl {
2    |   |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |   |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |   |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...      |
570  |   |         #[allow_internal_unstable(const_int_unchecked_arith)]
     |   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...      |
574  | / |         pub const fn checked_rem(self, rhs: Self) -> Option<Self> {
575  | | |             if unlikely!(rhs == 0 || (self == Self::MIN && rhs == -1)) {
576  | | |                 None
577  | | |             } else {
580  | | |             }
581  | | |         }
581  | | |         }
     | |_|_________- not a macro
2009 |   |     }
2010 |   | }
2010 |   | }
     |   |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:148:5
     |
     |
148  | /       int_impl! { isize, i64, usize, 64, -9223372036854775808, 9223372036854775807,
149  | |       12, "0xaa00000000006e1", "0x6e10aa",  "0x1234567890123456", "0x5634129078563412",
150  | |        "0x6a2c48091e6a2c48", "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
151  | |        "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]",
152  | |        usize_isize_to_xe_bytes_doc!(), usize_isize_from_xe_bytes_doc!() }
     | |_________________________________________________________________________- in this macro invocation
error: attribute should be applied to a macro
    --> library/core/src/num/uint_macros.rs:526:9
     |
     |
1    |   / macro_rules! uint_impl {
2    |   |     ($SelfT:ty, $ActualT:ty, $BITS:expr, $MaxV:expr,
3    |   |         $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |   |         $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...      |
526  |   |         #[allow_internal_unstable(const_int_unchecked_arith)]
     |   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...      |
530  | / |         pub const fn checked_div(self, rhs: Self) -> Option<Self> {
531  | | |             if unlikely!(rhs == 0) {
532  | | |                 None
533  | | |             } else {
537  | | |             }
538  | | |         }
538  | | |         }
     | |_|_________- not a macro
1835 |   |     }
1836 |   | }
1836 |   | }
     |   |_- in this expansion of `uint_impl!`
    ::: library/core/src/num/mod.rs:157:5
     |
     |
157  | /       uint_impl! { u8, u8, 8, 255, 2, "0x82", "0xa", "0x12", "0x12", "0x48", "[0x12]",
158  | |       "[0x12]", "", "" }
     | |________________________- in this macro invocation
error: attribute should be applied to a macro
    --> library/core/src/num/uint_macros.rs:578:9
     |
     |
1    |   / macro_rules! uint_impl {
2    |   |     ($SelfT:ty, $ActualT:ty, $BITS:expr, $MaxV:expr,
3    |   |         $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |   |         $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...      |
578  |   |         #[allow_internal_unstable(const_int_unchecked_arith)]
     |   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...      |
582  | / |         pub const fn checked_rem(self, rhs: Self) -> Option<Self> {
583  | | |             if unlikely!(rhs == 0) {
584  | | |                 None
585  | | |             } else {
589  | | |             }
590  | | |         }
590  | | |         }
     | |_|_________- not a macro
1835 |   |     }
1836 |   | }
1836 |   | }
     |   |_- in this expansion of `uint_impl!`
    ::: library/core/src/num/mod.rs:157:5
     |
     |
157  | /       uint_impl! { u8, u8, 8, 255, 2, "0x82", "0xa", "0x12", "0x12", "0x48", "[0x12]",
158  | |       "[0x12]", "", "" }
     | |________________________- in this macro invocation
error: attribute should be applied to a macro
    --> library/core/src/num/uint_macros.rs:526:9
     |
     |
1    |   / macro_rules! uint_impl {
2    |   |     ($SelfT:ty, $ActualT:ty, $BITS:expr, $MaxV:expr,
3    |   |         $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |   |         $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...      |
526  |   |         #[allow_internal_unstable(const_int_unchecked_arith)]
     |   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...      |
530  | / |         pub const fn checked_div(self, rhs: Self) -> Option<Self> {
531  | | |             if unlikely!(rhs == 0) {
532  | | |                 None
533  | | |             } else {
537  | | |             }
538  | | |         }
538  | | |         }
     | |_|_________- not a macro
1835 |   |     }
1836 |   | }
1836 |   | }
     |   |_- in this expansion of `uint_impl!`
    ::: library/core/src/num/mod.rs:656:5
     |
     |
656  | /       uint_impl! { u16, u16, 16, 65535, 4, "0xa003", "0x3a", "0x1234", "0x3412", "0x2c48",
657  | |       "[0x34, 0x12]", "[0x12, 0x34]", "", "" }
     | |______________________________________________- in this macro invocation
error: attribute should be applied to a macro
    --> library/core/src/num/uint_macros.rs:578:9
     |
     |
1    |   / macro_rules! uint_impl {
2    |   |     ($SelfT:ty, $ActualT:ty, $BITS:expr, $MaxV:expr,
3    |   |         $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |   |         $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...      |
578  |   |         #[allow_internal_unstable(const_int_unchecked_arith)]
     |   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...      |
582  | / |         pub const fn checked_rem(self, rhs: Self) -> Option<Self> {
583  | | |             if unlikely!(rhs == 0) {
584  | | |                 None
585  | | |             } else {
589  | | |             }
590  | | |         }
590  | | |         }
     | |_|_________- not a macro
1835 |   |     }
1836 |   | }
1836 |   | }
     |   |_- in this expansion of `uint_impl!`
    ::: library/core/src/num/mod.rs:656:5
     |
     |
656  | /       uint_impl! { u16, u16, 16, 65535, 4, "0xa003", "0x3a", "0x1234", "0x3412", "0x2c48",

@jhpratt
Copy link
Member Author

jhpratt commented Jan 13, 2021

If anyone can let me know what I need to do to avoid errors, that would be great! I see that the #[allow_internal_unstable] isn't allowed on non-macros, but without it, I get an error.

@oli-obk
Copy link
Contributor

oli-obk commented Jan 13, 2021

The attribute you are looking for is rustc_allow_const_fn_unstable, not allow_internal_unstable. We used to use allow_internal_unstable for this, but have moved to a custom attribute.

@jhpratt
Copy link
Member Author

jhpratt commented Jan 13, 2021

Thanks @oli-obk; I'll give that a shot.

Going to hopefully include some more integer methods as well, as it doesn't look like the list on that issue was exhaustive. Just on the off chance someone wants to review this before it's completed.

@oli-obk
Copy link
Contributor

oli-obk commented Jan 13, 2021

cc @rust-lang/wg-const-eval stabilization of lots of inherent methods on integers

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-9 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling libc v0.2.79
   Compiling std v0.0.0 (/checkout/library/std)
   Compiling compiler_builtins v0.1.39
   Compiling unwind v0.0.0 (/checkout/library/unwind)
error: `rustc_allow_const_fn_unstable` expects a list of feature names
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
517  |  |         #[rustc_allow_const_fn_unstable]
     |  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:91:5
     |
     |
91   | /      int_impl! { i8, i8, u8, 8, -128, 127, 2, "-0x7e", "0xa", "0x12", "0x12", "0x48",
92   | |      "[0x12]", "[0x12]", "", "" }
     | |_________________________________- in this macro invocation

error: `intrinsics::unchecked_div` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
526  |  |                 Some(unsafe { intrinsics::unchecked_div(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:91:5
     |
     |
91   | /      int_impl! { i8, i8, u8, 8, -128, 127, 2, "-0x7e", "0xa", "0x12", "0x12", "0x48",
92   | |      "[0x12]", "[0x12]", "", "" }
     | |_________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `rustc_allow_const_fn_unstable` expects a list of feature names
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
517  |  |         #[rustc_allow_const_fn_unstable]
     |  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:97:5
     |
     |
97   | /      int_impl! { i16, i16, u16, 16, -32768, 32767, 4, "-0x5ffd", "0x3a", "0x1234", "0x3412",
98   | |      "0x2c48", "[0x34, 0x12]", "[0x12, 0x34]", "", "" }
     | |_______________________________________________________- in this macro invocation

error: `intrinsics::unchecked_div` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
526  |  |                 Some(unsafe { intrinsics::unchecked_div(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:97:5
     |
     |
97   | /      int_impl! { i16, i16, u16, 16, -32768, 32767, 4, "-0x5ffd", "0x3a", "0x1234", "0x3412",
98   | |      "0x2c48", "[0x34, 0x12]", "[0x12, 0x34]", "", "" }
     | |_______________________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `rustc_allow_const_fn_unstable` expects a list of feature names
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
517  |  |         #[rustc_allow_const_fn_unstable]
     |  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:103:5
     |
     |
103  | /      int_impl! { i32, i32, u32, 32, -2147483648, 2147483647, 8, "0x10000b3", "0xb301",
104  | |      "0x12345678", "0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]",
105  | |      "[0x12, 0x34, 0x56, 0x78]", "", "" }
     | |_________________________________________- in this macro invocation

error: `intrinsics::unchecked_div` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
526  |  |                 Some(unsafe { intrinsics::unchecked_div(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:103:5
     |
     |
103  | /      int_impl! { i32, i32, u32, 32, -2147483648, 2147483647, 8, "0x10000b3", "0xb301",
104  | |      "0x12345678", "0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]",
105  | |      "[0x12, 0x34, 0x56, 0x78]", "", "" }
     | |_________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `rustc_allow_const_fn_unstable` expects a list of feature names
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
517  |  |         #[rustc_allow_const_fn_unstable]
     |  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:110:5
     |
     |
110  | /      int_impl! { i64, i64, u64, 64, -9223372036854775808, 9223372036854775807, 12,
111  | |      "0xaa00000000006e1", "0x6e10aa", "0x1234567890123456", "0x5634129078563412",
112  | |      "0x6a2c48091e6a2c48", "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
113  | |      "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]", "", "" }
     | |_________________________________________________________________- in this macro invocation

error: `intrinsics::unchecked_div` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
526  |  |                 Some(unsafe { intrinsics::unchecked_div(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:110:5
     |
     |
110  | /      int_impl! { i64, i64, u64, 64, -9223372036854775808, 9223372036854775807, 12,
111  | |      "0xaa00000000006e1", "0x6e10aa", "0x1234567890123456", "0x5634129078563412",
112  | |      "0x6a2c48091e6a2c48", "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
113  | |      "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]", "", "" }
     | |_________________________________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `rustc_allow_const_fn_unstable` expects a list of feature names
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
517  |  |         #[rustc_allow_const_fn_unstable]
     |  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:118:5
     |
     |
118  | /      int_impl! { i128, i128, u128, 128, -170141183460469231731687303715884105728,
119  | |      170141183460469231731687303715884105727, 16,
120  | |      "0x13f40000000000000000000000004f76", "0x4f7613f4", "0x12345678901234567890123456789012",
121  | |      "0x12907856341290785634129078563412", "0x48091e6a2c48091e6a2c48091e6a2c48",
...    |
124  | |      "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, \
125  | |        0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12]", "", "" }
     | |_________________________________________________________________- in this macro invocation

error: `intrinsics::unchecked_div` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
526  |  |                 Some(unsafe { intrinsics::unchecked_div(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:118:5
     |
     |
118  | /      int_impl! { i128, i128, u128, 128, -170141183460469231731687303715884105728,
119  | |      170141183460469231731687303715884105727, 16,
120  | |      "0x13f40000000000000000000000004f76", "0x4f7613f4", "0x12345678901234567890123456789012",
121  | |      "0x12907856341290785634129078563412", "0x48091e6a2c48091e6a2c48091e6a2c48",
...    |
124  | |      "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, \
125  | |        0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12]", "", "" }
     | |_________________________________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `rustc_allow_const_fn_unstable` expects a list of feature names
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
517  |  |         #[rustc_allow_const_fn_unstable]
     |  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:148:5
     |
     |
148  | /      int_impl! { isize, i64, usize, 64, -9223372036854775808, 9223372036854775807,
149  | |      12, "0xaa00000000006e1", "0x6e10aa",  "0x1234567890123456", "0x5634129078563412",
150  | |       "0x6a2c48091e6a2c48", "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
151  | |       "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]",
152  | |       usize_isize_to_xe_bytes_doc!(), usize_isize_from_xe_bytes_doc!() }
     | |________________________________________________________________________- in this macro invocation

error: `intrinsics::unchecked_div` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
526  |  |                 Some(unsafe { intrinsics::unchecked_div(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:148:5
     |
     |
148  | /      int_impl! { isize, i64, usize, 64, -9223372036854775808, 9223372036854775807,
149  | |      12, "0xaa00000000006e1", "0x6e10aa",  "0x1234567890123456", "0x5634129078563412",
150  | |       "0x6a2c48091e6a2c48", "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
151  | |       "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]",
152  | |       usize_isize_to_xe_bytes_doc!(), usize_isize_from_xe_bytes_doc!() }
     | |________________________________________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `rustc_allow_const_fn_unstable` expects a list of feature names
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
570  |  |         #[rustc_allow_const_fn_unstable]
     |  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:91:5
     |
     |
91   | /      int_impl! { i8, i8, u8, 8, -128, 127, 2, "-0x7e", "0xa", "0x12", "0x12", "0x48",
92   | |      "[0x12]", "[0x12]", "", "" }
     | |_________________________________- in this macro invocation

error: `intrinsics::unchecked_rem` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
579  |  |                 Some(unsafe { intrinsics::unchecked_rem(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:91:5
     |
     |
91   | /      int_impl! { i8, i8, u8, 8, -128, 127, 2, "-0x7e", "0xa", "0x12", "0x12", "0x48",
92   | |      "[0x12]", "[0x12]", "", "" }
     | |_________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `rustc_allow_const_fn_unstable` expects a list of feature names
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
570  |  |         #[rustc_allow_const_fn_unstable]
     |  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:97:5
     |
     |
97   | /      int_impl! { i16, i16, u16, 16, -32768, 32767, 4, "-0x5ffd", "0x3a", "0x1234", "0x3412",
98   | |      "0x2c48", "[0x34, 0x12]", "[0x12, 0x34]", "", "" }
     | |_______________________________________________________- in this macro invocation

error: `intrinsics::unchecked_rem` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
579  |  |                 Some(unsafe { intrinsics::unchecked_rem(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:97:5
     |
     |
97   | /      int_impl! { i16, i16, u16, 16, -32768, 32767, 4, "-0x5ffd", "0x3a", "0x1234", "0x3412",
98   | |      "0x2c48", "[0x34, 0x12]", "[0x12, 0x34]", "", "" }
     | |_______________________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `rustc_allow_const_fn_unstable` expects a list of feature names
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
570  |  |         #[rustc_allow_const_fn_unstable]
     |  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:103:5
     |
     |
103  | /      int_impl! { i32, i32, u32, 32, -2147483648, 2147483647, 8, "0x10000b3", "0xb301",
104  | |      "0x12345678", "0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]",
105  | |      "[0x12, 0x34, 0x56, 0x78]", "", "" }
     | |_________________________________________- in this macro invocation

error: `intrinsics::unchecked_rem` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
579  |  |                 Some(unsafe { intrinsics::unchecked_rem(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:103:5
     |
     |
103  | /      int_impl! { i32, i32, u32, 32, -2147483648, 2147483647, 8, "0x10000b3", "0xb301",
104  | |      "0x12345678", "0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]",
105  | |      "[0x12, 0x34, 0x56, 0x78]", "", "" }
     | |_________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `rustc_allow_const_fn_unstable` expects a list of feature names
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
570  |  |         #[rustc_allow_const_fn_unstable]
     |  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:110:5
     |
     |
110  | /      int_impl! { i64, i64, u64, 64, -9223372036854775808, 9223372036854775807, 12,
111  | |      "0xaa00000000006e1", "0x6e10aa", "0x1234567890123456", "0x5634129078563412",
112  | |      "0x6a2c48091e6a2c48", "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
113  | |      "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]", "", "" }
     | |_________________________________________________________________- in this macro invocation

error: `intrinsics::unchecked_rem` is not yet stable as a const fn
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
579  |  |                 Some(unsafe { intrinsics::unchecked_rem(self, rhs) })
     |  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:110:5
     |
     |
110  | /      int_impl! { i64, i64, u64, 64, -9223372036854775808, 9223372036854775807, 12,
111  | |      "0xaa00000000006e1", "0x6e10aa", "0x1234567890123456", "0x5634129078563412",
112  | |      "0x6a2c48091e6a2c48", "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
113  | |      "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]", "", "" }
     | |_________________________________________________________________- in this macro invocation
     = help: Const-stable functions can only call other const-stable functions


error: `rustc_allow_const_fn_unstable` expects a list of feature names
     |
     |
1    |  / macro_rules! int_impl {
2    |  |     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
3    |  |      $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
4    |  |      $reversed:expr, $le_bytes:expr, $be_bytes:expr,
...     |
570  |  |         #[rustc_allow_const_fn_unstable]
     |  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2009 |  |     }
2010 |  | }
2010 |  | }
     |  |_- in this expansion of `int_impl!`
    ::: library/core/src/num/mod.rs:118:5
     |
     |
118  | /      int_impl! { i128, i128, u128, 128, -170141183460469231731687303715884105728,
119  | |      170141183460469231731687303715884105727, 16,
120  | |      "0x13f40000000000000000000000004f76", "0x4f7613f4", "0x12345678901234567890123456789012",
121  | |      "0x12907856341290785634129078563412", "0x48091e6a2c48091e6a2c48091e6a2c48",
...    |
124  | |      "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, \
125  | |        0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12]", "", "" }
     | |_________________________________________________________________- in this macro invocation

error: `intrinsics::unchecked_rem` is not yet stable as a const fn
     |

This includes the following functions:
- i*::checked_div
- i*::checked_div_euclid
- i*::checked_rem
- i*::checked_rem_euclid
- i*::div_euclid
- i*::overflowing_div
- i*::overflowing_div_euclid
- i*::overflowing_rem
- i*::overflowing_rem_euclid
- i*::rem_euclid
- i*::wrapping_div
- i*::wrapping_div_euclid
- i*::wrapping_rem
- i*::wrapping_rem_euclid
- u*::checked_div
- u*::checked_div_euclid
- u*::checked_rem
- u*::checked_rem_euclid
- u*::div_euclid
- u*::overflowing_div
- u*::overflowing_div_euclid
- u*::overflowing_rem
- u*::overflowing_rem_euclid
- u*::rem_euclid
- u*::wrapping_div
- u*::wrapping_div_euclid
- u*::wrapping_rem
- u*::wrapping_rem_euclid
@jhpratt
Copy link
Member Author

jhpratt commented Jan 13, 2021

Ok, just pushed up what represents the stabilization of all unstably-const inherent integer methods as const fn. The list at the top of this PR is correct.

Let me know what needs to be changed, if anything! I'd absolutely love to see these methods stabilized as const; it would reduce the amount of code written and increase clarity to anyone reading.

@RalfJung
Copy link
Member

I assume those all have pretty trivial code, so -- no objections from my side (but this is not a review, I hope someone goes through all of these individually and makes sure they are truly trivially CTFE-safe ;).

What seems fishy though is the use of rustc_allow_const_fn_unstable. Haven't we usually avoided this by marking the intrinsic as const-stable?

@jhpratt
Copy link
Member Author

jhpratt commented Jan 13, 2021

Yeah, they're all quite trivial to implement, so I suspect they won't change in the slightest in the future.

I can stabilize the intrinsics as const if desired; I've no idea what is typically done.

@CDirkx
Copy link
Contributor

CDirkx commented Jan 14, 2021

I've looked into stabilizing these methods before, the rustc_allow_const_fn_unstable is indeed not necessary when the intrinsics unchecked_div and unchecked_rem are stabilized. At the time I believed stabilization of these intrinsics was blocked on const_err, but now looking at it I don't think so?

NonZero*::leading_zeros and trailing_zeros are the only remaining const-unstable methods of the non-zero integers, I think they could also be included in this PR.

@jhpratt
Copy link
Member Author

jhpratt commented Jan 14, 2021

@CDirkx The NonZero* methods are unstable, though, whereas all methods so far mentioned are already stable (just not const).

@RalfJung
Copy link
Member

At the time I believed stabilization of these intrinsics was blocked on const_err, but now looking at it I don't think so?

Well, the intrinsics can cause UB. But even if the intrinsics are const-stable, they are still not stable, so they cannot be directly called from stable code -- and the wrappers being stabilized in this PR are all safe.

@jhpratt
Copy link
Member Author

jhpratt commented Jan 14, 2021

Now that you mention that...I recall there being an issue somewhat recently where someone wanted to block something being const stable if it wasn't stable in general. Would the stabilization of these intrinsics as const fall under that? Or is that someone else's problem (in all seriousness)?

@RalfJung
Copy link
Member

Intrinsics are special, almost all of them are unstable and only exposed through other, stable functions.

@jhpratt
Copy link
Member Author

jhpratt commented Jan 14, 2021

I'm aware. Just wasn't sure if declaring an intrinsic const-stable might have unintended side effects down the road (internally).

@RalfJung
Copy link
Member

Well, it's hard to anticipate unanticipated side-effects. ;) It shouldn't have any... right, @oli-obk ?

@oli-obk
Copy link
Contributor

oli-obk commented Jan 14, 2021

Yea the unchecked_div intrinsic can be made const-stable, we already support the equivalent MIR operation and we may want to lower the intrinsic to that primitive operation at some point.

@jhpratt
Copy link
Member Author

jhpratt commented Jan 15, 2021

Went ahead and stabilized the two intrinsics as const.

I can't ping teams as I'm not a member of the rust-lang GitHub org, but this needs lang team approval per comments in the code.

@rustbot modify labels to +T-lang

@rustbot rustbot added the T-lang Relevant to the language team, which will review and decide on the PR/issue. label Jan 15, 2021
@RalfJung
Copy link
Member

These newly-stabilized intrinsics are unsafe, and their UB detection during CTFE is reasonably well-tested in src/test/ui/consts/const-int-unchecked.rs. Anyway that is not even being exposed by this PR, only safe wrappers are.

I think this is ready for FCP by the relevant teams (libs, lang).

@rfcbot rfcbot added to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Feb 8, 2021
@rfcbot
Copy link

rfcbot commented Feb 8, 2021

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

The RFC will be merged soon.

@dtolnay
Copy link
Member

dtolnay commented Feb 8, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Feb 8, 2021

📌 Commit f55029a has been approved by dtolnay

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Feb 8, 2021
@bors
Copy link
Contributor

bors commented Feb 8, 2021

⌛ Testing commit f55029a with merge 4940dd4...

@bors
Copy link
Contributor

bors commented Feb 8, 2021

☀️ Test successful - checks-actions
Approved by: dtolnay
Pushing 4940dd4 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 8, 2021
@bors bors merged commit 4940dd4 into rust-lang:master Feb 8, 2021
@rustbot rustbot added this to the 1.52.0 milestone Feb 8, 2021
@jhpratt
Copy link
Member Author

jhpratt commented Feb 8, 2021

Just seeing the milestone was set to 1.52. Did this miss the cutoff for beta (set to be released this coming Thursday)? If so, the attributes need to be updated in the code.

@RalfJung
Copy link
Member

RalfJung commented Feb 8, 2021

Beta cutoff happens today (always on the Monday before the release, see here). So... this was a race condition.^^

But looking at the beta branch, I think the cutoff did not happen yet, so the Milestone set by the bot is likely wrong. Not sure though. Cc @pietroalbini @Mark-Simulacrum

@jhpratt
Copy link
Member Author

jhpratt commented Feb 8, 2021

Wouldn't this fall under "promote master to beta", which happens on Tuesday? Unless that document is wrong for whatever reason.

@tspiteri
Copy link
Contributor

tspiteri commented Feb 8, 2021

It appears to me the critical moment is the merging of the version bump PR which was opened on Friday (T-6) and merged on Saturday, so that this PR did miss 1.51. :(

Locally, run export BRANCH_POINT=git rev-parse $SHA^ in the rust-lang/rust checkout. This should be bors-authored merge into master of the PR before the version bump merged.

@pietroalbini
Copy link
Member

We changed the release process a couple releases ago, now the cutoff happens on the Friday PR.

@jhpratt
Copy link
Member Author

jhpratt commented Feb 8, 2021

Probably worth updating the process document to avoid confusion.

Should I submit a PR to change these few lines or does someone else want to do it? I don't really care either way; it's obviously a trivial change.

Also cc @dtolnay so you don't approve anything else like this 🙂

@m-ou-se
Copy link
Member

m-ou-se commented Feb 8, 2021

Should I submit a PR to change these few lines

@jhpratt If you want to do that, that'd be useful. Thanks :)

JohnTitor added a commit to JohnTitor/rust that referenced this pull request Feb 10, 2021
… r=jyn514

Bump stabilization version for const int methods

These methods missed the beta cutoff. See rust-lang#80962 for details.

`@rustbot` modify labels to +A-const-fn, +A-intrinsics

r? `@m-ou-se`
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Feb 11, 2021
yvt added a commit to r3-os/r3 that referenced this pull request Feb 19, 2021
`const_checked_int_methods` has been stabilized by
<rust-lang/rust#80962>.
@pthariensflame
Copy link
Contributor

relnotes needed, I think.

@RalfJung RalfJung added the relnotes Marks issues that should be documented in the release notes of the next release. label Apr 6, 2021
wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request May 9, 2021
Package changes:
 * bump bootstraps to 1.51.0.
 * adjust patches and cargo checksums as required
 * 1.51 failed to build natively on 32-bit armv7, there is hope
   that this is fixed with 1.52.  (1.51 can be built with netbsd32
   emulation on a aarch64 system).

Upsteream changes:

Version 1.52.0 (2021-05-06)
============================

Language
--------
- [Added the `unsafe_op_in_unsafe_fn` lint, which checks whether the unsafe
  code in an `unsafe fn` is wrapped in a `unsafe` block.][79208] This lint
  is allowed by default, and may become a warning or hard error in a
  future edition.
- [You can now cast mutable references to arrays to a pointer of the same
  type as the element.][81479]

Compiler
--------
- [Upgraded the default LLVM to LLVM 12.][81451]

Added tier 3\* support for the following targets.

- [`s390x-unknown-linux-musl`][82166]
- [`riscv32gc-unknown-linux-musl` & `riscv64gc-unknown-linux-musl`][82202]
- [`powerpc-unknown-openbsd`][82733]

\* Refer to Rust's [platform support page][platform-support-doc] for more
information on Rust's tiered platform support.

Libraries
---------
- [`OsString` now implements `Extend` and `FromIterator`.][82121]
- [`cmp::Reverse` now has `#[repr(transparent)]` representation.][81879]
- [`Arc<impl Error>` now implements `error::Error`.][80553]
- [All integer division and remainder operations are now `const`.][80962]

Stabilised APIs
-------------
- [`Arguments::as_str`]
- [`char::MAX`]
- [`char::REPLACEMENT_CHARACTER`]
- [`char::UNICODE_VERSION`]
- [`char::decode_utf16`]
- [`char::from_digit`]
- [`char::from_u32_unchecked`]
- [`char::from_u32`]
- [`slice::partition_point`]
- [`str::rsplit_once`]
- [`str::split_once`]

The following previously stable APIs are now `const`.

- [`char::len_utf8`]
- [`char::len_utf16`]
- [`char::to_ascii_uppercase`]
- [`char::to_ascii_lowercase`]
- [`char::eq_ignore_ascii_case`]
- [`u8::to_ascii_uppercase`]
- [`u8::to_ascii_lowercase`]
- [`u8::eq_ignore_ascii_case`]

Rustdoc
-------
- [Rustdoc lints are now treated as a tool lint, meaning that lints are
  now prefixed with `rustdoc::`
  (e.g. `#[warn(rustdoc::non_autolinks)]`).][80527]

  Using the old style is still allowed, and will become a warning in
  a future release.
- [Rustdoc now supports argument files.][82261]
- [Rustdoc now generates smart punctuation for documentation.][79423]
- [You can now use "task lists" in Rustdoc Markdown.][81766] E.g.
  ```markdown
  - [x] Complete
  - [ ] Todo
  ```

Misc
----
- [You can now pass multiple filters to tests.][81356] E.g.
  `cargo test -- foo bar` will run all tests that match `foo` and `bar`.
- [Rustup now distributes PDB symbols for the `std` library on Windows,
  allowing you to see `std` symbols when debugging.][82218]

Internal Only
-------------
These changes provide no direct user facing benefits, but represent significant
improvements to the internals and overall performance of rustc and
related tools.

- [Check the result cache before the DepGraph when ensuring queries][81855]
- [Try fast_reject::simplify_type in coherence before doing full check][81744]
- [Only store a LocalDefId in some HIR nodes][81611]
- [Store HIR attributes in a side table][79519]

Compatibility Notes
-------------------
- [Cargo build scripts are now forbidden from setting `RUSTC_BOOTSTRAP`.]
  [cargo/9181]
- [Removed support for the `x86_64-rumprun-netbsd` target.][82594]
- [Deprecated the `x86_64-sun-solaris` target in favor of `x86_64-pc-solaris`.]
  [82216]
- [Rustdoc now only accepts `,`, ` `, and `\t` as delimiters for specifying
  languages in code blocks.][78429]
- [Rustc now catches more cases of `pub_use_of_private_extern_crate`][80763]
- [Changes in how proc macros handle whitespace may lead to panics when used
  with older `proc-macro-hack` versions. A `cargo update` should be sufficient
  to fix this in all cases.][84136]

[84136]: rust-lang/rust#84136
[80763]: rust-lang/rust#80763
[82166]: rust-lang/rust#82166
[82121]: rust-lang/rust#82121
[81879]: rust-lang/rust#81879
[82261]: rust-lang/rust#82261
[82218]: rust-lang/rust#82218
[82216]: rust-lang/rust#82216
[82202]: rust-lang/rust#82202
[81855]: rust-lang/rust#81855
[81766]: rust-lang/rust#81766
[81744]: rust-lang/rust#81744
[81611]: rust-lang/rust#81611
[81479]: rust-lang/rust#81479
[81451]: rust-lang/rust#81451
[81356]: rust-lang/rust#81356
[80962]: rust-lang/rust#80962
[80553]: rust-lang/rust#80553
[80527]: rust-lang/rust#80527
[79519]: rust-lang/rust#79519
[79423]: rust-lang/rust#79423
[79208]: rust-lang/rust#79208
[78429]: rust-lang/rust#78429
[82733]: rust-lang/rust#82733
[82594]: rust-lang/rust#82594
[cargo/9181]: rust-lang/cargo#9181
[`char::MAX`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.MAX
[`char::REPLACEMENT_CHARACTER`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.REPLACEMENT_CHARACTER
[`char::UNICODE_VERSION`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.UNICODE_VERSION
[`char::decode_utf16`]: https://doc.rust-lang.org/std/primitive.char.html#method.decode_utf16
[`char::from_u32`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_u32
[`char::from_u32_unchecked`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_u32_unchecked
[`char::from_digit`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_digit
[`Peekable::next_if`]: https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html#method.next_if
[`Peekable::next_if_eq`]: https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html#method.next_if_eq
[`Arguments::as_str`]: https://doc.rust-lang.org/stable/std/fmt/struct.Arguments.html#method.as_str
[`str::split_once`]: https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_once
[`str::rsplit_once`]: https://doc.rust-lang.org/stable/std/primitive.str.html#method.rsplit_once
[`slice::partition_point`]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.partition_point
[`char::len_utf8`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.len_utf8
[`char::len_utf16`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.len_utf16
[`char::to_ascii_uppercase`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.to_ascii_uppercase
[`char::to_ascii_lowercase`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.to_ascii_lowercase
[`char::eq_ignore_ascii_case`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.eq_ignore_ascii_case
[`u8::to_ascii_uppercase`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.to_ascii_uppercase
[`u8::to_ascii_lowercase`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.to_ascii_lowercase
[`u8::eq_ignore_ascii_case`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.eq_ignore_ascii_case
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request May 31, 2021
Pkgsrc changes:
 * Bump bootstrap kit version to 1.51.0.
 * Adjust patches as needed.
 * Update checksum adjustments.
 * Fix syntax error in commands adjusting libserde_derive for Darwin

Upstream changes:

Version 1.52.1 (2021-05-10)
============================

This release disables incremental compilation, unless the user has explicitly
opted in via the newly added RUSTC_FORCE_INCREMENTAL=1 environment variable.

This is due to the widespread, and frequently occuring, breakage encountered by
Rust users due to newly enabled incremental verification in 1.52.0. Notably,
Rust users **should** upgrade to 1.52.0 or 1.52.1: the bugs that are detected by
newly added incremental verification are still present in past stable versions,
and are not yet fixed on any channel. These bugs can lead to miscompilation of
Rust binaries.

These problems only affect incremental builds, so release builds with Cargo
should not be affected unless the user has explicitly opted into incremental.
Debug and check builds are affected.

See [84970] for more details.

[84970]: rust-lang/rust#84970

Version 1.52.0 (2021-05-06)
============================

Language
--------
- [Added the `unsafe_op_in_unsafe_fn` lint, which checks whether
  the unsafe code in an `unsafe fn` is wrapped in a `unsafe`
  block.][79208] This lint is allowed by default, and may become
  a warning or hard error in a future edition.

- [You can now cast mutable references to arrays to a pointer of
  the same type as the element.][81479]

Compiler
--------
- [Upgraded the default LLVM to LLVM 12.][81451]

Added tier 3\* support for the following targets.

- [`s390x-unknown-linux-musl`][82166]
- [`riscv32gc-unknown-linux-musl` & `riscv64gc-unknown-linux-musl`][82202]
- [`powerpc-unknown-openbsd`][82733]

\* Refer to Rust's [platform support page][platform-support-doc] for more
information on Rust's tiered platform support.

Libraries
---------
- [`OsString` now implements `Extend` and `FromIterator`.][82121]
- [`cmp::Reverse` now has `#[repr(transparent)]` representation.][81879]
- [`Arc<impl Error>` now implements `error::Error`.][80553]
- [All integer division and remainder operations are now `const`.][80962]

Stabilised APIs
-------------
- [`Arguments::as_str`]
- [`char::MAX`]
- [`char::REPLACEMENT_CHARACTER`]
- [`char::UNICODE_VERSION`]
- [`char::decode_utf16`]
- [`char::from_digit`]
- [`char::from_u32_unchecked`]
- [`char::from_u32`]
- [`slice::partition_point`]
- [`str::rsplit_once`]
- [`str::split_once`]

The following previously stable APIs are now `const`.

- [`char::len_utf8`]
- [`char::len_utf16`]
- [`char::to_ascii_uppercase`]
- [`char::to_ascii_lowercase`]
- [`char::eq_ignore_ascii_case`]
- [`u8::to_ascii_uppercase`]
- [`u8::to_ascii_lowercase`]
- [`u8::eq_ignore_ascii_case`]

Rustdoc
-------
- [Rustdoc lints are now treated as a tool lint, meaning that
  lints are now prefixed with `rustdoc::` (e.g.
  `#[warn(rustdoc::non_autolinks)]`).][80527] Using the old style
  is still allowed, and will become a warning in a future release.
- [Rustdoc now supports argument files.][82261]
- [Rustdoc now generates smart punctuation for documentation.][79423]
- [You can now use "task lists" in Rustdoc Markdown.][81766] E.g.
  ```markdown
  - [x] Complete
  - [ ] Todo
  ```

Misc
----
- [You can now pass multiple filters to tests.][81356] E.g.
  `cargo test -- foo bar` will run all tests that match `foo` and `bar`.
- [Rustup now distributes PDB symbols for the `std` library on Windows,
  allowing you to see `std` symbols when debugging.][82218]

Internal Only
-------------
These changes provide no direct user facing benefits, but represent significant
improvements to the internals and overall performance of rustc and
related tools.

- [Check the result cache before the DepGraph when ensuring queries][81855]
- [Try fast_reject::simplify_type in coherence before doing full check][81744]
- [Only store a LocalDefId in some HIR nodes][81611]
- [Store HIR attributes in a side table][79519]

Compatibility Notes
-------------------
- [Cargo build scripts are now forbidden from setting
  `RUSTC_BOOTSTRAP`.][cargo/9181]
- [Removed support for the `x86_64-rumprun-netbsd` target.][82594]
- [Deprecated the `x86_64-sun-solaris` target in favor of
  `x86_64-pc-solaris`.][82216]
- [Rustdoc now only accepts `,`, ` `, and `\t` as delimiters for specifying
  languages in code blocks.][78429]
- [Rustc now catches more cases of `pub_use_of_private_extern_crate`][80763]
- [Changes in how proc macros handle whitespace may lead to panics
  when used with older `proc-macro-hack` versions. A `cargo update` should
  be sufficient to fix this in all cases.][84136]

[84136]: rust-lang/rust#84136
[80763]: rust-lang/rust#80763
[82166]: rust-lang/rust#82166
[82121]: rust-lang/rust#82121
[81879]: rust-lang/rust#81879
[82261]: rust-lang/rust#82261
[82218]: rust-lang/rust#82218
[82216]: rust-lang/rust#82216
[82202]: rust-lang/rust#82202
[81855]: rust-lang/rust#81855
[81766]: rust-lang/rust#81766
[81744]: rust-lang/rust#81744
[81611]: rust-lang/rust#81611
[81479]: rust-lang/rust#81479
[81451]: rust-lang/rust#81451
[81356]: rust-lang/rust#81356
[80962]: rust-lang/rust#80962
[80553]: rust-lang/rust#80553
[80527]: rust-lang/rust#80527
[79519]: rust-lang/rust#79519
[79423]: rust-lang/rust#79423
[79208]: rust-lang/rust#79208
[78429]: rust-lang/rust#78429
[82733]: rust-lang/rust#82733
[82594]: rust-lang/rust#82594
[cargo/9181]: rust-lang/cargo#9181
[`char::MAX`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.MAX
[`char::REPLACEMENT_CHARACTER`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.REPLACEMENT_CHARACTER
[`char::UNICODE_VERSION`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.UNICODE_VERSION
[`char::decode_utf16`]: https://doc.rust-lang.org/std/primitive.char.html#method.decode_utf16
[`char::from_u32`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_u32
[`char::from_u32_unchecked`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_u32_unchecked
[`char::from_digit`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_digit
[`Peekable::next_if`]: https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html#method.next_if
[`Peekable::next_if_eq`]: https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html#method.next_if_eq
[`Arguments::as_str`]: https://doc.rust-lang.org/stable/std/fmt/struct.Arguments.html#method.as_str
[`str::split_once`]: https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_once
[`str::rsplit_once`]: https://doc.rust-lang.org/stable/std/primitive.str.html#method.rsplit_once
[`slice::partition_point`]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.partition_point
[`char::len_utf8`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.len_utf8
[`char::len_utf16`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.len_utf16
[`char::to_ascii_uppercase`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.to_ascii_uppercase
[`char::to_ascii_lowercase`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.to_ascii_lowercase
[`char::eq_ignore_ascii_case`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.eq_ignore_ascii_case
[`u8::to_ascii_uppercase`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.to_ascii_uppercase
[`u8::to_ascii_lowercase`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.to_ascii_lowercase
[`u8::eq_ignore_ascii_case`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.eq_ignore_ascii_case
@dtolnay dtolnay self-assigned this Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. merged-by-bors This PR was explicitly merged by bors. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. T-lang Relevant to the language team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking Issue for more const int functions