Skip to content

Commit d4529be

Browse files
Const-stabilize some arithmetic intrinsics
1 parent b46d1d2 commit d4529be

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/libcore/intrinsics.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,9 +1305,11 @@ extern "rust-intrinsic" {
13051305

13061306
/// Performs an unchecked division, resulting in undefined behavior
13071307
/// where y = 0 or x = `T::min_value()` and y = -1
1308+
#[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")]
13081309
pub fn unchecked_div<T>(x: T, y: T) -> T;
13091310
/// Returns the remainder of an unchecked division, resulting in
13101311
/// undefined behavior where y = 0 or x = `T::min_value()` and y = -1
1312+
#[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")]
13111313
pub fn unchecked_rem<T>(x: T, y: T) -> T;
13121314

13131315
/// Performs an unchecked left shift, resulting in undefined behavior when
@@ -1321,14 +1323,17 @@ extern "rust-intrinsic" {
13211323

13221324
/// Returns the result of an unchecked addition, resulting in
13231325
/// undefined behavior when `x + y > T::max_value()` or `x + y < T::min_value()`.
1326+
#[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")]
13241327
pub fn unchecked_add<T>(x: T, y: T) -> T;
13251328

13261329
/// Returns the result of an unchecked subtraction, resulting in
13271330
/// undefined behavior when `x - y > T::max_value()` or `x - y < T::min_value()`.
1331+
#[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")]
13281332
pub fn unchecked_sub<T>(x: T, y: T) -> T;
13291333

13301334
/// Returns the result of an unchecked multiplication, resulting in
13311335
/// undefined behavior when `x * y > T::max_value()` or `x * y < T::min_value()`.
1336+
#[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")]
13321337
pub fn unchecked_mul<T>(x: T, y: T) -> T;
13331338

13341339
/// Performs rotate left.

src/libcore/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
#![feature(const_int_euclidean)]
7777
#![feature(const_int_overflowing)]
7878
#![feature(const_int_saturating)]
79+
#![feature(const_int_unchecked_arith)]
7980
#![feature(const_panic)]
8081
#![feature(const_fn_union)]
8182
#![feature(const_generics)]

0 commit comments

Comments
 (0)