]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #54601 - cuviper:prep-1.31, r=Mark-Simulacrum
authorbors <bors@rust-lang.org>
Sun, 30 Sep 2018 01:45:50 +0000 (01:45 +0000)
committerbors <bors@rust-lang.org>
Sun, 30 Sep 2018 01:45:50 +0000 (01:45 +0000)
Bump to 1.31.0 and bootstrap from 1.30 beta

Closes #54594.

1  2 
src/liballoc/lib.rs
src/libcore/lib.rs
src/libcore/num/mod.rs
src/librustc_driver/lib.rs
src/librustc_lint/lib.rs
src/librustc_privacy/lib.rs
src/librustc_resolve/lib.rs
src/librustc_save_analysis/lib.rs
src/librustc_typeck/lib.rs
src/libstd/panicking.rs
src/libsyntax_pos/lib.rs

diff --combined src/liballoc/lib.rs
index f92075cc84e509a739ad3ef8984c77d2f1f27437,61348424afa793c6b543d06e08d408b70b6213dd..5f9ceb8599cf51321e4c15542d6708004d2fc7ef
@@@ -76,7 -76,6 +76,6 @@@
  
  #![cfg_attr(not(test), feature(fn_traits))]
  #![cfg_attr(not(test), feature(generator_trait))]
- #![cfg_attr(not(stage0), feature(nll))]
  #![cfg_attr(test, feature(test))]
  
  #![feature(allocator_api)]
@@@ -87,8 -86,7 +86,7 @@@
  #![feature(box_syntax)]
  #![feature(cfg_target_has_atomic)]
  #![feature(coerce_unsized)]
- #![cfg_attr(stage0, feature(const_fn))]
- #![cfg_attr(not(stage0), feature(min_const_fn))]
+ #![feature(min_const_fn)]
  #![feature(core_intrinsics)]
  #![feature(custom_attribute)]
  #![feature(dropck_eyepatch)]
@@@ -99,6 -97,7 +97,7 @@@
  #![feature(lang_items)]
  #![feature(libc)]
  #![feature(needs_allocator)]
+ #![feature(nll)]
  #![feature(optin_builtin_traits)]
  #![feature(pattern)]
  #![feature(pin)]
  #![feature(rustc_const_unstable)]
  #![feature(const_vec_new)]
  #![feature(slice_partition_dedup)]
 -#![feature(maybe_uninit)]
  
  // Allow testing this library
  
diff --combined src/libcore/lib.rs
index 675e73e952cc2ca011c055a949d38c75e99b18e2,5bc4c34743f99182d093f6c6e99849e6db688c83..94e84106328e2fea26e43e8c21300c8a817a355f
@@@ -91,7 -91,7 +91,7 @@@
  #![feature(lang_items)]
  #![feature(link_llvm_intrinsics)]
  #![feature(never_type)]
- #![cfg_attr(not(stage0), feature(nll))]
+ #![feature(nll)]
  #![feature(exhaustive_patterns)]
  #![feature(macro_at_most_once_rep)]
  #![feature(no_core)]
@@@ -246,6 -246,8 +246,6 @@@ macro_rules! test_v512 { ($item:item) =
  #[allow(unused_macros)]
  macro_rules! vector_impl { ($([$f:ident, $($args:tt)*]),*) => { $($f!($($args)*);)* } }
  #[path = "../stdsimd/coresimd/mod.rs"]
 -// replacing uses of mem::{uninitialized,zeroed} with MaybeUninit needs to be in the stdsimd repo
 -#[allow(deprecated)]
  #[allow(missing_docs, missing_debug_implementations, dead_code, unused_imports)]
  #[unstable(feature = "stdsimd", issue = "48556")]
  #[cfg(not(stage0))] // allow changes to how stdsimd works in stage0
diff --combined src/libcore/num/mod.rs
index c4b59738478dc0faa45e92b4a1d8d24b2ff5d691,b8b0938b373c1519de90512b49279e31f400abe2..f054580cba7bc02cd6a1a35d35f24c13df637397
@@@ -93,13 -93,6 +93,13 @@@ assert_eq!(size_of::<Option<std::num::"
  
              }
  
 +            #[stable(feature = "from_nonzero", since = "1.31.0")]
 +            impl From<$Ty> for $Int {
 +                fn from(nonzero: $Ty) -> Self {
 +                    nonzero.0 .0
 +                }
 +            }
 +
              impl_nonzero_fmt! {
                  (Debug, Display, Binary, Octal, LowerHex, UpperHex) for $Ty
              }
@@@ -348,14 -341,6 +348,6 @@@ $EndFeature, 
              }
          }
  
-         /// no docs here
-         #[stable(feature = "rust1", since = "1.0.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn rotate_left(self, n: u32) -> Self {
-             (self as $UnsignedT).rotate_left(n) as Self
-         }
          doc_comment! {
              concat!("Shifts the bits to the left by a specified amount, `n`,
  wrapping the truncated bits to the end of the resulting integer.
@@@ -375,20 -360,11 +367,11 @@@ assert_eq!(n.rotate_left(", $rot, "), m
              #[stable(feature = "rust1", since = "1.0.0")]
              #[rustc_const_unstable(feature = "const_int_rotate")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn rotate_left(self, n: u32) -> Self {
                  (self as $UnsignedT).rotate_left(n) as Self
              }
          }
  
-         /// no docs here
-         #[stable(feature = "rust1", since = "1.0.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn rotate_right(self, n: u32) -> Self {
-             (self as $UnsignedT).rotate_right(n) as Self
-         }
          doc_comment! {
              concat!("Shifts the bits to the right by a specified amount, `n`,
  wrapping the truncated bits to the beginning of the resulting
@@@ -409,7 -385,6 +392,6 @@@ assert_eq!(n.rotate_right(", $rot, "), 
              #[stable(feature = "rust1", since = "1.0.0")]
              #[rustc_const_unstable(feature = "const_int_rotate")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn rotate_right(self, n: u32) -> Self {
                  (self as $UnsignedT).rotate_right(n) as Self
              }
@@@ -437,14 -412,6 +419,6 @@@ assert_eq!(m, ", $swapped, ")
              }
          }
  
-         /// no docs here
-         #[unstable(feature = "reverse_bits", issue = "48763")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn reverse_bits(self) -> Self {
-             (self as $UnsignedT).reverse_bits() as Self
-         }
          doc_comment! {
              concat!("Reverses the bit pattern of the integer.
  
@@@ -463,7 -430,6 +437,6 @@@ assert_eq!(m, ", $reversed, ")
              #[unstable(feature = "reverse_bits", issue = "48763")]
              #[rustc_const_unstable(feature = "const_int_conversion")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn reverse_bits(self) -> Self {
                  (self as $UnsignedT).reverse_bits() as Self
              }
@@@ -1014,16 -980,6 +987,6 @@@ $EndFeature, 
              }
          }
  
