diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-02-03 12:49:31 -0800 |
|---|---|---|
| committer | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-02-04 11:04:04 -0800 |
| commit | d4529bec02f5e61a6684ee8ffc40d84d35c23242 (patch) | |
| tree | 7cae8ba3fc059c36108ba84b686eec81dd004eff | |
| parent | b46d1d27184bf78cc9181feadd192e887fe7d589 (diff) | |
| download | rust-d4529bec02f5e61a6684ee8ffc40d84d35c23242.tar.gz rust-d4529bec02f5e61a6684ee8ffc40d84d35c23242.zip | |
Const-stabilize some arithmetic intrinsics
| -rw-r--r-- | src/libcore/intrinsics.rs | 5 | ||||
| -rw-r--r-- | src/libcore/lib.rs | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 416c73f50bd..2cee23a5c75 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -1305,9 +1305,11 @@ extern "rust-intrinsic" { /// Performs an unchecked division, resulting in undefined behavior /// where y = 0 or x = `T::min_value()` and y = -1 + #[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")] pub fn unchecked_div<T>(x: T, y: T) -> T; /// Returns the remainder of an unchecked division, resulting in /// undefined behavior where y = 0 or x = `T::min_value()` and y = -1 + #[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")] pub fn unchecked_rem<T>(x: T, y: T) -> T; /// Performs an unchecked left shift, resulting in undefined behavior when @@ -1321,14 +1323,17 @@ extern "rust-intrinsic" { /// Returns the result of an unchecked addition, resulting in /// undefined behavior when `x + y > T::max_value()` or `x + y < T::min_value()`. + #[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")] pub fn unchecked_add<T>(x: T, y: T) -> T; /// Returns the result of an unchecked subtraction, resulting in /// undefined behavior when `x - y > T::max_value()` or `x - y < T::min_value()`. + #[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")] pub fn unchecked_sub<T>(x: T, y: T) -> T; /// Returns the result of an unchecked multiplication, resulting in /// undefined behavior when `x * y > T::max_value()` or `x * y < T::min_value()`. + #[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")] pub fn unchecked_mul<T>(x: T, y: T) -> T; /// Performs rotate left. diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 76e3d0d3299..b5baa42fdb3 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -76,6 +76,7 @@ #![feature(const_int_euclidean)] #![feature(const_int_overflowing)] #![feature(const_int_saturating)] +#![feature(const_int_unchecked_arith)] #![feature(const_panic)] #![feature(const_fn_union)] #![feature(const_generics)] |
