about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-03-23 09:27:06 -0500
committerGitHub <noreply@github.com>2018-03-23 09:27:06 -0500
commit7cf4cb5a7be38fcb3831204eb32ad6e2ef0a9e25 (patch)
tree9997fb91ff9e2a46755aabf8fb2ae2c141eae380 /src/libstd
parent55e1104dd918a809d2751d325c11d59c85485a2e (diff)
parenta23f685296b2edd59acc998411340184b958ec82 (diff)
downloadrust-7cf4cb5a7be38fcb3831204eb32ad6e2ef0a9e25.tar.gz
rust-7cf4cb5a7be38fcb3831204eb32ad6e2ef0a9e25.zip
Rollup merge of #48265 - SimonSapin:nonzero, r=KodrAus
Add 12 num::NonZero* types for primitive integers, deprecate core::nonzero

RFC: https://github.com/rust-lang/rfcs/pull/2307
Tracking issue: ~~https://github.com/rust-lang/rust/issues/27730~~ https://github.com/rust-lang/rust/issues/49137
Fixes https://github.com/rust-lang/rust/issues/27730
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 62bef4bc499..36eb7291822 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 33d70538522..6f537fd5c50 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 = "49137")]
+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 = "49137")]
+pub use core::num::{NonZeroU128, NonZeroI128};
+
 #[cfg(test)] use fmt;
 #[cfg(test)] use ops::{Add, Sub, Mul, Div, Rem};