about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2018-02-16 10:39:24 +0100
committerSimon Sapin <simon.sapin@exyr.org>2018-03-17 23:07:38 +0100
commitf40877feeb17c538a73fe6294d48af123251a8c5 (patch)
treea7853aec22faf794f39b4cb3093dd65d443642b9 /src/libstd
parentadf2135adc4a65a78ba053f04c29d7fe0468eb87 (diff)
Add 12 num::NonZero* types for each primitive integer
RFC: https://github.com/rust-lang/rfcs/pull/2307
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/lib.rs1
-rw-r--r--src/libstd/num.rs11
2 files changed, 12 insertions, 0 deletions
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index 70a1f82c9a1..5c0a83fde10 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -282,6 +282,7 @@
 #![feature(macro_vis_matcher)]
 #![feature(needs_panic_runtime)]
 #![feature(exhaustive_patterns)]
+#![feature(nonzero)]
 #![feature(num_bits_bytes)]
 #![feature(old_wrapping)]
 #![feature(on_unimplemented)]
diff --git a/src/libstd/num.rs b/src/libstd/num.rs
index a2c133954a3..5e0406ca220 100644
--- a/src/libstd/num.rs
+++ b/src/libstd/num.rs
@@ -21,6 +21,17 @@ pub use core::num::{FpCategory, ParseIntError, ParseFloatError, TryFromIntError}
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use core::num::Wrapping;
 
+#[unstable(feature = "nonzero", issue = "27730")]
+pub use core::num::{
+    NonZeroU8, NonZeroI8, NonZeroU16, NonZeroI16, NonZeroU32, NonZeroI32,
+    NonZeroU64, NonZeroI64, NonZeroUsize, NonZeroIsize,
+};
+
+// Change this to `#[unstable(feature = "i128", issue = "35118")]`
+// if other NonZero* integer types are stabilizied before 128-bit integers
+#[unstable(feature = "nonzero", issue = "27730")]
+pub use core::num::{NonZeroU128, NonZeroI128};
+
 #[cfg(test)] use fmt;
 #[cfg(test)] use ops::{Add, Sub, Mul, Div, Rem};