stabilize const_int_rotate

This commit is contained in:
Mazdak Farrokhzad 2018-12-24 19:24:48 +01:00
parent 7e7c337aef
commit e258489eae
3 changed files with 12 additions and 10 deletions

View File

@ -113,7 +113,7 @@
#![feature(const_slice_len)]
#![feature(const_str_as_bytes)]
#![feature(const_str_len)]
#![feature(const_int_rotate)]
#![cfg_attr(stage0, feature(const_int_rotate))]
#![feature(const_int_sign)]
#![feature(const_int_conversion)]
#![feature(const_transmute)]

View File

@ -357,7 +357,7 @@ let m = ", $rot_result, ";
assert_eq!(n.rotate_left(", $rot, "), m);
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_int_rotate")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_rotate"))]
#[inline]
pub const fn rotate_left(self, n: u32) -> Self {
(self as $UnsignedT).rotate_left(n) as Self
@ -382,7 +382,7 @@ let m = ", $rot_op, ";
assert_eq!(n.rotate_right(", $rot, "), m);
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_int_rotate")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_rotate"))]
#[inline]
pub const fn rotate_right(self, n: u32) -> Self {
(self as $UnsignedT).rotate_right(n) as Self
@ -2310,7 +2310,7 @@ let m = ", $rot_result, ";
assert_eq!(n.rotate_left(", $rot, "), m);
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_int_rotate")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_rotate"))]
#[inline]
pub const fn rotate_left(self, n: u32) -> Self {
unsafe { intrinsics::rotate_left(self, n as $SelfT) }
@ -2335,7 +2335,7 @@ let m = ", $rot_op, ";
assert_eq!(n.rotate_right(", $rot, "), m);
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_int_rotate")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_rotate"))]
#[inline]
pub const fn rotate_right(self, n: u32) -> Self {
unsafe { intrinsics::rotate_right(self, n as $SelfT) }

View File

@ -396,11 +396,13 @@ fn is_intrinsic_whitelisted(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool
| "min_align_of"
| "needs_drop"
// Arithmetic:
| "overflowing_add" // ~> wrapping_add
| "overflowing_sub" // ~> wrapping_sub
| "overflowing_mul" // ~> wrapping_mul
| "unchecked_shl" // ~> wrapping_shl
| "unchecked_shr" // ~> wrapping_shr
| "overflowing_add" // ~> .wrapping_add
| "overflowing_sub" // ~> .wrapping_sub
| "overflowing_mul" // ~> .wrapping_mul
| "unchecked_shl" // ~> .wrapping_shl
| "unchecked_shr" // ~> .wrapping_shr
| "rotate_left" // ~> .rotate_left
| "rotate_right" // ~> .rotate_right
=> true,
_ => false,
}