]> git.lizzy.rs Git - rust.git/commitdiff
Const-stabilize some arithmetic intrinsics
authorDylan MacKenzie <ecstaticmorse@gmail.com>
Mon, 3 Feb 2020 20:49:31 +0000 (12:49 -0800)
committerDylan MacKenzie <ecstaticmorse@gmail.com>
Tue, 4 Feb 2020 19:04:04 +0000 (11:04 -0800)
src/libcore/intrinsics.rs
src/libcore/lib.rs

index 416c73f50bd89661bab7cfa0d0609563dbd91bd8..2cee23a5c752c9d3ef93193870a01b7992b730aa 100644 (file)
 
     /// 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
 
     /// 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.
index 76e3d0d32997fb382a360b9e59998c7562a69bf6..b5baa42fdb3fcd45f852478933b3003adabe41e2 100644 (file)
@@ -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)]