]> git.lizzy.rs Git - rust.git/blobdiff - src/libcore/nonzero.rs
Auto merge of #35856 - phimuemue:master, r=brson
[rust.git] / src / libcore / nonzero.rs
index c4ca3fa384e968cfe7734df57b8aa52108418ea6..47afaf77353ee42803a246a61d1bc98a64bb9ef1 100644 (file)
@@ -13,7 +13,6 @@
             reason = "needs an RFC to flesh out the design",
             issue = "27730")]
 
-use marker::Sized;
 use ops::{CoerceUnsized, Deref};
 
 /// Unsafe trait to indicate what types are usable with the NonZero struct
@@ -38,31 +37,13 @@ unsafe impl Zeroable for u64 {}
 #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
 pub struct NonZero<T: Zeroable>(T);
 
-#[cfg(stage0)]
-macro_rules! nonzero_new {
-    () => (
-        /// Creates an instance of NonZero with the provided value.
-        /// You must indeed ensure that the value is actually "non-zero".
-        #[inline(always)]
-        pub unsafe fn new(inner: T) -> NonZero<T> {
-            NonZero(inner)
-        }
-    )
-}
-#[cfg(not(stage0))]
-macro_rules! nonzero_new {
-    () => (
-        /// Creates an instance of NonZero with the provided value.
-        /// You must indeed ensure that the value is actually "non-zero".
-        #[inline(always)]
-        pub const unsafe fn new(inner: T) -> NonZero<T> {
-            NonZero(inner)
-        }
-    )
-}
-
 impl<T: Zeroable> NonZero<T> {
-    nonzero_new!{}
+    /// Creates an instance of NonZero with the provided value.
+    /// You must indeed ensure that the value is actually "non-zero".
+    #[inline(always)]
+    pub const unsafe fn new(inner: T) -> NonZero<T> {
+        NonZero(inner)
+    }
 }
 
 impl<T: Zeroable> Deref for NonZero<T> {