diff options
Diffstat (limited to 'src/libcore/nonzero.rs')
| -rw-r--r-- | src/libcore/nonzero.rs | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/src/libcore/nonzero.rs b/src/libcore/nonzero.rs index c4ca3fa384e..92bbc4efb7c 100644 --- a/src/libcore/nonzero.rs +++ b/src/libcore/nonzero.rs @@ -38,31 +38,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> { |