-         /// no docs here
-         #[stable(feature = "rust1", since = "1.0.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn wrapping_add(self, rhs: Self) -> Self {
-             unsafe {
-                 intrinsics::overflowing_add(self, rhs)
-             }
-         }
          doc_comment! {
              concat!("Wrapping (modular) addition. Computes `self + rhs`, wrapping around at the
  boundary of the type.
@@@ -1041,7 -997,6 +1004,6 @@@ $EndFeature, 
              #[stable(feature = "rust1", since = "1.0.0")]
              #[rustc_const_unstable(feature = "const_int_wrapping")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn wrapping_add(self, rhs: Self) -> Self {
                  unsafe {
                      intrinsics::overflowing_add(self, rhs)
              }
          }
  
-         /// no docs here
-         #[stable(feature = "rust1", since = "1.0.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn wrapping_sub(self, rhs: Self) -> Self {
-             unsafe {
-                 intrinsics::overflowing_sub(self, rhs)
-             }
-         }
          doc_comment! {
              concat!("Wrapping (modular) subtraction. Computes `self - rhs`, wrapping around at the
  boundary of the type.
@@@ -1076,7 -1021,6 +1028,6 @@@ $EndFeature, 
              #[stable(feature = "rust1", since = "1.0.0")]
              #[rustc_const_unstable(feature = "const_int_wrapping")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn wrapping_sub(self, rhs: Self) -> Self {
                  unsafe {
                      intrinsics::overflowing_sub(self, rhs)
              }
          }
  
-         /// no docs here
-         #[stable(feature = "rust1", since = "1.0.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn wrapping_mul(self, rhs: Self) -> Self {
-             unsafe {
-                 intrinsics::overflowing_mul(self, rhs)
-             }
-         }
          doc_comment! {
              concat!("Wrapping (modular) multiplication. Computes `self * rhs`, wrapping around at
  the boundary of the type.
@@@ -1110,7 -1044,6 +1051,6 @@@ $EndFeature, 
              #[stable(feature = "rust1", since = "1.0.0")]
              #[rustc_const_unstable(feature = "const_int_wrapping")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn wrapping_mul(self, rhs: Self) -> Self {
                  unsafe {
                      intrinsics::overflowing_mul(self, rhs)
@@@ -1254,16 -1187,6 +1194,6 @@@ $EndFeature, 
              }
          }
  
-         /// no docs here
-         #[stable(feature = "num_wrapping", since = "1.2.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn wrapping_shl(self, rhs: u32) -> Self {
-             unsafe {
-                 intrinsics::unchecked_shl(self, (rhs & ($BITS - 1)) as $SelfT)
-             }
-         }
          doc_comment! {
              concat!("Panic-free bitwise shift-left; yields `self << mask(rhs)`, where `mask` removes
  any high-order bits of `rhs` that would cause the shift to exceed the bitwidth of the type.
@@@ -1285,7 -1208,6 +1215,6 @@@ $EndFeature, 
              #[stable(feature = "num_wrapping", since = "1.2.0")]
              #[rustc_const_unstable(feature = "const_int_wrapping")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn wrapping_shl(self, rhs: u32) -> Self {
                  unsafe {
                      intrinsics::unchecked_shl(self, (rhs & ($BITS - 1)) as $SelfT)
              }
          }
  
-         /// no docs here
-         #[stable(feature = "num_wrapping", since = "1.2.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn wrapping_shr(self, rhs: u32) -> Self {
-             unsafe {
-                 intrinsics::unchecked_shr(self, (rhs & ($BITS - 1)) as $SelfT)
-             }
-         }
          doc_comment! {
              concat!("Panic-free bitwise shift-right; yields `self >> mask(rhs)`, where `mask`
  removes any high-order bits of `rhs` that would cause the shift to exceed the bitwidth of the type.
@@@ -1324,7 -1236,6 +1243,6 @@@ $EndFeature, 
              #[stable(feature = "num_wrapping", since = "1.2.0")]
              #[rustc_const_unstable(feature = "const_int_wrapping")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn wrapping_shr(self, rhs: u32) -> Self {
                  unsafe {
                      intrinsics::unchecked_shr(self, (rhs & ($BITS - 1)) as $SelfT)
@@@ -1403,18 -1314,6 +1321,6 @@@ $EndFeature, 
              }
          }
  
-         /// no docs here
-         #[stable(feature = "wrapping", since = "1.7.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn overflowing_add(self, rhs: Self) -> (Self, bool) {
-             let (a, b) = unsafe {
-                 intrinsics::add_with_overflow(self as $ActualT,
-                                                 rhs as $ActualT)
-             };
-             (a as Self, b)
-         }
          doc_comment! {
              concat!("Calculates `self` + `rhs`
  
@@@ -1435,7 -1334,6 +1341,6 @@@ assert_eq!(", stringify!($SelfT), "::MA
              #[stable(feature = "wrapping", since = "1.7.0")]
              #[rustc_const_unstable(feature = "const_int_overflowing")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn overflowing_add(self, rhs: Self) -> (Self, bool) {
                  let (a, b) = unsafe {
                      intrinsics::add_with_overflow(self as $ActualT,
              }
          }
  
-         /// no docs here
-         #[stable(feature = "wrapping", since = "1.7.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn overflowing_sub(self, rhs: Self) -> (Self, bool) {
-             let (a, b) = unsafe {
-                 intrinsics::sub_with_overflow(self as $ActualT,
-                                                 rhs as $ActualT)
-             };
-             (a as Self, b)
-         }
          doc_comment! {
              concat!("Calculates `self` - `rhs`
  
@@@ -1477,7 -1363,6 +1370,6 @@@ assert_eq!(", stringify!($SelfT), "::MI
              #[stable(feature = "wrapping", since = "1.7.0")]
              #[rustc_const_unstable(feature = "const_int_overflowing")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool) {
                  let (a, b) = unsafe {
                      intrinsics::sub_with_overflow(self as $ActualT,
              }
          }
  
-         /// no docs here
-         #[stable(feature = "wrapping", since = "1.7.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn overflowing_mul(self, rhs: Self) -> (Self, bool) {
-             let (a, b) = unsafe {
-                 intrinsics::mul_with_overflow(self as $ActualT,
-                                                 rhs as $ActualT)
-             };
-             (a as Self, b)
-         }
          doc_comment! {
              concat!("Calculates the multiplication of `self` and `rhs`.
  
@@@ -1517,7 -1390,6 +1397,6 @@@ $EndFeature, 
              #[stable(feature = "wrapping", since = "1.7.0")]
              #[rustc_const_unstable(feature = "const_int_overflowing")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool) {
                  let (a, b) = unsafe {
                      intrinsics::mul_with_overflow(self as $ActualT,
@@@ -1688,14 -1560,6 +1567,6 @@@ assert_eq!(", stringify!($SelfT), "::MI
              }
          }
  
-         /// no docs here
-         #[stable(feature = "wrapping", since = "1.7.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn overflowing_shl(self, rhs: u32) -> (Self, bool) {
-             (self.wrapping_shl(rhs), (rhs > ($BITS - 1)))
-         }
          doc_comment! {
              concat!("Shifts self left by `rhs` bits.
  
@@@ -1715,20 -1579,11 +1586,11 @@@ $EndFeature, 
              #[stable(feature = "wrapping", since = "1.7.0")]
              #[rustc_const_unstable(feature = "const_int_overflowing")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn overflowing_shl(self, rhs: u32) -> (Self, bool) {
                  (self.wrapping_shl(rhs), (rhs > ($BITS - 1)))
              }
          }
  
-         /// no docs here
-         #[stable(feature = "wrapping", since = "1.7.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn overflowing_shr(self, rhs: u32) -> (Self, bool) {
-             (self.wrapping_shr(rhs), (rhs > ($BITS - 1)))
-         }
          doc_comment! {
              concat!("Shifts self right by `rhs` bits.
  
@@@ -1748,7 -1603,6 +1610,6 @@@ $EndFeature, 
              #[stable(feature = "wrapping", since = "1.7.0")]
              #[rustc_const_unstable(feature = "const_int_overflowing")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool) {
                  (self.wrapping_shr(rhs), (rhs > ($BITS - 1)))
              }
@@@ -2013,12 -1867,6 +1874,6 @@@ $EndFeature, 
              }
          }
  
-         /// no docs here
-         #[stable(feature = "rust1", since = "1.0.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn is_positive(self) -> bool { self > 0 }
          doc_comment! {
              concat!("Returns `true` if `self` is positive and `false` if the number is zero or
  negative.
@@@ -2035,16 -1883,9 +1890,9 @@@ $EndFeature, 
              #[stable(feature = "rust1", since = "1.0.0")]
              #[rustc_const_unstable(feature = "const_int_sign")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn is_positive(self) -> bool { self > 0 }
          }
  
-         /// no docs here
-         #[stable(feature = "rust1", since = "1.0.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn is_negative(self) -> bool { self < 0 }
          doc_comment! {
              concat!("Returns `true` if `self` is negative and `false` if the number is zero or
  positive.
@@@ -2061,18 -1902,9 +1909,9 @@@ $EndFeature, 
              #[stable(feature = "rust1", since = "1.0.0")]
              #[rustc_const_unstable(feature = "const_int_sign")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn is_negative(self) -> bool { self < 0 }
          }
  
-         /// no docs here
-         #[unstable(feature = "int_to_from_bytes", issue = "52963")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn to_be_bytes(self) -> [u8; mem::size_of::<Self>()] {
-             self.to_be().to_ne_bytes()
-         }
          doc_comment! {
              concat!("Return the memory representation of this integer as a byte array in
  big-endian (network) byte order.
@@@ -2088,20 -1920,11 +1927,11 @@@ assert_eq!(bytes, ", $be_bytes, ")
              #[unstable(feature = "int_to_from_bytes", issue = "52963")]
              #[rustc_const_unstable(feature = "const_int_conversion")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn to_be_bytes(self) -> [u8; mem::size_of::<Self>()] {
                  self.to_be().to_ne_bytes()
              }
          }
  
-         /// no docs here
-         #[unstable(feature = "int_to_from_bytes", issue = "52963")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn to_le_bytes(self) -> [u8; mem::size_of::<Self>()] {
-             self.to_le().to_ne_bytes()
-         }
  doc_comment! {
              concat!("Return the memory representation of this integer as a byte array in
  little-endian byte order.
@@@ -2117,20 -1940,11 +1947,11 @@@ assert_eq!(bytes, ", $le_bytes, ")
              #[unstable(feature = "int_to_from_bytes", issue = "52963")]
              #[rustc_const_unstable(feature = "const_int_conversion")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn to_le_bytes(self) -> [u8; mem::size_of::<Self>()] {
                  self.to_le().to_ne_bytes()
              }
          }
  
-         /// no docs here
-         #[unstable(feature = "int_to_from_bytes", issue = "52963")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] {
-             unsafe { mem::transmute(self) }
-         }
          doc_comment! {
              concat!("
  Return the memory representation of this integer as a byte array in
@@@ -2158,20 -1972,11 +1979,11 @@@ assert_eq!(bytes, if cfg!(target_endia
              #[unstable(feature = "int_to_from_bytes", issue = "52963")]
              #[rustc_const_unstable(feature = "const_int_conversion")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] {
                  unsafe { mem::transmute(self) }
              }
          }
  
-         /// no docs here
-         #[unstable(feature = "int_to_from_bytes", issue = "52963")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn from_be_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
-             Self::from_be(Self::from_ne_bytes(bytes))
-         }
  doc_comment! {
              concat!("Create an integer value from its representation as a byte array in
  big endian.
@@@ -2187,20 -1992,11 +1999,11 @@@ assert_eq!(value, ", $swap_op, ")
              #[unstable(feature = "int_to_from_bytes", issue = "52963")]
              #[rustc_const_unstable(feature = "const_int_conversion")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn from_be_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
                  Self::from_be(Self::from_ne_bytes(bytes))
              }
          }
  
-         /// no docs here
-         #[unstable(feature = "int_to_from_bytes", issue = "52963")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
-             Self::from_le(Self::from_ne_bytes(bytes))
-         }
  doc_comment! {
              concat!("
  Create an integer value from its representation as a byte array in
@@@ -2217,20 -2013,11 +2020,11 @@@ assert_eq!(value, ", $swap_op, ")
              #[unstable(feature = "int_to_from_bytes", issue = "52963")]
              #[rustc_const_unstable(feature = "const_int_conversion")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
                  Self::from_le(Self::from_ne_bytes(bytes))
              }
          }
  
-         /// no docs here
-         #[unstable(feature = "int_to_from_bytes", issue = "52963")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
-             unsafe { mem::transmute(bytes) }
-         }
          doc_comment! {
              concat!("Create an integer value from its memory representation as a byte
  array in native endianness.
@@@ -2257,7 -2044,6 +2051,6 @@@ assert_eq!(value, ", $swap_op, ")
              #[unstable(feature = "int_to_from_bytes", issue = "52963")]
              #[rustc_const_unstable(feature = "const_int_conversion")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
                  unsafe { mem::transmute(bytes) }
              }
@@@ -2486,16 -2272,6 +2279,6 @@@ assert_eq!(n.trailing_zeros(), 3);", $E
              }
          }
  
-         /// no docs here
-         #[stable(feature = "rust1", since = "1.0.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn rotate_left(self, n: u32) -> Self {
-             // Protect against undefined behaviour for over-long bit shifts
-             let n = n % $BITS;
-             (self << n) | (self >> (($BITS - n) % $BITS))
-         }
          doc_comment! {
              concat!("Shifts the bits to the left by a specified amount, `n`,
  wrapping the truncated bits to the end of the resulting integer.
@@@ -2515,22 -2291,11 +2298,11 @@@ assert_eq!(n.rotate_left(", $rot, "), m
              #[stable(feature = "rust1", since = "1.0.0")]
              #[rustc_const_unstable(feature = "const_int_rotate")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn rotate_left(self, n: u32) -> Self {
                  (self << (n % $BITS)) | (self >> (($BITS - (n % $BITS)) % $BITS))
              }
          }
  
-         /// no docs here
-         #[stable(feature = "rust1", since = "1.0.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn rotate_right(self, n: u32) -> Self {
-             // Protect against undefined behaviour for over-long bit shifts
-             let n = n % $BITS;
-             (self >> n) | (self << (($BITS - n) % $BITS))
-         }
          doc_comment! {
              concat!("Shifts the bits to the right by a specified amount, `n`,
  wrapping the truncated bits to the beginning of the resulting
@@@ -2551,7 -2316,6 +2323,6 @@@ assert_eq!(n.rotate_right(", $rot, "), 
              #[stable(feature = "rust1", since = "1.0.0")]
              #[rustc_const_unstable(feature = "const_int_rotate")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn rotate_right(self, n: u32) -> Self {
                  (self >> (n % $BITS)) | (self << (($BITS - (n % $BITS)) % $BITS))
              }
@@@ -2579,14 -2343,6 +2350,6 @@@ assert_eq!(m, ", $swapped, ")
              }
          }
  
