]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #50808 - SimonSapin:nonzero, r=alexcrichton
authorkennytm <kennytm@gmail.com>
Wed, 16 May 2018 19:07:52 +0000 (03:07 +0800)
committerkennytm <kennytm@gmail.com>
Wed, 16 May 2018 21:18:21 +0000 (05:18 +0800)
Stabilize num::NonZeroU*

Tracking issue: https://github.com/rust-lang/rust/issues/49137

1  2 
src/libcore/num/mod.rs
src/librustc_data_structures/lib.rs

diff --combined src/libcore/num/mod.rs
index a1168d74e4b52a2ff02b78eda6da1a5414f5e8a3,ae8b3087240b8ee5f3b8a213177bbf62c5e95356..6df8ca98ba92c45976fa477b31ae53660891a9d3
@@@ -16,15 -16,14 +16,14 @@@ use convert::TryFrom
  use fmt;
  use intrinsics;
  use mem;
#[allow(deprecated)] use nonzero::NonZero;
+ use nonzero::NonZero;
  use ops;
  use str::FromStr;
  
  macro_rules! impl_nonzero_fmt {
-     ( #[$stability: meta] ( $( $Trait: ident ),+ ) for $Ty: ident ) => {
+     ( ( $( $Trait: ident ),+ ) for $Ty: ident ) => {
          $(
-             #[$stability]
-             #[allow(deprecated)]
+             #[stable(feature = "nonzero", since = "1.28.0")]
              impl fmt::$Trait for $Ty {
                  #[inline]
                  fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@@ -36,7 -35,7 +35,7 @@@
  }
  
  macro_rules! nonzero_integers {
-     ( #[$stability: meta] #[$deprecation: meta] $( $Ty: ident($Int: ty); )+ ) => {
+     ( $( $Ty: ident($Int: ty); )+ ) => {
          $(
              /// An integer that is known not to equal zero.
              ///
              /// use std::mem::size_of;
              /// assert_eq!(size_of::<Option<std::num::NonZeroU32>>(), size_of::<u32>());
              /// ```
-             #[$stability]
-             #[$deprecation]
-             #[allow(deprecated)]
+             #[stable(feature = "nonzero", since = "1.28.0")]
              #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
              pub struct $Ty(NonZero<$Int>);
  
-             #[allow(deprecated)]
              impl $Ty {
                  /// Create a non-zero without checking the value.
                  ///
                  /// # Safety
                  ///
                  /// The value must not be zero.
-                 #[$stability]
+                 #[stable(feature = "nonzero", since = "1.28.0")]
                  #[inline]
                  pub const unsafe fn new_unchecked(n: $Int) -> Self {
                      $Ty(NonZero(n))
                  }
  
                  /// Create a non-zero if the given value is not zero.
-                 #[$stability]
+                 #[stable(feature = "nonzero", since = "1.28.0")]
                  #[inline]
                  pub fn new(n: $Int) -> Option<Self> {
                      if n != 0 {
@@@ -78,7 -74,7 +74,7 @@@
                  }
  
                  /// Returns the value as a primitive type.
-                 #[$stability]
+                 #[stable(feature = "nonzero", since = "1.28.0")]
                  #[inline]
                  pub fn get(self) -> $Int {
                      self.0 .0
@@@ -87,7 -83,6 +83,6 @@@
              }
  
              impl_nonzero_fmt! {
-                 #[$stability]
                  (Debug, Display, Binary, Octal, LowerHex, UpperHex) for $Ty
              }
          )+
@@@ -95,8 -90,6 +90,6 @@@
  }
  
  nonzero_integers! {
-     #[unstable(feature = "nonzero", issue = "49137")]
-     #[allow(deprecated)]  // Redundant, works around "error: inconsistent lockstep iteration"
      NonZeroU8(u8);
      NonZeroU16(u16);
      NonZeroU32(u32);
      NonZeroUsize(usize);
  }
  
- nonzero_integers! {
-     #[unstable(feature = "nonzero", issue = "49137")]
-     #[rustc_deprecated(since = "1.26.0", reason = "\
-         signed non-zero integers are considered for removal due to lack of known use cases. \
-         If you’re using them, please comment on https://github.com/rust-lang/rust/issues/49137")]
-     NonZeroI8(i8);
-     NonZeroI16(i16);
-     NonZeroI32(i32);
-     NonZeroI64(i64);
-     NonZeroI128(i128);
-     NonZeroIsize(isize);
- }
  /// Provides intentionally-wrapped arithmetic on `T`.
  ///
  /// Operations like `+` on `u32` values is intended to never overflow,
@@@ -252,7 -232,7 +232,7 @@@ depending on `radix`
  
   * `0-9`
   * `a-z`
 - * `a-z`
 + * `A-Z`
  
  # Panics
  
index 5bac1bd9a7b08986b8c6231a77613caf4ee4995c,328ff76c1cdd0175fd5986de70356bcdb5afe7ab..9a6705fe9cac32b6cad2d276f672abef2e5b6d45
@@@ -21,7 -21,6 +21,6 @@@
        html_root_url = "https://doc.rust-lang.org/nightly/")]
  
  #![feature(collections_range)]
- #![feature(nonzero)]
  #![feature(unboxed_closures)]
  #![feature(fn_traits)]
  #![feature(unsize)]
@@@ -61,6 -60,7 +60,6 @@@ pub mod bitvec
  pub mod graph;
  pub mod indexed_set;
  pub mod indexed_vec;
 -pub mod lazy_btree_map;
  pub mod obligation_forest;
  pub mod sip128;
  pub mod snapshot_map;