Const-stabilize some arithmetic intrinsics
This commit is contained in:
@@ -1305,9 +1305,11 @@ extern "rust-intrinsic" {
|
|||||||
|
|
||||||
/// Performs an unchecked division, resulting in undefined behavior
|
/// Performs an unchecked division, resulting in undefined behavior
|
||||||
/// where y = 0 or x = `T::min_value()` and y = -1
|
/// 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;
|
pub fn unchecked_div<T>(x: T, y: T) -> T;
|
||||||
/// Returns the remainder of an unchecked division, resulting in
|
/// Returns the remainder of an unchecked division, resulting in
|
||||||
/// undefined behavior where y = 0 or x = `T::min_value()` and y = -1
|
/// 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;
|
pub fn unchecked_rem<T>(x: T, y: T) -> T;
|
||||||
|
|
||||||
/// Performs an unchecked left shift, resulting in undefined behavior when
|
/// 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
|
/// Returns the result of an unchecked addition, resulting in
|
||||||
/// undefined behavior when `x + y > T::max_value()` or `x + y < T::min_value()`.
|
/// 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;
|
pub fn unchecked_add<T>(x: T, y: T) -> T;
|
||||||
|
|
||||||
/// Returns the result of an unchecked subtraction, resulting in
|
/// Returns the result of an unchecked subtraction, resulting in
|
||||||
/// undefined behavior when `x - y > T::max_value()` or `x - y < T::min_value()`.
|
/// 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;
|
pub fn unchecked_sub<T>(x: T, y: T) -> T;
|
||||||
|
|
||||||
/// Returns the result of an unchecked multiplication, resulting in
|
/// Returns the result of an unchecked multiplication, resulting in
|
||||||
/// undefined behavior when `x * y > T::max_value()` or `x * y < T::min_value()`.
|
/// 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;
|
pub fn unchecked_mul<T>(x: T, y: T) -> T;
|
||||||
|
|
||||||
/// Performs rotate left.
|
/// Performs rotate left.
|
||||||
|
|||||||
@@ -76,6 +76,7 @@
|
|||||||
#![feature(const_int_euclidean)]
|
#![feature(const_int_euclidean)]
|
||||||
#![feature(const_int_overflowing)]
|
#![feature(const_int_overflowing)]
|
||||||
#![feature(const_int_saturating)]
|
#![feature(const_int_saturating)]
|
||||||
|
#![feature(const_int_unchecked_arith)]
|
||||||
#![feature(const_panic)]
|
#![feature(const_panic)]
|
||||||
#![feature(const_fn_union)]
|
#![feature(const_fn_union)]
|
||||||
#![feature(const_generics)]
|
#![feature(const_generics)]
|
||||||
|
|||||||
Reference in New Issue
Block a user