-         /// no docs here
-         #[unstable(feature = "reverse_bits", issue = "48763")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn reverse_bits(self) -> Self {
-             unsafe { intrinsics::bitreverse(self as $ActualT) as Self }
-         }
          doc_comment! {
              concat!("Reverses the bit pattern of the integer.
  
@@@ -2605,7 -2361,6 +2368,6 @@@ assert_eq!(m, ", $reversed, ")
              #[unstable(feature = "reverse_bits", issue = "48763")]
              #[rustc_const_unstable(feature = "const_int_conversion")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn reverse_bits(self) -> Self {
                  unsafe { intrinsics::bitreverse(self as $ActualT) as Self }
              }
@@@ -3094,16 -2849,6 +2856,6 @@@ $EndFeature, 
              }
          }
  
-         /// no docs here
-         #[stable(feature = "rust1", since = "1.0.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn wrapping_add(self, rhs: Self) -> Self {
-             unsafe {
-                 intrinsics::overflowing_add(self, rhs)
-             }
-         }
          doc_comment! {
              concat!("Wrapping (modular) addition. Computes `self + rhs`,
  wrapping around at the boundary of the type.
@@@ -3120,7 -2865,6 +2872,6 @@@ $EndFeature, 
              #[stable(feature = "rust1", since = "1.0.0")]
              #[rustc_const_unstable(feature = "const_int_wrapping")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn wrapping_add(self, rhs: Self) -> Self {
                  unsafe {
                      intrinsics::overflowing_add(self, rhs)
              }
          }
  
-         /// no docs here
-         #[stable(feature = "rust1", since = "1.0.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn wrapping_sub(self, rhs: Self) -> Self {
-             unsafe {
-                 intrinsics::overflowing_sub(self, rhs)
-             }
-         }
          doc_comment! {
              concat!("Wrapping (modular) subtraction. Computes `self - rhs`,
  wrapping around at the boundary of the type.
@@@ -3154,7 -2888,6 +2895,6 @@@ $EndFeature, 
              #[stable(feature = "rust1", since = "1.0.0")]
              #[rustc_const_unstable(feature = "const_int_wrapping")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn wrapping_sub(self, rhs: Self) -> Self {
                  unsafe {
                      intrinsics::overflowing_sub(self, rhs)
              }
          }
  
-         /// no docs here
-         #[stable(feature = "rust1", since = "1.0.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn wrapping_mul(self, rhs: Self) -> Self {
-             unsafe {
-                 intrinsics::overflowing_mul(self, rhs)
-             }
-         }
          /// Wrapping (modular) multiplication. Computes `self *
          /// rhs`, wrapping around at the boundary of the type.
          ///
          #[stable(feature = "rust1", since = "1.0.0")]
          #[rustc_const_unstable(feature = "const_int_wrapping")]
          #[inline]
-         #[cfg(not(stage0))]
          pub const fn wrapping_mul(self, rhs: Self) -> Self {
              unsafe {
                  intrinsics::overflowing_mul(self, rhs)
@@@ -3311,16 -3033,6 +3040,6 @@@ assert_eq!(100", stringify!($SelfT), ".
              self.overflowing_neg().0
          }
  
-         /// no docs here
-         #[stable(feature = "num_wrapping", since = "1.2.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn wrapping_shl(self, rhs: u32) -> Self {
-             unsafe {
-                 intrinsics::unchecked_shl(self, (rhs & ($BITS - 1)) as $SelfT)
-             }
-         }
          doc_comment! {
              concat!("Panic-free bitwise shift-left; yields `self << mask(rhs)`,
  where `mask` removes any high-order bits of `rhs` that
@@@ -3344,7 -3056,6 +3063,6 @@@ assert_eq!(1", stringify!($SelfT), ".wr
              #[stable(feature = "num_wrapping", since = "1.2.0")]
              #[rustc_const_unstable(feature = "const_int_wrapping")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn wrapping_shl(self, rhs: u32) -> Self {
                  unsafe {
                      intrinsics::unchecked_shl(self, (rhs & ($BITS - 1)) as $SelfT)
              }
          }
  
-         /// no docs here
-         #[stable(feature = "num_wrapping", since = "1.2.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn wrapping_shr(self, rhs: u32) -> Self {
-             unsafe {
-                 intrinsics::unchecked_shr(self, (rhs & ($BITS - 1)) as $SelfT)
-             }
-         }
          doc_comment! {
              concat!("Panic-free bitwise shift-right; yields `self >> mask(rhs)`,
  where `mask` removes any high-order bits of `rhs` that
@@@ -3385,7 -3086,6 +3093,6 @@@ assert_eq!(128", stringify!($SelfT), ".
              #[stable(feature = "num_wrapping", since = "1.2.0")]
              #[rustc_const_unstable(feature = "const_int_wrapping")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn wrapping_shr(self, rhs: u32) -> Self {
                  unsafe {
                      intrinsics::unchecked_shr(self, (rhs & ($BITS - 1)) as $SelfT)
@@@ -3431,18 -3131,6 +3138,6 @@@ assert_eq!(3u8.wrapping_pow(6), 217);"
              }
          }
  
-         /// no docs here
-         #[stable(feature = "wrapping", since = "1.7.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn overflowing_add(self, rhs: Self) -> (Self, bool) {
-             let (a, b) = unsafe {
-                 intrinsics::add_with_overflow(self as $ActualT,
-                                                 rhs as $ActualT)
-             };
-             (a as Self, b)
-         }
          doc_comment! {
              concat!("Calculates `self` + `rhs`
  
@@@ -3463,7 -3151,6 +3158,6 @@@ assert_eq!(", stringify!($SelfT), "::MA
              #[stable(feature = "wrapping", since = "1.7.0")]
              #[rustc_const_unstable(feature = "const_int_overflowing")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn overflowing_add(self, rhs: Self) -> (Self, bool) {
                  let (a, b) = unsafe {
                      intrinsics::add_with_overflow(self as $ActualT,
              }
          }
  
-         /// no docs here
-         #[stable(feature = "wrapping", since = "1.7.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn overflowing_sub(self, rhs: Self) -> (Self, bool) {
-             let (a, b) = unsafe {
-                 intrinsics::sub_with_overflow(self as $ActualT,
-                                                 rhs as $ActualT)
-             };
-             (a as Self, b)
-         }
          doc_comment! {
              concat!("Calculates `self` - `rhs`
  
@@@ -3506,7 -3181,6 +3188,6 @@@ $EndFeature, 
              #[stable(feature = "wrapping", since = "1.7.0")]
              #[rustc_const_unstable(feature = "const_int_overflowing")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool) {
                  let (a, b) = unsafe {
                      intrinsics::sub_with_overflow(self as $ActualT,
              }
          }
  
-         /// no docs here
-         #[stable(feature = "wrapping", since = "1.7.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn overflowing_mul(self, rhs: Self) -> (Self, bool) {
-             let (a, b) = unsafe {
-                 intrinsics::mul_with_overflow(self as $ActualT,
-                                               rhs as $ActualT)
-             };
-             (a as Self, b)
-         }
          /// Calculates the multiplication of `self` and `rhs`.
          ///
          /// Returns a tuple of the multiplication along with a boolean
          #[stable(feature = "wrapping", since = "1.7.0")]
          #[rustc_const_unstable(feature = "const_int_overflowing")]
          #[inline]
-         #[cfg(not(stage0))]
          pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool) {
              let (a, b) = unsafe {
                  intrinsics::mul_with_overflow(self as $ActualT,
@@@ -3687,14 -3348,6 +3355,6 @@@ assert_eq!(2", stringify!($SelfT), ".ov
              }
          }
  
-         /// no docs here
-         #[stable(feature = "wrapping", since = "1.7.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn overflowing_shl(self, rhs: u32) -> (Self, bool) {
-             (self.wrapping_shl(rhs), (rhs > ($BITS - 1)))
-         }
          doc_comment! {
              concat!("Shifts self left by `rhs` bits.
  
@@@ -3715,20 -3368,11 +3375,11 @@@ assert_eq!(0x1", stringify!($SelfT), ".
              #[stable(feature = "wrapping", since = "1.7.0")]
              #[rustc_const_unstable(feature = "const_int_overflowing")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn overflowing_shl(self, rhs: u32) -> (Self, bool) {
                  (self.wrapping_shl(rhs), (rhs > ($BITS - 1)))
              }
          }
  
-         /// no docs here
-         #[stable(feature = "wrapping", since = "1.7.0")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn overflowing_shr(self, rhs: u32) -> (Self, bool) {
-             (self.wrapping_shr(rhs), (rhs > ($BITS - 1)))
-         }
          doc_comment! {
              concat!("Shifts self right by `rhs` bits.
  
@@@ -3749,7 -3393,6 +3400,6 @@@ assert_eq!(0x10", stringify!($SelfT), "
              #[stable(feature = "wrapping", since = "1.7.0")]
              #[rustc_const_unstable(feature = "const_int_overflowing")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool) {
                  (self.wrapping_shr(rhs), (rhs > ($BITS - 1)))
              }
@@@ -3992,15 -3635,7 +3642,7 @@@ $EndFeature, 
              }
          }
  
-         /// no docs here
-         #[unstable(feature = "int_to_from_bytes", issue = "52963")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn to_be_bytes(self) -> [u8; mem::size_of::<Self>()] {
-             self.to_be().to_ne_bytes()
-         }
-                 doc_comment! {
+         doc_comment! {
              concat!("Return the memory representation of this integer as a byte array in
  big-endian (network) byte order.
  
@@@ -4015,20 -3650,11 +3657,11 @@@ assert_eq!(bytes, ", $be_bytes, ")
              #[unstable(feature = "int_to_from_bytes", issue = "52963")]
              #[rustc_const_unstable(feature = "const_int_conversion")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn to_be_bytes(self) -> [u8; mem::size_of::<Self>()] {
                  self.to_be().to_ne_bytes()
              }
          }
  
-         /// no docs here
-         #[unstable(feature = "int_to_from_bytes", issue = "52963")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn to_le_bytes(self) -> [u8; mem::size_of::<Self>()] {
-             self.to_le().to_ne_bytes()
-         }
          doc_comment! {
              concat!("Return the memory representation of this integer as a byte array in
  little-endian byte order.
@@@ -4044,20 -3670,11 +3677,11 @@@ assert_eq!(bytes, ", $le_bytes, ")
              #[unstable(feature = "int_to_from_bytes", issue = "52963")]
              #[rustc_const_unstable(feature = "const_int_conversion")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn to_le_bytes(self) -> [u8; mem::size_of::<Self>()] {
                  self.to_le().to_ne_bytes()
              }
          }
  
-         /// no docs here
-         #[unstable(feature = "int_to_from_bytes", issue = "52963")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] {
-             unsafe { mem::transmute(self) }
-         }
          doc_comment! {
              concat!("
  Return the memory representation of this integer as a byte array in
@@@ -4085,20 -3702,11 +3709,11 @@@ assert_eq!(bytes, if cfg!(target_endia
              #[unstable(feature = "int_to_from_bytes", issue = "52963")]
              #[rustc_const_unstable(feature = "const_int_conversion")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] {
                  unsafe { mem::transmute(self) }
              }
          }
  
-         /// no docs here
-         #[unstable(feature = "int_to_from_bytes", issue = "52963")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn from_be_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
-             Self::from_be(Self::from_ne_bytes(bytes))
-         }
          doc_comment! {
              concat!("Create an integer value from its representation as a byte array in
  big endian.
@@@ -4114,20 -3722,11 +3729,11 @@@ assert_eq!(value, ", $swap_op, ")
              #[unstable(feature = "int_to_from_bytes", issue = "52963")]
              #[rustc_const_unstable(feature = "const_int_conversion")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn from_be_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
                  Self::from_be(Self::from_ne_bytes(bytes))
              }
          }
  
-         /// no docs here
-         #[unstable(feature = "int_to_from_bytes", issue = "52963")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
-             Self::from_le(Self::from_ne_bytes(bytes))
-         }
          doc_comment! {
              concat!("
  Create an integer value from its representation as a byte array in
@@@ -4144,20 -3743,11 +3750,11 @@@ assert_eq!(value, ", $swap_op, ")
              #[unstable(feature = "int_to_from_bytes", issue = "52963")]
              #[rustc_const_unstable(feature = "const_int_conversion")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
                  Self::from_le(Self::from_ne_bytes(bytes))
              }
          }
  
-         /// no docs here
-         #[unstable(feature = "int_to_from_bytes", issue = "52963")]
-         #[inline]
-         #[cfg(stage0)]
-         pub fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
-             unsafe { mem::transmute(bytes) }
-         }
          doc_comment! {
              concat!("Create an integer value from its memory representation as a byte
  array in native endianness.
@@@ -4184,7 -3774,6 +3781,6 @@@ assert_eq!(value, ", $swap_op, ")
              #[unstable(feature = "int_to_from_bytes", issue = "52963")]
              #[rustc_const_unstable(feature = "const_int_conversion")]
              #[inline]
-             #[cfg(not(stage0))]
              pub const fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
                  unsafe { mem::transmute(bytes) }
              }
index 27176a821b4affa6e50d8b0587cac045a1e14c1d,cc6895613f286a05a69a7c84217b7f0e6219e64d..b97f5868079c4cd576581c88e62ee4fdbfb2b2e5
@@@ -20,7 -20,7 +20,7 @@@
  
  #![feature(box_syntax)]
  #![cfg_attr(unix, feature(libc))]
- #![cfg_attr(not(stage0), feature(nll))]
+ #![feature(nll)]
  #![feature(option_replace)]
  #![feature(quote)]
  #![feature(rustc_diagnostic_macros)]
@@@ -980,7 -980,6 +980,7 @@@ pub fn enable_save_analysis(control: &m
                                  state.expanded_crate.unwrap(),
                                  state.analysis.unwrap(),
                                  state.crate_name.unwrap(),
 +                                state.input,
                                  None,
                                  DumpHandler::new(state.out_dir,
                                                   state.crate_name.unwrap()))
diff --combined src/librustc_lint/lib.rs
index 9e0471f59fbab6548fa741fb4765ca68b20be392,e8f09dbdfe139ee6c0034bb771bb8fdf700b9a9e..98d4c87dc3b5e810159c8c271c07ecd36f77ad78
@@@ -26,8 -26,7 +26,7 @@@
  #![cfg_attr(test, feature(test))]
  #![feature(box_patterns)]
  #![feature(box_syntax)]
- #![cfg_attr(stage0, feature(macro_vis_matcher))]
- #![cfg_attr(not(stage0), feature(nll))]
+ #![feature(nll)]
  #![feature(quote)]
  #![feature(rustc_diagnostic_macros)]
  #![feature(macro_at_most_once_rep)]
@@@ -48,7 -47,6 +47,7 @@@ use rustc::lint::builtin::
      BARE_TRAIT_OBJECTS,
      ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
      ELIDED_LIFETIMES_IN_PATHS,
 +    EXPLICIT_OUTLIVES_REQUIREMENTS,
      parser::QUESTION_MARK_MACRO_SEP
  };
  use rustc::session;
@@@ -158,7 -156,6 +157,7 @@@ pub fn register_builtins(store: &mut li
          TypeLimits: TypeLimits::new(),
          MissingDoc: MissingDoc::new(),
          MissingDebugImplementations: MissingDebugImplementations::new(),
 +        ExplicitOutlivesRequirements: ExplicitOutlivesRequirements,
      ]], ['tcx]);
  
      store.register_late_pass(sess, false, box BuiltinCombinedLateLintPass::new());
                      BARE_TRAIT_OBJECTS,
                      UNUSED_EXTERN_CRATES,
                      ELLIPSIS_INCLUSIVE_RANGE_PATTERNS,
 -                    ELIDED_LIFETIMES_IN_PATHS
 +                    ELIDED_LIFETIMES_IN_PATHS,
 +                    EXPLICIT_OUTLIVES_REQUIREMENTS
  
                      // FIXME(#52665, #47816) not always applicable and not all
                      // macros are ready for this yet.
index 1fe370b44c5bcf33cbb4ac52254b50eb78a6be8a,c647197f22bf35ee4ed17e52af7c4585647a3e20..60679d6d4304eb508c231fe69bf3b98ccddc9ec6
@@@ -12,7 -12,7 +12,7 @@@
         html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
         html_root_url = "https://doc.rust-lang.org/nightly/")]
  
- #![cfg_attr(not(stage0), feature(nll))]
+ #![feature(nll)]
  #![feature(rustc_diagnostic_macros)]
  
  #![recursion_limit="256"]
@@@ -434,7 -434,7 +434,7 @@@ impl<'b, 'a, 'tcx> ReachEverythingInThe
  
      fn predicates(&mut self) -> &mut Self {
          let predicates = self.ev.tcx.predicates_of(self.item_def_id);
 -        for predicate in &predicates.predicates {
 +        for (predicate, _) in &predicates.predicates {
              predicate.visit_with(self);
              match predicate {
                  &ty::Predicate::Trait(poly_predicate) => {
@@@ -781,7 -781,7 +781,7 @@@ impl<'a, 'tcx> Visitor<'tcx> for TypePr
              if self.check_trait_ref(*principal.skip_binder()) {
                  return;
              }
 -            for poly_predicate in projections {
 +            for (poly_predicate, _) in projections {
                  let tcx = self.tcx;
                  if self.check_trait_ref(poly_predicate.skip_binder().projection_ty.trait_ref(tcx)) {
                      return;
@@@ -956,7 -956,7 +956,7 @@@ impl<'a, 'tcx> TypeVisitor<'tcx> for Ty
                  }
              }
              ty::Opaque(def_id, ..) => {
 -                for predicate in &self.tcx.predicates_of(def_id).predicates {
 +                for (predicate, _) in &self.tcx.predicates_of(def_id).predicates {
                      let trait_ref = match *predicate {
                          ty::Predicate::Trait(ref poly_trait_predicate) => {
                              Some(poly_trait_predicate.skip_binder().trait_ref)
@@@ -1387,7 -1387,7 +1387,7 @@@ impl<'a, 'tcx: 'a> SearchInterfaceForPr
          // for the inferred outlives rules; see
          // `src/test/ui/rfc-2093-infer-outlives/privacy.rs`.
          let predicates = self.tcx.explicit_predicates_of(self.item_def_id);
 -        for predicate in &predicates.predicates {
 +        for (predicate, _) in &predicates.predicates {
              predicate.visit_with(self);
              match predicate {
                  &ty::Predicate::Trait(poly_predicate) => {
index 5e3f7470099117c806abfd11e5eba77ee59fe066,a4f8f16cac2b227663ea4812cf6f2a23a19755c6..a68c89deea5b6a070c7be0e57c6f8cf9117ecc47
@@@ -13,7 -13,7 +13,7 @@@
         html_root_url = "https://doc.rust-lang.org/nightly/")]
  
  #![feature(crate_visibility_modifier)]
- #![cfg_attr(not(stage0), feature(nll))]
+ #![feature(nll)]
  #![feature(rustc_diagnostic_macros)]
  #![feature(slice_sort_by_cached_key)]
  
@@@ -42,9 -42,8 +42,9 @@@ use rustc::lint
  use rustc::hir::def::*;
  use rustc::hir::def::Namespace::*;
  use rustc::hir::def_id::{CRATE_DEF_INDEX, LOCAL_CRATE, DefId};
 -use rustc::ty;
  use rustc::hir::{Freevar, FreevarMap, TraitCandidate, TraitMap, GlobMap};
 +use rustc::session::config::nightly_options;
 +use rustc::ty;
  use rustc::util::nodemap::{NodeMap, NodeSet, FxHashMap, FxHashSet, DefIdMap};
  
  use rustc_metadata::creader::CrateLoader;
@@@ -1382,9 -1381,6 +1382,9 @@@ pub struct Resolver<'a, 'b: 'a> 
      /// The current self type if inside an impl (used for better errors).
      current_self_type: Option<Ty>,
  
 +    /// The current self item if inside an ADT (used for better errors).
 +    current_self_item: Option<NodeId>,
 +
      /// The idents for the primitive types.
      primitive_type_table: PrimitiveTypeTable,
  
@@@ -1714,7 -1710,6 +1714,7 @@@ impl<'a, 'crateloader: 'a> Resolver<'a
  
              current_trait_ref: None,
              current_self_type: None,
 +            current_self_item: None,
  
              primitive_type_table: PrimitiveTypeTable::new(),
  
      }
  
      fn resolve_adt(&mut self, item: &Item, generics: &Generics) {
 -        self.with_type_parameter_rib(HasTypeParameters(generics, ItemRibKind), |this| {
 -            let item_def_id = this.definitions.local_def_id(item.id);
 -            if this.session.features_untracked().self_in_typedefs {
 -                this.with_self_rib(Def::SelfTy(None, Some(item_def_id)), |this| {
 +        self.with_current_self_item(item, |this| {
 +            this.with_type_parameter_rib(HasTypeParameters(generics, ItemRibKind), |this| {
 +                let item_def_id = this.definitions.local_def_id(item.id);
 +                if this.session.features_untracked().self_in_typedefs {
 +                    this.with_self_rib(Def::SelfTy(None, Some(item_def_id)), |this| {
 +                        visit::walk_item(this, item);
 +                    });
 +                } else {
                      visit::walk_item(this, item);
 -                });
 -            } else {
 -                visit::walk_item(this, item);
 -            }
 +                }
 +            });
          });
      }
  
          result
      }
  
 +    fn with_current_self_item<T, F>(&mut self, self_item: &Item, f: F) -> T
 +        where F: FnOnce(&mut Resolver) -> T
 +    {
 +        let previous_value = replace(&mut self.current_self_item, Some(self_item.id));
 +        let result = f(self);
 +        self.current_self_item = previous_value;
 +        result
 +    }
 +
      /// This is called to resolve a trait reference from an `impl` (i.e. `impl Trait for Foo`)
      fn with_optional_trait_ref<T, F>(&mut self, opt_trait_ref: Option<&TraitRef>, f: F) -> T
          where F: FnOnce(&mut Resolver, Option<DefId>) -> T
                      "traits and impls"
                  };
                  err.span_label(span, format!("`Self` is only available in {}", available_in));
 +                if this.current_self_item.is_some() && nightly_options::is_nightly_build() {
 +                    err.help("add #![feature(self_in_typedefs)] to the crate attributes \
 +                              to enable");
 +                }
                  return (err, Vec::new());
              }
              if is_self_value(path, ns) {
index f6045c7b2d2df2b1123406a40153d5e544cdd0c3,d98b0e8851bc901011e9df6f1d220aacfdee16a4..1148daef8e39120f9b684c262e86ab7596815c56
@@@ -12,7 -12,7 +12,7 @@@
         html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
         html_root_url = "https://doc.rust-lang.org/nightly/")]
  #![feature(custom_attribute)]
- #![cfg_attr(not(stage0), feature(nll))]
+ #![feature(nll)]
  #![allow(unused_attributes)]
  
  #![recursion_limit="256"]
@@@ -23,7 -23,6 +23,7 @@@ extern crate rustc
  #[macro_use]
  extern crate log;
  extern crate rustc_data_structures;
 +extern crate rustc_codegen_utils;
  extern crate rustc_serialize;
  extern crate rustc_target;
  extern crate rustc_typeck;
@@@ -46,10 -45,9 +46,10 @@@ use rustc::hir::def::Def as HirDef
  use rustc::hir::Node;
  use rustc::hir::def_id::{DefId, LOCAL_CRATE};
  use rustc::middle::cstore::ExternCrate;
 -use rustc::session::config::CrateType;
 +use rustc::session::config::{CrateType, Input, OutputType};
  use rustc::ty::{self, TyCtxt};
  use rustc_typeck::hir_ty_to_ty;
 +use rustc_codegen_utils::link::{filename_for_metadata, out_filename};
  
  use std::cell::Cell;
  use std::default::Default;
@@@ -112,24 -110,6 +112,24 @@@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx
          }
      }
  
 +    // Returns path to the compilation output (e.g. libfoo-12345678.rmeta)
 +    pub fn compilation_output(&self, crate_name: &str) -> PathBuf {
 +        let sess = &self.tcx.sess;
 +        // Save-analysis is emitted per whole session, not per each crate type
 +        let crate_type = sess.crate_types.borrow()[0];
 +        let outputs = &*self.tcx.output_filenames(LOCAL_CRATE);
 +
 +        if outputs.outputs.contains_key(&OutputType::Metadata) {
 +            filename_for_metadata(sess, crate_name, outputs)
 +        } else if outputs.outputs.should_codegen() {
 +            out_filename(sess, crate_type, outputs, crate_name)
 +        } else {
 +            // Otherwise it's only a DepInfo, in which case we return early and
 +            // not even reach the analysis stage.
 +            unreachable!()
 +        }
 +    }
 +
      // List external crates used by the current crate.
      pub fn get_external_crates(&self) -> Vec<ExternalCrateData> {
          let mut result = Vec::with_capacity(self.tcx.crates().len());
              result.push(ExternalCrateData {
                  // FIXME: change file_name field to PathBuf in rls-data
                  // https://github.com/nrc/rls-data/issues/7
 -                file_name: self.span_utils.make_path_string(&lo_loc.file.name),
 +                file_name: self.span_utils.make_filename_string(&lo_loc.file),
                  num: n.as_u32(),
                  id: GlobalCrateId {
                      name: self.tcx.crate_name(n).to_string(),
@@@ -1035,7 -1015,6 +1035,7 @@@ pub trait SaveHandler 
          save_ctxt: SaveContext<'l, 'tcx>,
          krate: &ast::Crate,
          cratename: &str,
 +        input: &'l Input,
      );
  }
  
@@@ -1101,14 -1080,12 +1101,14 @@@ impl<'a> SaveHandler for DumpHandler<'a
          save_ctxt: SaveContext<'l, 'tcx>,
          krate: &ast::Crate,
          cratename: &str,
 +        input: &'l Input,
      ) {
          let output = &mut self.output_file(&save_ctxt);
          let mut dumper = JsonDumper::new(output, save_ctxt.config.clone());
          let mut visitor = DumpVisitor::new(save_ctxt, &mut dumper);
  
          visitor.dump_crate_info(cratename, krate);
 +        visitor.dump_compilation_options(input, cratename);
          visit::walk_crate(&mut visitor, krate);
      }
  }
@@@ -1124,7 -1101,6 +1124,7 @@@ impl<'b> SaveHandler for CallbackHandle
          save_ctxt: SaveContext<'l, 'tcx>,
          krate: &ast::Crate,
          cratename: &str,
 +        input: &'l Input,
      ) {
          // We're using the JsonDumper here because it has the format of the
          // save-analysis results that we will pass to the callback. IOW, we are
          let mut visitor = DumpVisitor::new(save_ctxt, &mut dumper);
  
          visitor.dump_crate_info(cratename, krate);
 +        visitor.dump_compilation_options(input, cratename);
          visit::walk_crate(&mut visitor, krate);
      }
  }
@@@ -1145,7 -1120,6 +1145,7 @@@ pub fn process_crate<'l, 'tcx, H: SaveH
      krate: &ast::Crate,
      analysis: &'l ty::CrateAnalysis,
      cratename: &str,
 +    input: &'l Input,
      config: Option<Config>,
      mut handler: H,
  ) {
              impl_counter: Cell::new(0),
          };
  
 -        handler.save(save_ctxt, krate, cratename)
 +        handler.save(save_ctxt, krate, cratename, input)
      })
  }
  
index a00a9f8613b64b75554a144fc50987ad75e5257b,dd556e7d18eca2e193f88d588f2414ea1212da13..1f5998d8ca39514456b8a9ec5488d33a8ea59aa9
@@@ -75,7 -75,7 +75,7 @@@ This API is completely unstable and sub
  #![feature(box_syntax)]
  #![feature(crate_visibility_modifier)]
  #![feature(exhaustive_patterns)]
- #![cfg_attr(not(stage0), feature(nll))]
+ #![feature(nll)]
  #![feature(quote)]
  #![feature(refcell_replace_swap)]
  #![feature(rustc_diagnostic_macros)]
@@@ -146,7 -146,7 +146,7 @@@ fn require_c_abi_if_variadic(tcx: TyCtx
                               span: Span) {
      if decl.variadic && !(abi == Abi::C || abi == Abi::Cdecl) {
          let mut err = struct_span_err!(tcx.sess, span, E0045,
 -                  "variadic function must have C or cdecl calling convention");
 +            "variadic function must have C or cdecl calling convention");
          err.span_label(span, "variadics require C or cdecl calling convention").emit();
      }
  }
@@@ -186,29 -186,35 +186,29 @@@ fn check_main_fn_ty<'a, 'tcx>(tcx: TyCt
      let main_t = tcx.type_of(main_def_id);
      match main_t.sty {
          ty::FnDef(..) => {
 -            match tcx.hir.find(main_id) {
 -                Some(Node::Item(it)) => {
 -                    match it.node {
 -                        hir::ItemKind::Fn(.., ref generics, _) => {
 -                            let mut error = false;
 -                            if !generics.params.is_empty() {
 -                                let msg = "`main` function is not allowed to have generic \
 -                                           parameters".to_string();
 -                                let label = "`main` cannot have generic parameters".to_string();
 -                                struct_span_err!(tcx.sess, generics.span, E0131, "{}", msg)
 -                                    .span_label(generics.span, label)
 -                                    .emit();
 -                                error = true;
 -                            }
 -                            if let Some(sp) = generics.where_clause.span() {
 -                                struct_span_err!(tcx.sess, sp, E0646,
 -                                    "`main` function is not allowed to have a `where` clause")
 -                                    .span_label(sp, "`main` cannot have a `where` clause")
 -                                    .emit();
 -                                error = true;
 -                            }
 -                            if error {
 -                                return;
 -                            }
 -                        }
 -                        _ => ()
 +            if let Some(Node::Item(it)) = tcx.hir.find(main_id) {
 +                if let hir::ItemKind::Fn(.., ref generics, _) = it.node {
 +                    let mut error = false;
 +                    if !generics.params.is_empty() {
 +                        let msg = "`main` function is not allowed to have generic \
 +                                   parameters".to_owned();
 +                        let label = "`main` cannot have generic parameters".to_string();
 +                        struct_span_err!(tcx.sess, generics.span, E0131, "{}", msg)
 +                            .span_label(generics.span, label)
 +                            .emit();
 +                        error = true;
 +                    }
 +                    if let Some(sp) = generics.where_clause.span() {
 +                        struct_span_err!(tcx.sess, sp, E0646,
 +                            "`main` function is not allowed to have a `where` clause")
 +                            .span_label(sp, "`main` cannot have a `where` clause")
 +                            .emit();
 +                        error = true;
 +                    }
 +                    if error {
 +                        return;
                      }
                  }
 -                _ => ()
              }
  
              let actual = tcx.fn_sig(main_def_id);
@@@ -252,28 -258,34 +252,28 @@@ fn check_start_fn_ty<'a, 'tcx>(tcx: TyC
      let start_t = tcx.type_of(start_def_id);
      match start_t.sty {
          ty::FnDef(..) => {
 -            match tcx.hir.find(start_id) {
 -                Some(Node::Item(it)) => {
 -                    match it.node {
 -                        hir::ItemKind::Fn(.., ref generics, _) => {
 -                            let mut error = false;
 -                            if !generics.params.is_empty() {
 -                                struct_span_err!(tcx.sess, generics.span, E0132,
 -                                    "start function is not allowed to have type parameters")
 -                                    .span_label(generics.span,
 -                                                "start function cannot have type parameters")
 -                                    .emit();
 -                                error = true;
 -                            }
 -                            if let Some(sp) = generics.where_clause.span() {
 -                                struct_span_err!(tcx.sess, sp, E0647,
 -                                    "start function is not allowed to have a `where` clause")
 -                                    .span_label(sp, "start function cannot have a `where` clause")
 -                                    .emit();
 -                                error = true;
 -                            }
 -                            if error {
 -                                return;
 -                            }
 -                        }
 -                        _ => ()
 +            if let Some(Node::Item(it)) = tcx.hir.find(start_id) {
 +                if let hir::ItemKind::Fn(.., ref generics, _) = it.node {
 +                    let mut error = false;
 +                    if !generics.params.is_empty() {
 +                        struct_span_err!(tcx.sess, generics.span, E0132,
 +                            "start function is not allowed to have type parameters")
 +                            .span_label(generics.span,
 +                                        "start function cannot have type parameters")
 +                            .emit();
 +                        error = true;
 +                    }
 +                    if let Some(sp) = generics.where_clause.span() {
 +                        struct_span_err!(tcx.sess, sp, E0647,
 +                            "start function is not allowed to have a `where` clause")
 +                            .span_label(sp, "start function cannot have a `where` clause")
 +                            .emit();
 +                        error = true;
 +                    }
 +                    if error {
 +                        return;
                      }
                  }
 -                _ => ()
              }
  
              let se_ty = tcx.mk_fn_ptr(ty::Binder::bind(
@@@ -376,12 -388,11 +376,12 @@@ pub fn hir_ty_to_ty<'a, 'tcx>(tcx: TyCt
      let env_node_id = tcx.hir.get_parent(hir_ty.id);
      let env_def_id = tcx.hir.local_def_id(env_node_id);
      let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id);
 +
      astconv::AstConv::ast_ty_to_ty(&item_cx, hir_ty)
  }
  
  pub fn hir_trait_to_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir_trait: &hir::TraitRef)
 -        -> (ty::PolyTraitRef<'tcx>, Vec<ty::PolyProjectionPredicate<'tcx>>) {
 +        -> (ty::PolyTraitRef<'tcx>, Vec<(ty::PolyProjectionPredicate<'tcx>, Span)>) {
      // In case there are any projections etc, find the "environment"
      // def-id that will be used to determine the traits/predicates in
      // scope.  This is derived from the enclosing item-like thing.
      let principal = astconv::AstConv::instantiate_poly_trait_ref_inner(
          &item_cx, hir_trait, tcx.types.err, &mut projections, true
      );
 +
      (principal, projections)
  }
  
diff --combined src/libstd/panicking.rs
index f79c986cc89e454603eb3aa283a45d97c09461f4,6d548443bbff776167fe70b352bcecf590f3a9d2..df085a7f450b099640410acceff6427440379882
@@@ -319,8 -319,7 +319,7 @@@ pub fn panicking() -> bool 
  
  /// Entry point of panic from the libcore crate.
  #[cfg(not(test))]
- #[cfg_attr(stage0, panic_implementation)]
- #[cfg_attr(not(stage0), panic_handler)]
+ #[panic_handler]
  #[unwind(allowed)]
  pub fn rust_begin_panic(info: &PanicInfo) -> ! {
      continue_panic_fmt(&info)
@@@ -398,7 -397,7 +397,7 @@@ fn continue_panic_fmt(info: &PanicInfo
  #[unstable(feature = "libstd_sys_internals",
             reason = "used by the panic! macro",
             issue = "0")]
- #[cfg_attr(not(any(stage0, test)), lang = "begin_panic")]
+ #[cfg_attr(not(test), lang = "begin_panic")]
  #[inline(never)] #[cold] // avoid code bloat at the call sites as much as possible
  pub fn begin_panic<M: Any + Send>(msg: M, file_line_col: &(&'static str, u32, u32)) -> ! {
      // Note that this should be the only allocation performed in this code path.
@@@ -517,7 -516,6 +516,7 @@@ pub fn update_count_then_panic(msg: Box
  }
  
  /// A private no-mangle function on which to slap yer breakpoints.
 +#[inline(never)]
  #[no_mangle]
  #[allow(private_no_mangle_fns)] // yes we get it, but we like breakpoints
  pub fn rust_panic(mut msg: &mut dyn BoxMeUp) -> ! {
diff --combined src/libsyntax_pos/lib.rs
index 67fd847a2ae9197790a0d2a71917e0cec74d84fb,e754fe26a766fb5e5a288af76f61bce8661aa586..45eaf1d3190f2f5ac4dc285d9b05b7f873b0629a
  #![feature(const_fn)]
  #![feature(crate_visibility_modifier)]
  #![feature(custom_attribute)]
- #![cfg_attr(not(stage0), feature(nll))]
+ #![feature(nll)]
  #![feature(non_exhaustive)]
  #![feature(optin_builtin_traits)]
  #![feature(specialization)]
- #![feature(stdsimd)]
+ #![cfg_attr(not(stage0), feature(stdsimd))]
  
  use std::borrow::Cow;
  use std::cell::Cell;
@@@ -87,7 -87,7 +87,7 @@@ scoped_thread_local!(pub static GLOBALS
  #[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash, RustcDecodable, RustcEncodable)]
  pub enum FileName {
      Real(PathBuf),
 -    /// e.g. "std" macros
 +    /// A macro.  This includes the full name of the macro, so that there are no clashes.
      Macros(String),
      /// call to `quote!`
      QuoteExpansion,