use config::Config;
// The version number
-pub const CFG_RELEASE_NUM: &str = "1.30.0";
+pub const CFG_RELEASE_NUM: &str = "1.31.0";
pub struct GitInfo {
inner: Option<Info>,
#![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)]
#![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)]
#![feature(lang_items)]
#![feature(libc)]
#![feature(needs_allocator)]
+#![feature(nll)]
#![feature(optin_builtin_traits)]
#![feature(pattern)]
#![feature(pin)]
#![feature(allocator_api)]
#![feature(alloc_system)]
#![feature(box_syntax)]
-#![cfg_attr(stage0, feature(const_fn))]
-#![cfg_attr(not(stage0), feature(min_const_fn))]
+#![feature(min_const_fn)]
#![feature(drain_filter)]
#![feature(exact_size_is_empty)]
#![feature(pattern)]
#![feature(core_intrinsics)]
#![feature(libc)]
#![feature(linkage)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(staged_api)]
#![feature(rustc_attrs)]
#![cfg_attr(dummy_jemalloc, allow(dead_code, unused_extern_crates))]
// ABI
#[rustc_std_internal_symbol]
- #[cfg_attr(stage0, no_mangle)]
pub unsafe extern fn __rde_alloc(size: usize, align: usize) -> *mut u8 {
let flags = align_to_flags(align, size);
let ptr = mallocx(size as size_t, flags) as *mut u8;
}
#[rustc_std_internal_symbol]
- #[cfg_attr(stage0, no_mangle)]
pub unsafe extern fn __rde_dealloc(ptr: *mut u8,
size: usize,
align: usize) {
}
#[rustc_std_internal_symbol]
- #[cfg_attr(stage0, no_mangle)]
pub unsafe extern fn __rde_realloc(ptr: *mut u8,
_old_size: usize,
align: usize,
}
#[rustc_std_internal_symbol]
- #[cfg_attr(stage0, no_mangle)]
pub unsafe extern fn __rde_alloc_zeroed(size: usize, align: usize) -> *mut u8 {
let ptr = if align <= MIN_ALIGN && align <= size {
calloc(size as size_t, 1) as *mut u8
#![feature(allocator_api)]
#![feature(core_intrinsics)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(staged_api)]
#![feature(rustc_attrs)]
#![cfg_attr(any(unix, target_os = "cloudabi", target_os = "redox"), feature(libc))]
#![feature(alloc)]
#![feature(core_intrinsics)]
#![feature(dropck_eyepatch)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(raw_vec_internals)]
#![cfg_attr(test, feature(test))]
#![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)]
/// [alignment]: ./fn.align_of.html
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
-#[cfg(not(stage0))]
pub const fn size_of<T>() -> usize {
intrinsics::size_of::<T>()
}
-#[inline]
-#[stable(feature = "rust1", since = "1.0.0")]
-#[cfg(stage0)]
-/// Ceci n'est pas la documentation
-pub const fn size_of<T>() -> usize {
- unsafe { intrinsics::size_of::<T>() }
-}
-
/// Returns the size of the pointed-to value in bytes.
///
/// This is usually the same as `size_of::<T>()`. However, when `T` *has* no
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_deprecated(reason = "use `align_of` instead", since = "1.2.0")]
-#[cfg(not(stage0))]
pub fn min_align_of<T>() -> usize {
intrinsics::min_align_of::<T>()
}
-#[inline]
-#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_deprecated(reason = "use `align_of` instead", since = "1.2.0")]
-#[cfg(stage0)]
-/// Ceci n'est pas la documentation
-pub fn min_align_of<T>() -> usize {
- unsafe { intrinsics::min_align_of::<T>() }
-}
-
/// Returns the [ABI]-required minimum alignment of the type of the value that `val` points to.
///
/// Every reference to a value of the type `T` must be a multiple of this number.
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
-#[cfg(not(stage0))]
pub const fn align_of<T>() -> usize {
intrinsics::min_align_of::<T>()
}
-#[inline]
-#[stable(feature = "rust1", since = "1.0.0")]
-#[cfg(stage0)]
-/// Ceci n'est pas la documentation
-pub const fn align_of<T>() -> usize {
- unsafe { intrinsics::min_align_of::<T>() }
-}
-
/// Returns the [ABI]-required minimum alignment of the type of the value that `val` points to.
///
/// Every reference to a value of the type `T` must be a multiple of this number.
/// A wrapper type for raw pointers and integers that will never be
/// NULL or 0 that might allow certain optimizations.
-#[cfg_attr(stage0, lang = "non_zero")]
-#[cfg_attr(not(stage0), rustc_layout_scalar_valid_range_start(1))]
+#[rustc_layout_scalar_valid_range_start(1)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(transparent)]
pub(crate) struct NonZero<T>(pub(crate) T);
}
+ #[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
}
}
}
- /// 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.
#[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
#[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
}
}
}
- /// 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.
#[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
}
}
}
- /// 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.
#[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.
#[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.
#[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)
}
}
- /// 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.
#[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.
#[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)
}
}
- /// 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`
#[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`
#[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`.
#[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,
}
}
- /// 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.
#[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.
#[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)))
}
}
}
- /// 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.
#[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.
#[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.
#[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.
#[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
#[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.
#[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
#[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.
#[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) }
}
}
}
- /// 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.
#[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
#[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))
}
}
}
- /// 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.
#[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 }
}
}
}
- /// 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.
#[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.
#[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)
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
#[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
#[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)
}
}
- /// 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`
#[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`
#[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,
}
}
- /// 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.
#[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.
#[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)))
}
}
}
- /// 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.
#[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.
#[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
#[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.
#[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
#[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.
#[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) }
}
_ => panic!("Expected the const item as a pattern to match.")
}
}
+
+#[test]
+fn test_from_nonzero() {
+ let nz = NonZeroU32::new(1).unwrap();
+ let num: u32 = nz.into();
+ assert_eq!(num, 1u32);
+}
html_playground_url = "https://play.rust-lang.org/",
test(attr(deny(warnings))))]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
pub use self::Piece::*;
pub use self::Position::*;
html_root_url = "https://doc.rust-lang.org/nightly/",
test(attr(allow(unused_variables), deny(warnings))))]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(str_escape)]
use self::LabelText::*;
#![feature(core_intrinsics)]
#![feature(libc)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(panic_runtime)]
#![feature(staged_api)]
#![feature(rustc_attrs)]
// Rust's "try" function, but if we're aborting on panics we just call the
// function as there's nothing else we need to do here.
-#[cfg_attr(stage0, no_mangle)]
#[rustc_std_internal_symbol]
pub unsafe extern fn __rust_maybe_catch_panic(f: fn(*mut u8),
data: *mut u8,
// which would break compat with XP. For now just use `intrinsics::abort` which
// will kill us with an illegal instruction, which will do a good enough job for
// now hopefully.
-#[cfg_attr(stage0, no_mangle)]
#[rustc_std_internal_symbol]
pub unsafe extern fn __rust_start_panic(_payload: usize) -> u32 {
abort();
#![feature(core_intrinsics)]
#![feature(lang_items)]
#![feature(libc)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(panic_unwind)]
#![feature(raw)]
#![feature(staged_api)]
test(no_crate_inject, attr(deny(warnings))),
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(lang_items)]
reason = "internal implementation detail of rustc right now",
issue = "0")]
#![allow(unused_features)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(staged_api)]
/// refers to something from the previous compilation session that
/// has been removed.
#[inline]
- pub fn extract_def_id(&self, tcx: TyCtxt) -> Option<DefId> {
+ pub fn extract_def_id(&self, tcx: TyCtxt<'_, '_, '_>) -> Option<DefId> {
if self.kind.can_reconstruct_query_key() {
let def_path_hash = DefPathHash(self.hash);
tcx.def_path_hash_to_def_id.as_ref()?
}
impl fmt::Debug for DepNode {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", self.kind)?;
if !self.kind.has_params() && !self.kind.is_anon() {
impl DefId {
#[inline]
- pub fn to_dep_node(self, tcx: TyCtxt, kind: DepKind) -> DepNode {
+ pub fn to_dep_node(self, tcx: TyCtxt<'_, '_, '_>, kind: DepKind) -> DepNode {
DepNode::from_def_path_hash(kind, tcx.def_path_hash(self))
}
}
impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for DefId {
const CAN_RECONSTRUCT_QUERY_KEY: bool = true;
- fn to_fingerprint(&self, tcx: TyCtxt) -> Fingerprint {
+ fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint {
tcx.def_path_hash(*self).0
}
impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for DefIndex {
const CAN_RECONSTRUCT_QUERY_KEY: bool = true;
- fn to_fingerprint(&self, tcx: TyCtxt) -> Fingerprint {
+ fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint {
tcx.hir.definitions().def_path_hash(*self).0
}
impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for CrateNum {
const CAN_RECONSTRUCT_QUERY_KEY: bool = true;
- fn to_fingerprint(&self, tcx: TyCtxt) -> Fingerprint {
+ fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint {
let def_id = DefId {
krate: *self,
index: CRATE_DEF_INDEX,
// We actually would not need to specialize the implementation of this
// method but it's faster to combine the hashes than to instantiate a full
// hashing context and stable-hashing state.
- fn to_fingerprint(&self, tcx: TyCtxt) -> Fingerprint {
+ fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint {
let (def_id_0, def_id_1) = *self;
let def_path_hash_0 = tcx.def_path_hash(def_id_0);
// We actually would not need to specialize the implementation of this
// method but it's faster to combine the hashes than to instantiate a full
// hashing context and stable-hashing state.
- fn to_fingerprint(&self, tcx: TyCtxt) -> Fingerprint {
+ fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint {
let HirId {
owner,
local_id: ItemLocalId(local_id),
}
impl ::std::fmt::Debug for CrateNum {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
CrateNum::Index(id) => write!(fmt, "crate{}", id.private),
CrateNum::Invalid => write!(fmt, "invalid crate"),
}
impl fmt::Display for CrateNum {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
CrateNum::Index(id) => fmt::Display::fmt(&id.private, f),
CrateNum::Invalid => write!(f, "invalid crate"),
pub const CRATE_DEF_INDEX: DefIndex = DefIndex(0);
impl fmt::Debug for DefIndex {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f,
"DefIndex({}:{})",
self.address_space().index(),
}
impl fmt::Debug for DefId {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "DefId({:?}/{}:{}",
self.krate.index(),
self.index.address_space().index(),
}
impl fmt::Debug for LocalDefId {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.to_def_id().fmt(f)
}
}
f: F,
) -> (Vec<hir::GenericParam>, T)
where
- F: FnOnce(&mut LoweringContext) -> (Vec<hir::GenericParam>, T),
+ F: FnOnce(&mut LoweringContext<'_>) -> (Vec<hir::GenericParam>, T),
{
assert!(!self.is_collecting_in_band_lifetimes);
assert!(self.lifetimes_to_define.is_empty());
// for them.
fn with_in_scope_lifetime_defs<T, F>(&mut self, params: &[GenericParam], f: F) -> T
where
- F: FnOnce(&mut LoweringContext) -> T,
+ F: FnOnce(&mut LoweringContext<'_>) -> T,
{
let old_len = self.in_scope_lifetimes.len();
let lt_def_names = params.iter().filter_map(|param| match param.kind {
params: &HirVec<hir::GenericParam>,
f: F
) -> T where
- F: FnOnce(&mut LoweringContext) -> T,
+ F: FnOnce(&mut LoweringContext<'_>) -> T,
{
let old_len = self.in_scope_lifetimes.len();
let lt_def_names = params.iter().filter_map(|param| match param.kind {
f: F,
) -> (hir::Generics, T)
where
- F: FnOnce(&mut LoweringContext, &mut Vec<hir::GenericParam>) -> T,
+ F: FnOnce(&mut LoweringContext<'_>, &mut Vec<hir::GenericParam>) -> T,
{
let (in_band_defs, (mut lowered_generics, res)) = self.with_in_scope_lifetime_defs(
&generics.params,
fn with_catch_scope<T, F>(&mut self, catch_id: NodeId, f: F) -> T
where
- F: FnOnce(&mut LoweringContext) -> T,
+ F: FnOnce(&mut LoweringContext<'_>) -> T,
{
let len = self.catch_scopes.len();
self.catch_scopes.push(catch_id);
capture_clause: CaptureBy,
closure_node_id: NodeId,
ret_ty: Option<&Ty>,
- body: impl FnOnce(&mut LoweringContext) -> hir::Expr,
+ body: impl FnOnce(&mut LoweringContext<'_>) -> hir::Expr,
) -> hir::ExprKind {
let prev_is_generator = mem::replace(&mut self.is_generator, true);
let body_expr = body(self);
fn lower_body<F>(&mut self, decl: Option<&FnDecl>, f: F) -> hir::BodyId
where
- F: FnOnce(&mut LoweringContext) -> hir::Expr,
+ F: FnOnce(&mut LoweringContext<'_>) -> hir::Expr,
{
let prev = mem::replace(&mut self.is_generator, false);
let result = f(self);
fn with_loop_scope<T, F>(&mut self, loop_id: NodeId, f: F) -> T
where
- F: FnOnce(&mut LoweringContext) -> T,
+ F: FnOnce(&mut LoweringContext<'_>) -> T,
{
// We're no longer in the base loop's condition; we're in another loop.
let was_in_loop_condition = self.is_in_loop_condition;
fn with_loop_condition_scope<T, F>(&mut self, f: F) -> T
where
- F: FnOnce(&mut LoweringContext) -> T,
+ F: FnOnce(&mut LoweringContext<'_>) -> T,
{
let was_in_loop_condition = self.is_in_loop_condition;
self.is_in_loop_condition = true;
fn with_new_scopes<T, F>(&mut self, f: F) -> T
where
- F: FnOnce(&mut LoweringContext) -> T,
+ F: FnOnce(&mut LoweringContext<'_>) -> T,
{
let was_in_loop_condition = self.is_in_loop_condition;
self.is_in_loop_condition = false;
}
}
- fn lower_ty_binding(&mut self, b: &TypeBinding, itctx: ImplTraitContext) -> hir::TypeBinding {
+ fn lower_ty_binding(&mut self, b: &TypeBinding,
+ itctx: ImplTraitContext<'_>) -> hir::TypeBinding {
hir::TypeBinding {
id: self.lower_node_id(b.id).node_id,
ident: b.ident,
fn lower_generic_arg(&mut self,
arg: &ast::GenericArg,
- itctx: ImplTraitContext)
+ itctx: ImplTraitContext<'_>)
-> hir::GenericArg {
match arg {
ast::GenericArg::Lifetime(lt) => GenericArg::Lifetime(self.lower_lifetime(<)),
}
}
- fn lower_ty(&mut self, t: &Ty, itctx: ImplTraitContext) -> P<hir::Ty> {
+ fn lower_ty(&mut self, t: &Ty, itctx: ImplTraitContext<'_>) -> P<hir::Ty> {
P(self.lower_ty_direct(t, itctx))
}
- fn lower_ty_direct(&mut self, t: &Ty, mut itctx: ImplTraitContext) -> hir::Ty {
+ fn lower_ty_direct(&mut self, t: &Ty, mut itctx: ImplTraitContext<'_>) -> hir::Ty {
let kind = match t.node {
TyKind::Infer => hir::TyKind::Infer,
TyKind::Err => hir::TyKind::Err,
span: Span,
fn_def_id: Option<DefId>,
exist_ty_node_id: NodeId,
- lower_bounds: impl FnOnce(&mut LoweringContext) -> hir::GenericBounds,
+ lower_bounds: impl FnOnce(&mut LoweringContext<'_>) -> hir::GenericBounds,
) -> hir::TyKind {
// Make sure we know that some funky desugaring has been going on here.
// This is a first: there is code in other places like for loop
qself: &Option<QSelf>,
p: &Path,
param_mode: ParamMode,
- mut itctx: ImplTraitContext,
+ mut itctx: ImplTraitContext<'_>,
) -> hir::QPath {
let qself_position = qself.as_ref().map(|q| q.position);
let qself = qself.as_ref().map(|q| self.lower_ty(&q.ty, itctx.reborrow()));
param_mode: ParamMode,
expected_lifetimes: usize,
parenthesized_generic_args: ParenthesizedGenericArgs,
- itctx: ImplTraitContext,
+ itctx: ImplTraitContext<'_>,
) -> hir::PathSegment {
let (mut generic_args, infer_types) = if let Some(ref generic_args) = segment.args {
let msg = "parenthesized parameters may only be used with a trait";
&mut self,
data: &AngleBracketedArgs,
param_mode: ParamMode,
- mut itctx: ImplTraitContext,
+ mut itctx: ImplTraitContext<'_>,
) -> (hir::GenericArgs, bool) {
let &AngleBracketedArgs { ref args, ref bindings, .. } = data;
let has_types = args.iter().any(|arg| match arg {
self.with_anonymous_lifetime_mode(
AnonymousLifetimeMode::PassThrough,
|this| {
- const DISALLOWED: ImplTraitContext = ImplTraitContext::Disallowed;
+ const DISALLOWED: ImplTraitContext<'_> = ImplTraitContext::Disallowed;
let &ParenthesisedArgs { ref inputs, ref output, span } = data;
let inputs = inputs.iter().map(|ty| this.lower_ty_direct(ty, DISALLOWED)).collect();
let mk_tup = |this: &mut Self, tys, span| {
fn lower_param_bound(
&mut self,
tpb: &GenericBound,
- itctx: ImplTraitContext,
+ itctx: ImplTraitContext<'_>,
) -> hir::GenericBound {
match *tpb {
GenericBound::Trait(ref ty, modifier) => hir::GenericBound::Trait(
&mut self,
params: &[GenericParam],
add_bounds: &NodeMap<Vec<GenericBound>>,
- mut itctx: ImplTraitContext,
+ mut itctx: ImplTraitContext<'_>,
) -> hir::HirVec<hir::GenericParam> {
params.iter().map(|param| {
self.lower_generic_param(param, add_bounds, itctx.reborrow())
fn lower_generic_param(&mut self,
param: &GenericParam,
add_bounds: &NodeMap<Vec<GenericBound>>,
- mut itctx: ImplTraitContext)
+ mut itctx: ImplTraitContext<'_>)
-> hir::GenericParam {
let mut bounds = self.lower_param_bounds(¶m.bounds, itctx.reborrow());
match param.kind {
fn lower_generics(
&mut self,
generics: &Generics,
- itctx: ImplTraitContext)
+ itctx: ImplTraitContext<'_>)
-> hir::Generics
{
// Collect `?Trait` bounds in where clause and move them to parameter definitions.
}
}
- fn lower_trait_ref(&mut self, p: &TraitRef, itctx: ImplTraitContext) -> hir::TraitRef {
+ fn lower_trait_ref(&mut self, p: &TraitRef, itctx: ImplTraitContext<'_>) -> hir::TraitRef {
let path = match self.lower_qpath(p.ref_id, &None, &p.path, ParamMode::Explicit, itctx) {
hir::QPath::Resolved(None, path) => path.and_then(|path| path),
qpath => bug!("lower_trait_ref: unexpected QPath `{:?}`", qpath),
fn lower_poly_trait_ref(
&mut self,
p: &PolyTraitRef,
- mut itctx: ImplTraitContext,
+ mut itctx: ImplTraitContext<'_>,
) -> hir::PolyTraitRef {
let bound_generic_params =
self.lower_generic_params(&p.bound_generic_params, &NodeMap(), itctx.reborrow());
}
}
- fn lower_mt(&mut self, mt: &MutTy, itctx: ImplTraitContext) -> hir::MutTy {
+ fn lower_mt(&mut self, mt: &MutTy, itctx: ImplTraitContext<'_>) -> hir::MutTy {
hir::MutTy {
ty: self.lower_ty(&mt.ty, itctx),
mutbl: self.lower_mutability(mt.mutbl),
}
}
- fn lower_param_bounds(&mut self, bounds: &[GenericBound], mut itctx: ImplTraitContext)
+ fn lower_param_bounds(&mut self, bounds: &[GenericBound], mut itctx: ImplTraitContext<'_>)
-> hir::GenericBounds {
bounds.iter().map(|bound| self.lower_param_bound(bound, itctx.reborrow())).collect()
}
impl<'a> FnLikeNode<'a> {
/// Attempts to construct a FnLikeNode from presumed FnLike node input.
- pub fn from_node(node: Node) -> Option<FnLikeNode> {
+ pub fn from_node(node: Node<'_>) -> Option<FnLikeNode<'_>> {
let fn_like = match node {
map::Node::Item(item) => item.is_fn_like(),
map::Node::TraitItem(tm) => tm.is_fn_like(),
}
pub fn span(self) -> Span {
- self.handle(|i: ItemFnParts| i.span,
+ self.handle(|i: ItemFnParts<'_>| i.span,
|_, _, _: &'a ast::MethodSig, _, _, span, _| span,
- |c: ClosureParts| c.span)
+ |c: ClosureParts<'_>| c.span)
}
pub fn id(self) -> NodeId {
- self.handle(|i: ItemFnParts| i.id,
+ self.handle(|i: ItemFnParts<'_>| i.id,
|id, _, _: &'a ast::MethodSig, _, _, _, _| id,
- |c: ClosureParts| c.id)
+ |c: ClosureParts<'_>| c.id)
}
pub fn constness(self) -> ast::Constness {
/// }
/// ```
pub fn get_return_block(&self, id: NodeId) -> Option<NodeId> {
- let match_fn = |node: &Node| {
+ let match_fn = |node: &Node<'_>| {
match *node {
Node::Item(_) |
Node::ForeignItem(_) |
_ => false,
}
};
- let match_non_returning_block = |node: &Node| {
+ let match_non_returning_block = |node: &Node<'_>| {
match *node {
Node::Expr(ref expr) => {
match expr.node {
// If `id` itself is a mod named `m` with parent `p`, then
// returns `Some(id, m, p)`. If `id` has no mod in its parent
// chain, then returns `None`.
- fn find_first_mod_parent<'a>(map: &'a Map, mut id: NodeId) -> Option<(NodeId, Name)> {
+ fn find_first_mod_parent<'a>(map: &'a Map<'_>, mut id: NodeId) -> Option<(NodeId, Name)> {
loop {
if let Node::Item(item) = map.find(id)? {
if item_is_mod(&item) {
/// Identical to the `PpAnn` implementation for `hir::Crate`,
/// except it avoids creating a dependency on the whole crate.
impl<'hir> print::PpAnn for Map<'hir> {
- fn nested(&self, state: &mut print::State, nested: print::Nested) -> io::Result<()> {
+ fn nested(&self, state: &mut print::State<'_>, nested: print::Nested) -> io::Result<()> {
match nested {
Nested::Item(id) => state.print_item(self.expect_item(id.id)),
Nested::TraitItem(id) => state.print_trait_item(self.trait_item(id)),
}
impl<'a> print::State<'a> {
- pub fn print_node(&mut self, node: Node) -> io::Result<()> {
+ pub fn print_node(&mut self, node: Node<'_>) -> io::Result<()> {
match node {
Node::Item(a) => self.print_item(&a),
Node::ForeignItem(a) => self.print_foreign_item(&a),
}
}
-fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
+fn node_id_to_string(map: &Map<'_>, id: NodeId, include_id: bool) -> String {
let id_str = format!(" (id={})", id);
let id_str = if include_id { &id_str[..] } else { "" };
}
}
-pub fn describe_def(tcx: TyCtxt, def_id: DefId) -> Option<Def> {
+pub fn describe_def(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option<Def> {
if let Some(node_id) = tcx.hir.as_local_node_id(def_id) {
tcx.hir.describe_def(node_id)
} else {
}
impl fmt::Debug for Label {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "label({:?})", self.ident)
}
}
}
impl fmt::Display for Lifetime {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.name.ident().fmt(f)
}
}
impl fmt::Debug for Lifetime {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f,
"lifetime({}: {})",
self.id,
}
impl fmt::Debug for Path {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "path({})", print::to_string(print::NO_ANN, |s| s.print_path(self, false)))
}
}
impl fmt::Display for Path {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", print::to_string(print::NO_ANN, |s| s.print_path(self, false)))
}
}
}
impl fmt::Debug for Pat {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "pat({}: {})", self.id,
print::to_string(print::NO_ANN, |s| s.print_pat(self)))
}
pub type Stmt = Spanned<StmtKind>;
impl fmt::Debug for StmtKind {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// Sadness.
let spanned = source_map::dummy_spanned(self.clone());
write!(f,
}
impl fmt::Debug for Expr {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "expr({}: {})", self.id,
print::to_string(print::NO_ANN, |s| s.print_expr(self)))
}
}
impl fmt::Display for LoopIdError {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(match *self {
LoopIdError::OutsideLoopScope => "not inside loop scope",
LoopIdError::UnlabeledCfInWhileCondition =>
}
impl fmt::Debug for Ty {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "type({})",
print::to_string(print::NO_ANN, |s| s.print_type(self)))
}
}
impl fmt::Display for Unsafety {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(match *self {
Unsafety::Normal => "normal",
Unsafety::Unsafe => "unsafe",
}
impl fmt::Debug for ImplPolarity {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
ImplPolarity::Positive => "positive".fmt(f),
ImplPolarity::Negative => "negative".fmt(f),
// imported.
pub type GlobMap = NodeMap<FxHashSet<Name>>;
-pub fn provide(providers: &mut Providers) {
+
+pub fn provide(providers: &mut Providers<'_>) {
providers.describe_def = map::describe_def;
}
}
pub trait PpAnn {
- fn nested(&self, _state: &mut State, _nested: Nested) -> io::Result<()> {
+ fn nested(&self, _state: &mut State<'_>, _nested: Nested) -> io::Result<()> {
Ok(())
}
- fn pre(&self, _state: &mut State, _node: AnnNode) -> io::Result<()> {
+ fn pre(&self, _state: &mut State<'_>, _node: AnnNode<'_>) -> io::Result<()> {
Ok(())
}
- fn post(&self, _state: &mut State, _node: AnnNode) -> io::Result<()> {
+ fn post(&self, _state: &mut State<'_>, _node: AnnNode<'_>) -> io::Result<()> {
Ok(())
}
fn try_fetch_item(&self, _: ast::NodeId) -> Option<&hir::Item> {
fn try_fetch_item(&self, item: ast::NodeId) -> Option<&hir::Item> {
Some(self.item(item))
}
- fn nested(&self, state: &mut State, nested: Nested) -> io::Result<()> {
+ fn nested(&self, state: &mut State<'_>, nested: Nested) -> io::Result<()> {
match nested {
Nested::Item(id) => state.print_item(self.item(id.id)),
Nested::TraitItem(id) => state.print_trait_item(self.trait_item(id)),
}
pub fn to_string<F>(ann: &dyn PpAnn, f: F) -> String
- where F: FnOnce(&mut State) -> io::Result<()>
+ where F: FnOnce(&mut State<'_>) -> io::Result<()>
{
let mut wr = Vec::new();
{
mut op: F,
mut get_span: G)
-> io::Result<()>
- where F: FnMut(&mut State, &T) -> io::Result<()>,
+ where F: FnMut(&mut State<'_>, &T) -> io::Result<()>,
G: FnMut(&T) -> syntax_pos::Span
{
self.rbox(0, b)?;
pub fn note_and_explain_region(
self,
region_scope_tree: ®ion::ScopeTree,
- err: &mut DiagnosticBuilder,
+ err: &mut DiagnosticBuilder<'_>,
prefix: &str,
region: ty::Region<'tcx>,
suffix: &str,
pub fn note_and_explain_free_region(
self,
- err: &mut DiagnosticBuilder,
+ err: &mut DiagnosticBuilder<'_>,
prefix: &str,
region: ty::Region<'tcx>,
suffix: &str,
}
fn emit_msg_span(
- err: &mut DiagnosticBuilder,
+ err: &mut DiagnosticBuilder<'_>,
prefix: &str,
description: String,
span: Option<Span>,
/// Adds a note if the types come from similarly named crates
fn check_and_note_conflicting_crates(
&self,
- err: &mut DiagnosticBuilder,
+ err: &mut DiagnosticBuilder<'_>,
terr: &TypeError<'tcx>,
sp: Span,
) {
- let report_path_match = |err: &mut DiagnosticBuilder, did1: DefId, did2: DefId| {
+ let report_path_match = |err: &mut DiagnosticBuilder<'_>, did1: DefId, did2: DefId| {
// Only external crates, if either is from a local
// module we could have false positives
if !(did1.is_local() || did2.is_local()) && did1.krate != did2.krate {
values.1.push_normal("<");
}
- fn lifetime_display(lifetime: Region) -> String {
+ fn lifetime_display(lifetime: Region<'_>) -> String {
let s = lifetime.to_string();
if s.is_empty() {
"'_".to_string()
&self,
anon_region: Region<'tcx>,
replace_region: Region<'tcx>,
- ) -> Option<AnonymousArgInfo> {
+ ) -> Option<AnonymousArgInfo<'_>> {
let (id, bound_region) = match *anon_region {
ty::ReFree(ref free_region) => (free_region.scope, free_region.bound_region),
ty::ReEarlyBound(ref ebr) => (
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
pub(super) fn note_region_origin(&self,
- err: &mut DiagnosticBuilder,
+ err: &mut DiagnosticBuilder<'_>,
origin: &SubregionOrigin<'tcx>) {
match *origin {
infer::Subtype(ref trace) => {
.collect()
}
-fn is_var_in_set(new_vars: &[ty::RegionVid], r: ty::Region) -> bool {
+fn is_var_in_set(new_vars: &[ty::RegionVid], r: ty::Region<'_>) -> bool {
match *r {
ty::ReVar(ref v) => new_vars.iter().any(|x| x == v),
_ => false
impl<'a, 'gcx, 'tcx> dot::Labeller<'a> for ConstraintGraph<'a, 'gcx, 'tcx> {
type Node = Node;
type Edge = Edge<'tcx>;
- fn graph_id(&self) -> dot::Id {
+ fn graph_id(&self) -> dot::Id<'_> {
dot::Id::new(&*self.graph_name).unwrap()
}
- fn node_id(&self, n: &Node) -> dot::Id {
+ fn node_id(&self, n: &Node) -> dot::Id<'_> {
let node_id = match self.node_ids.get(n) {
Some(node_id) => node_id,
None => bug!("no node_id found for node: {:?}", n),
}
}
}
- fn node_label(&self, n: &Node) -> dot::LabelText {
+ fn node_label(&self, n: &Node) -> dot::LabelText<'_> {
match *n {
Node::RegionVid(n_vid) => dot::LabelText::label(format!("{:?}", n_vid)),
Node::Region(n_rgn) => dot::LabelText::label(format!("{:?}", n_rgn)),
}
}
- fn edge_label(&self, e: &Edge) -> dot::LabelText {
+ fn edge_label(&self, e: &Edge<'_>) -> dot::LabelText<'_> {
match *e {
Edge::Constraint(ref c) =>
dot::LabelText::label(format!("{:?}", self.map.get(c).unwrap())),
}
}
-fn constraint_to_nodes(c: &Constraint) -> (Node, Node) {
+fn constraint_to_nodes(c: &Constraint<'_>) -> (Node, Node) {
match *c {
Constraint::VarSubVar(rv_1, rv_2) =>
(Node::RegionVid(rv_1), Node::RegionVid(rv_2)),
}
}
-fn edge_to_nodes(e: &Edge) -> (Node, Node) {
+fn edge_to_nodes(e: &Edge<'_>) -> (Node, Node) {
match *e {
Edge::Constraint(ref c) => constraint_to_nodes(c),
Edge::EnclScope(sub, sup) => {
impl<'a, 'gcx, 'tcx> dot::GraphWalk<'a> for ConstraintGraph<'a, 'gcx, 'tcx> {
type Node = Node;
type Edge = Edge<'tcx>;
- fn nodes(&self) -> dot::Nodes<Node> {
+ fn nodes(&self) -> dot::Nodes<'_, Node> {
let mut set = FxHashSet();
for node in self.node_ids.keys() {
set.insert(*node);
debug!("constraint graph has {} nodes", set.len());
set.into_iter().collect()
}
- fn edges(&self) -> dot::Edges<Edge<'tcx>> {
+ fn edges(&self) -> dot::Edges<'_, Edge<'tcx>> {
debug!("constraint graph has {} edges", self.map.len());
let mut v: Vec<_> = self.map.keys().map(|e| Edge::Constraint(*e)).collect();
self.region_rels.region_scope_tree.each_encl_scope(|sub, sup| {
}
}
- fn expand_givens(&mut self, graph: &RegionGraph) {
+ fn expand_givens(&mut self, graph: &RegionGraph<'_>) {
// Givens are a kind of horrible hack to account for
// constraints like 'c <= '0 that are known to hold due to
// closure signatures (see the comment above on the `givens`
// We place free regions first because we are special casing
// SubSupConflict(ReFree, ReFree) when reporting error, and so
// the user will more likely get a specific suggestion.
- fn region_order_key(x: &RegionAndOrigin) -> u8 {
+ fn region_order_key(x: &RegionAndOrigin<'_>) -> u8 {
match *x.region {
ReEarlyBound(_) => 0,
ReFree(_) => 1,
}
impl<'tcx> fmt::Debug for RegionAndOrigin<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "RegionAndOrigin({:?},{:?})", self.region, self.origin)
}
}
}
impl fmt::Display for FixupError {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use self::FixupError::*;
match *self {
t.fold_with(&mut self.freshener())
}
- pub fn type_var_diverges(&'a self, ty: Ty) -> bool {
+ pub fn type_var_diverges(&'a self, ty: Ty<'_>) -> bool {
match ty.sty {
ty::Infer(ty::TyVar(vid)) => self.type_variables.borrow().var_diverges(vid),
_ => false,
freshen::TypeFreshener::new(self)
}
- pub fn type_is_unconstrained_numeric(&'a self, ty: Ty) -> UnconstrainedNumeric {
+ pub fn type_is_unconstrained_numeric(&'a self, ty: Ty<'_>) -> UnconstrainedNumeric {
use ty::error::UnconstrainedNumeric::Neither;
use ty::error::UnconstrainedNumeric::{UnconstrainedFloat, UnconstrainedInt};
match ty.sty {
}
impl<'tcx> fmt::Debug for TypeTrace<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "TypeTrace({:?})", self.cause)
}
}
}
impl<'tcx> fmt::Debug for RegionObligation<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"RegionObligation(sub_region={:?}, sup_type={:?})",
/// We will return true if the reference is within the same module as the existential type
/// So true for f1, false for f2.
pub fn may_define_existential_type(
- tcx: TyCtxt,
+ tcx: TyCtxt<'_, '_, '_>,
def_id: DefId,
opaque_node_id: ast::NodeId,
) -> bool {
}
}
-fn is_free(r: Region) -> bool {
+fn is_free(r: Region<'_>) -> bool {
match *r {
ty::ReEarlyBound(_) | ty::ReFree(_) => true,
_ => false
}
}
-fn is_free_or_static(r: Region) -> bool {
+fn is_free_or_static(r: Region<'_>) -> bool {
match *r {
ty::ReStatic => true,
_ => is_free(r),
}
impl fmt::Debug for RegionSnapshot {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "RegionSnapshot(length={})", self.length)
}
}
impl<'tcx> fmt::Debug for GenericKind<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
GenericKind::Param(ref p) => write!(f, "{:?}", p),
GenericKind::Projection(ref p) => write!(f, "{:?}", p),
}
impl<'tcx> fmt::Display for GenericKind<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
GenericKind::Param(ref p) => write!(f, "{}", p),
GenericKind::Projection(ref p) => write!(f, "{}", p),
#![feature(box_patterns)]
#![feature(box_syntax)]
-#![cfg_attr(stage0, feature(const_fn))]
-#![cfg_attr(not(stage0), feature(min_const_fn))]
+#![feature(min_const_fn)]
#![feature(core_intrinsics)]
#![feature(drain_filter)]
#![cfg_attr(windows, feature(libc))]
-#![cfg_attr(stage0, feature(macro_vis_matcher))]
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![feature(extern_types)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(non_exhaustive)]
#![feature(proc_macro_internals)]
#![feature(quote)]
#![feature(refcell_replace_swap)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_attrs)]
-#![cfg_attr(stage0, feature(attr_literals))]
#![feature(slice_patterns)]
#![feature(slice_sort_by_cached_key)]
#![feature(specialization)]
#![feature(step_trait)]
#![feature(integer_atomics)]
#![feature(test)]
-#![cfg_attr(not(stage0), feature(impl_header_lifetime_elision))]
+#![feature(impl_header_lifetime_elision)]
#![feature(in_band_lifetimes)]
#![feature(macro_at_most_once_rep)]
-#![cfg_attr(stage0, feature(crate_in_paths))]
#![feature(crate_visibility_modifier)]
#![recursion_limit="512"]
+#![warn(elided_lifetimes_in_paths)]
+
extern crate arena;
#[macro_use] extern crate bitflags;
extern crate core;
}
impl BuiltinLintDiagnostics {
- pub fn run(self, sess: &Session, db: &mut DiagnosticBuilder) {
+ pub fn run(self, sess: &Session, db: &mut DiagnosticBuilder<'_>) {
match self {
BuiltinLintDiagnostics::Normal => (),
BuiltinLintDiagnostics::BareTraitObject(span, is_global) => {
&self,
lint_name: &str,
tool_name: Option<LocalInternedString>,
- ) -> CheckLintNameResult {
+ ) -> CheckLintNameResult<'_> {
let complete_name = if let Some(tool_name) = tool_name {
format!("{}::{}", tool_name, lint_name)
} else {
&self,
lint_name: &str,
tool_name: &str,
- ) -> CheckLintNameResult {
+ ) -> CheckLintNameResult<'_> {
let complete_name = format!("{}::{}", tool_name, lint_name);
match self.by_name.get(&complete_name) {
None => match self.lint_groups.get(&*complete_name) {
lint: &'static Lint,
span: Option<S>,
msg: &str)
- -> DiagnosticBuilder;
+ -> DiagnosticBuilder<'_>;
/// Emit a lint at the appropriate level, for a particular span.
fn span_lint<S: Into<MultiSpan>>(&self, lint: &'static Lint, span: S, msg: &str) {
lint: &'static Lint,
span: S,
msg: &str)
- -> DiagnosticBuilder {
+ -> DiagnosticBuilder<'_> {
self.lookup(lint, Some(span), msg)
}
lint: &'static Lint,
span: Option<S>,
msg: &str)
- -> DiagnosticBuilder {
+ -> DiagnosticBuilder<'_> {
let id = self.last_ast_node_with_lint_attrs;
match span {
Some(s) => self.tcx.struct_span_lint_node(lint, id, s, msg),
lint: &'static Lint,
span: Option<S>,
msg: &str)
- -> DiagnosticBuilder {
+ -> DiagnosticBuilder<'_> {
self.builder.struct_lint(lint, span.map(|s| s.into()), msg)
}
return me
}
- pub fn builder(sess: &Session) -> LintLevelsBuilder {
+ pub fn builder(sess: &Session) -> LintLevelsBuilder<'_> {
LintLevelsBuilder::new(sess, LintLevelSets::new(sess))
}
}
pub trait EarlyLintPass: LintPass {
- fn check_ident(&mut self, _: &EarlyContext, _: ast::Ident) { }
- fn check_crate(&mut self, _: &EarlyContext, _: &ast::Crate) { }
- fn check_crate_post(&mut self, _: &EarlyContext, _: &ast::Crate) { }
- fn check_mod(&mut self, _: &EarlyContext, _: &ast::Mod, _: Span, _: ast::NodeId) { }
- fn check_mod_post(&mut self, _: &EarlyContext, _: &ast::Mod, _: Span, _: ast::NodeId) { }
- fn check_foreign_item(&mut self, _: &EarlyContext, _: &ast::ForeignItem) { }
- fn check_foreign_item_post(&mut self, _: &EarlyContext, _: &ast::ForeignItem) { }
- fn check_item(&mut self, _: &EarlyContext, _: &ast::Item) { }
- fn check_item_post(&mut self, _: &EarlyContext, _: &ast::Item) { }
- fn check_local(&mut self, _: &EarlyContext, _: &ast::Local) { }
- fn check_block(&mut self, _: &EarlyContext, _: &ast::Block) { }
- fn check_block_post(&mut self, _: &EarlyContext, _: &ast::Block) { }
- fn check_stmt(&mut self, _: &EarlyContext, _: &ast::Stmt) { }
- fn check_arm(&mut self, _: &EarlyContext, _: &ast::Arm) { }
- fn check_pat(&mut self, _: &EarlyContext, _: &ast::Pat) { }
- fn check_expr(&mut self, _: &EarlyContext, _: &ast::Expr) { }
- fn check_expr_post(&mut self, _: &EarlyContext, _: &ast::Expr) { }
- fn check_ty(&mut self, _: &EarlyContext, _: &ast::Ty) { }
- fn check_generic_param(&mut self, _: &EarlyContext, _: &ast::GenericParam) { }
- fn check_generics(&mut self, _: &EarlyContext, _: &ast::Generics) { }
- fn check_where_predicate(&mut self, _: &EarlyContext, _: &ast::WherePredicate) { }
- fn check_poly_trait_ref(&mut self, _: &EarlyContext, _: &ast::PolyTraitRef,
+ fn check_ident(&mut self, _: &EarlyContext<'_>, _: ast::Ident) { }
+ fn check_crate(&mut self, _: &EarlyContext<'_>, _: &ast::Crate) { }
+ fn check_crate_post(&mut self, _: &EarlyContext<'_>, _: &ast::Crate) { }
+ fn check_mod(&mut self, _: &EarlyContext<'_>, _: &ast::Mod, _: Span, _: ast::NodeId) { }
+ fn check_mod_post(&mut self, _: &EarlyContext<'_>, _: &ast::Mod, _: Span, _: ast::NodeId) { }
+ fn check_foreign_item(&mut self, _: &EarlyContext<'_>, _: &ast::ForeignItem) { }
+ fn check_foreign_item_post(&mut self, _: &EarlyContext<'_>, _: &ast::ForeignItem) { }
+ fn check_item(&mut self, _: &EarlyContext<'_>, _: &ast::Item) { }
+ fn check_item_post(&mut self, _: &EarlyContext<'_>, _: &ast::Item) { }
+ fn check_local(&mut self, _: &EarlyContext<'_>, _: &ast::Local) { }
+ fn check_block(&mut self, _: &EarlyContext<'_>, _: &ast::Block) { }
+ fn check_block_post(&mut self, _: &EarlyContext<'_>, _: &ast::Block) { }
+ fn check_stmt(&mut self, _: &EarlyContext<'_>, _: &ast::Stmt) { }
+ fn check_arm(&mut self, _: &EarlyContext<'_>, _: &ast::Arm) { }
+ fn check_pat(&mut self, _: &EarlyContext<'_>, _: &ast::Pat) { }
+ fn check_expr(&mut self, _: &EarlyContext<'_>, _: &ast::Expr) { }
+ fn check_expr_post(&mut self, _: &EarlyContext<'_>, _: &ast::Expr) { }
+ fn check_ty(&mut self, _: &EarlyContext<'_>, _: &ast::Ty) { }
+ fn check_generic_param(&mut self, _: &EarlyContext<'_>, _: &ast::GenericParam) { }
+ fn check_generics(&mut self, _: &EarlyContext<'_>, _: &ast::Generics) { }
+ fn check_where_predicate(&mut self, _: &EarlyContext<'_>, _: &ast::WherePredicate) { }
+ fn check_poly_trait_ref(&mut self, _: &EarlyContext<'_>, _: &ast::PolyTraitRef,
_: &ast::TraitBoundModifier) { }
- fn check_fn(&mut self, _: &EarlyContext,
- _: ast_visit::FnKind, _: &ast::FnDecl, _: Span, _: ast::NodeId) { }
- fn check_fn_post(&mut self, _: &EarlyContext,
- _: ast_visit::FnKind, _: &ast::FnDecl, _: Span, _: ast::NodeId) { }
- fn check_trait_item(&mut self, _: &EarlyContext, _: &ast::TraitItem) { }
- fn check_trait_item_post(&mut self, _: &EarlyContext, _: &ast::TraitItem) { }
- fn check_impl_item(&mut self, _: &EarlyContext, _: &ast::ImplItem) { }
- fn check_impl_item_post(&mut self, _: &EarlyContext, _: &ast::ImplItem) { }
- fn check_struct_def(&mut self, _: &EarlyContext,
+ fn check_fn(&mut self, _: &EarlyContext<'_>,
+ _: ast_visit::FnKind<'_>, _: &ast::FnDecl, _: Span, _: ast::NodeId) { }
+ fn check_fn_post(&mut self, _: &EarlyContext<'_>,
+ _: ast_visit::FnKind<'_>, _: &ast::FnDecl, _: Span, _: ast::NodeId) { }
+ fn check_trait_item(&mut self, _: &EarlyContext<'_>, _: &ast::TraitItem) { }
+ fn check_trait_item_post(&mut self, _: &EarlyContext<'_>, _: &ast::TraitItem) { }
+ fn check_impl_item(&mut self, _: &EarlyContext<'_>, _: &ast::ImplItem) { }
+ fn check_impl_item_post(&mut self, _: &EarlyContext<'_>, _: &ast::ImplItem) { }
+ fn check_struct_def(&mut self, _: &EarlyContext<'_>,
_: &ast::VariantData, _: ast::Ident, _: &ast::Generics, _: ast::NodeId) { }
- fn check_struct_def_post(&mut self, _: &EarlyContext,
+ fn check_struct_def_post(&mut self, _: &EarlyContext<'_>,
_: &ast::VariantData, _: ast::Ident, _: &ast::Generics, _: ast::NodeId) { }
- fn check_struct_field(&mut self, _: &EarlyContext, _: &ast::StructField) { }
- fn check_variant(&mut self, _: &EarlyContext, _: &ast::Variant, _: &ast::Generics) { }
- fn check_variant_post(&mut self, _: &EarlyContext, _: &ast::Variant, _: &ast::Generics) { }
- fn check_lifetime(&mut self, _: &EarlyContext, _: &ast::Lifetime) { }
- fn check_path(&mut self, _: &EarlyContext, _: &ast::Path, _: ast::NodeId) { }
- fn check_attribute(&mut self, _: &EarlyContext, _: &ast::Attribute) { }
- fn check_mac_def(&mut self, _: &EarlyContext, _: &ast::MacroDef, _id: ast::NodeId) { }
- fn check_mac(&mut self, _: &EarlyContext, _: &ast::Mac) { }
+ fn check_struct_field(&mut self, _: &EarlyContext<'_>, _: &ast::StructField) { }
+ fn check_variant(&mut self, _: &EarlyContext<'_>, _: &ast::Variant, _: &ast::Generics) { }
+ fn check_variant_post(&mut self, _: &EarlyContext<'_>, _: &ast::Variant, _: &ast::Generics) { }
+ fn check_lifetime(&mut self, _: &EarlyContext<'_>, _: &ast::Lifetime) { }
+ fn check_path(&mut self, _: &EarlyContext<'_>, _: &ast::Path, _: ast::NodeId) { }
+ fn check_attribute(&mut self, _: &EarlyContext<'_>, _: &ast::Attribute) { }
+ fn check_mac_def(&mut self, _: &EarlyContext<'_>, _: &ast::MacroDef, _id: ast::NodeId) { }
+ fn check_mac(&mut self, _: &EarlyContext<'_>, _: &ast::Mac) { }
/// Called when entering a syntax node that can have lint attributes such
/// as `#[allow(...)]`. Called with *all* the attributes of that node.
- fn enter_lint_attrs(&mut self, _: &EarlyContext, _: &[ast::Attribute]) { }
+ fn enter_lint_attrs(&mut self, _: &EarlyContext<'_>, _: &[ast::Attribute]) { }
/// Counterpart to `enter_lint_attrs`.
- fn exit_lint_attrs(&mut self, _: &EarlyContext, _: &[ast::Attribute]) { }
+ fn exit_lint_attrs(&mut self, _: &EarlyContext<'_>, _: &[ast::Attribute]) { }
}
/// A lint pass boxed up as a trait object.
}
}
-pub fn provide(providers: &mut Providers) {
+pub fn provide(providers: &mut Providers<'_>) {
providers.lint_levels = lint_levels;
}
// In order to get this left-to-right dependency ordering, we perform a
// topological sort of all crates putting the leaves at the right-most
// positions.
-pub fn used_crates(tcx: TyCtxt, prefer: LinkagePreference)
+pub fn used_crates(tcx: TyCtxt<'_, '_, '_>, prefer: LinkagePreference)
-> Vec<(CrateNum, LibSource)>
{
let mut libs = tcx.crates()
}
}
-fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt,
+fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>,
id: ast::NodeId,
attrs: &[ast::Attribute]) -> bool {
if attr::contains_name(attrs, "lang") {
return ret;
}
-fn add_library(tcx: TyCtxt,
+fn add_library(tcx: TyCtxt<'_, '_, '_>,
cnum: CrateNum,
link: LinkagePreference,
m: &mut FxHashMap<CrateNum, LinkagePreference>) {
}
pub fn find_entry_point(session: &Session,
- hir_map: &hir_map::Map,
+ hir_map: &hir_map::Map<'_>,
crate_name: &str) {
let any_exe = session.crate_types.borrow().iter().any(|ty| {
*ty == config::CrateType::Executable
}
-fn find_item(item: &Item, ctxt: &mut EntryContext, at_root: bool) {
+fn find_item(item: &Item, ctxt: &mut EntryContext<'_, '_>, at_root: bool) {
match entry_point_type(item, at_root) {
EntryPointType::MainNamed => {
if ctxt.main_fn.is_none() {
}
}
-fn configure_main(this: &mut EntryContext, crate_name: &str) {
+fn configure_main(this: &mut EntryContext<'_, '_>, crate_name: &str) {
if let Some((node_id, span)) = this.start_fn {
this.session.entry_fn.set(Some((node_id, span, EntryFnType::Start)));
} else if let Some((node_id, span)) = this.attr_main_fn {
}
}
-pub fn metadata_symbol_name(tcx: ty::TyCtxt) -> String {
+pub fn metadata_symbol_name(tcx: ty::TyCtxt<'_, '_, '_>) -> String {
format!("rust_metadata_{}_{}",
tcx.original_crate_name(LOCAL_CRATE),
tcx.crate_disambiguator(LOCAL_CRATE).to_fingerprint().to_hex())
}
impl OverloadedCallType {
- fn from_trait_id(tcx: TyCtxt, trait_id: DefId) -> OverloadedCallType {
+ fn from_trait_id(tcx: TyCtxt<'_, '_, '_>, trait_id: DefId) -> OverloadedCallType {
for &(maybe_function_trait, overloaded_call_type) in &[
(tcx.lang_items().fn_once_trait(), FnOnceOverloadedCall),
(tcx.lang_items().fn_mut_trait(), FnMutOverloadedCall),
bug!("overloaded call didn't map to known function trait")
}
- fn from_method_id(tcx: TyCtxt, method_id: DefId) -> OverloadedCallType {
+ fn from_method_id(tcx: TyCtxt<'_, '_, '_>, method_id: DefId) -> OverloadedCallType {
let method = tcx.associated_item(method_id);
OverloadedCallType::from_trait_id(tcx, method.container.id())
}
ExitNode
}
-fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt) -> String {
+fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt<'_, '_, '_>) -> String {
let cm = tcx.sess.source_map();
match lnk {
FreeVarNode(s) => {
}
impl fmt::Debug for LiveNode {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ln({})", self.get())
}
}
impl fmt::Debug for Variable {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "v({})", self.get())
}
}
}
}
- debug!("creating fn_maps: {:?}", &fn_maps as *const IrMaps);
+ debug!("creating fn_maps: {:?}", &fn_maps as *const IrMaps<'_, '_>);
let body = ir.tcx.hir.body(body_id);
fn propagate_through_loop(&mut self,
expr: &Expr,
- kind: LoopKind,
+ kind: LoopKind<'_>,
body: &hir::Block,
succ: LiveNode)
-> LiveNode {
}
fn from_pointer_kind(base_mutbl: MutabilityCategory,
- ptr: PointerKind) -> MutabilityCategory {
+ ptr: PointerKind<'_>) -> MutabilityCategory {
let ret = match ptr {
Unique => {
base_mutbl.inherit()
ret
}
- fn from_local(tcx: TyCtxt, tables: &ty::TypeckTables, id: ast::NodeId) -> MutabilityCategory {
+ fn from_local(tcx: TyCtxt<'_, '_, '_>, tables: &ty::TypeckTables<'_>,
+ id: ast::NodeId) -> MutabilityCategory {
let ret = match tcx.hir.get(id) {
Node::Binding(p) => match p.node {
PatKind::Binding(..) => {
}
}
- pub fn descriptive_string(&self, tcx: TyCtxt) -> String {
+ pub fn descriptive_string(&self, tcx: TyCtxt<'_, '_, '_>) -> String {
match self.cat {
Categorization::StaticItem => {
"static item".to_string()
}
}
-pub fn ptr_sigil(ptr: PointerKind) -> &'static str {
+pub fn ptr_sigil(ptr: PointerKind<'_>) -> &'static str {
match ptr {
Unique => "Box",
BorrowedPtr(ty::ImmBorrow, _) => "&",
}
impl fmt::Debug for InteriorKind {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
InteriorField(FieldIndex(_, info)) => write!(f, "{}", info),
InteriorElement(..) => write!(f, "[]"),
}
impl fmt::Debug for Upvar {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}/{:?}", self.id, self.kind)
}
}
impl fmt::Display for Upvar {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let kind = match self.kind {
ty::ClosureKind::Fn => "Fn",
ty::ClosureKind::FnMut => "FnMut",
}
impl<Id: Hash + Eq + fmt::Debug> fmt::Debug for AccessLevels<Id> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&self.map, f)
}
}
ReachableSet(Lrc::new(reachable_context.reachable_symbols))
}
-pub fn provide(providers: &mut Providers) {
+pub fn provide(providers: &mut Providers<'_>) {
*providers = Providers {
reachable_set,
..*providers
}
impl fmt::Debug for Scope {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.data {
ScopeData::Node => write!(fmt, "Node({:?})", self.id),
ScopeData::CallSite => write!(fmt, "CallSite({:?})", self.id),
// compilation error if size of `ScopeData` is not the same as a `u32`
#[allow(dead_code)]
-// only works on stage 1 when the rustc_layout_scalar_valid_range attribute actually exists
-#[cfg(not(stage0))]
static ASSERT: () = [()][!(mem::size_of::<ScopeData>() == 4) as usize];
impl Scope {
self.id
}
- pub fn node_id(&self, tcx: TyCtxt, scope_tree: &ScopeTree) -> ast::NodeId {
+ pub fn node_id(&self, tcx: TyCtxt<'_, '_, '_>, scope_tree: &ScopeTree) -> ast::NodeId {
match scope_tree.root_body {
Some(hir_id) => {
tcx.hir.hir_to_node_id(hir::HirId {
/// Returns the span of this Scope. Note that in general the
/// returned span may not correspond to the span of any node id in
/// the AST.
- pub fn span(&self, tcx: TyCtxt, scope_tree: &ScopeTree) -> Span {
+ pub fn span(&self, tcx: TyCtxt<'_, '_, '_>, scope_tree: &ScopeTree) -> Span {
let node_id = self.node_id(tcx, scope_tree);
if node_id == ast::DUMMY_NODE_ID {
return DUMMY_SP;
}
/// Records the lifetime of a local variable as `cx.var_parent`
-fn record_var_lifetime(visitor: &mut RegionResolutionVisitor,
+fn record_var_lifetime(visitor: &mut RegionResolutionVisitor<'_, '_>,
var_id: hir::ItemLocalId,
_sp: Span) {
match visitor.cx.var_parent {
Lrc::new(scope_tree)
}
-pub fn provide(providers: &mut Providers) {
+pub fn provide(providers: &mut Providers<'_>) {
*providers = Providers {
region_scope_tree,
..*providers
}
impl Region {
- fn early(hir_map: &Map, index: &mut u32, param: &GenericParam) -> (ParamName, Region) {
+ fn early(hir_map: &Map<'_>, index: &mut u32, param: &GenericParam) -> (ParamName, Region) {
let i = *index;
*index += 1;
let def_id = hir_map.local_def_id(param.id);
(param.name.modern(), Region::EarlyBound(i, def_id, origin))
}
- fn late(hir_map: &Map, param: &GenericParam) -> (ParamName, Region) {
+ fn late(hir_map: &Map<'_>, param: &GenericParam) -> (ParamName, Region) {
let depth = ty::INNERMOST;
let def_id = hir_map.local_def_id(param.id);
let origin = LifetimeDefOrigin::from_param(param);
const ROOT_SCOPE: ScopeRef<'static> = &Scope::Root;
-pub fn provide(providers: &mut ty::query::Providers) {
+pub fn provide(providers: &mut ty::query::Providers<'_>) {
*providers = ty::query::Providers {
resolve_lifetimes,
f(self)
}
- fn with<F>(&mut self, wrap_scope: Scope, f: F)
+ fn with<F>(&mut self, wrap_scope: Scope<'_>, f: F)
where
- F: for<'b> FnOnce(ScopeRef, &mut LifetimeContext<'b, 'tcx>),
+ F: for<'b> FnOnce(ScopeRef<'_>, &mut LifetimeContext<'b, 'tcx>),
{
let LifetimeContext {
tcx,
fn report_elision_failure(
&mut self,
- db: &mut DiagnosticBuilder,
+ db: &mut DiagnosticBuilder<'_>,
params: &[ElisionFailureInfo],
) {
let mut m = String::new();
self.insert_lifetime(lifetime_ref, lifetime.shifted(late_depth));
}
- fn check_lifetime_params(&mut self, old_scope: ScopeRef, params: &'tcx [hir::GenericParam]) {
+ fn check_lifetime_params(&mut self, old_scope: ScopeRef<'_>,
+ params: &'tcx [hir::GenericParam]) {
let lifetimes: Vec<_> = params.iter().filter_map(|param| match param.kind {
GenericParamKind::Lifetime { .. } => Some((param, param.name)),
_ => None,
fn check_lifetime_param_for_shadowing(
&self,
- mut old_scope: ScopeRef,
+ mut old_scope: ScopeRef<'_>,
param: &'tcx hir::GenericParam,
) {
for label in &self.labels_in_fn {
/// Not all lang items are always required for each compilation, particularly in
/// the case of panic=abort. In these situations some lang items are injected by
/// crates and don't actually need to be defined in libstd.
-pub fn whitelisted(tcx: TyCtxt, lang_item: lang_items::LangItem) -> bool {
+pub fn whitelisted(tcx: TyCtxt<'_, '_, '_>, lang_item: lang_items::LangItem) -> bool {
// If we're not compiling with unwinding, we won't actually need these
// symbols. Other panic runtimes ensure that the relevant symbols are
// available to link things together, but they're never exercised.
pub fn predecessors(
&self,
- mir: &Mir
- ) -> MappedReadGuard<IndexVec<BasicBlock, Vec<BasicBlock>>> {
+ mir: &Mir<'_>
+ ) -> MappedReadGuard<'_, IndexVec<BasicBlock, Vec<BasicBlock>>> {
if self.predecessors.borrow().is_none() {
*self.predecessors.borrow_mut() = Some(calculate_predecessors(mir));
}
}
}
-fn calculate_predecessors(mir: &Mir) -> IndexVec<BasicBlock, Vec<BasicBlock>> {
+fn calculate_predecessors(mir: &Mir<'_>) -> IndexVec<BasicBlock, Vec<BasicBlock>> {
let mut result = IndexVec::from_elem(vec![], mir.basic_blocks());
for (bb, data) in mir.basic_blocks().iter_enumerated() {
if let Some(ref term) = data.terminator {
}
impl<'tcx> fmt::Display for EvalError<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", self.kind)
}
}
impl<'tcx, O: fmt::Debug> fmt::Debug for EvalErrorKind<'tcx, O> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use self::EvalErrorKind::*;
match *self {
PointerOutOfBounds { ptr, access, allocation_size } => {
impl AllocDecodingState {
- pub fn new_decoding_session(&self) -> AllocDecodingSession {
+ pub fn new_decoding_session(&self) -> AllocDecodingSession<'_> {
static DECODER_SESSION_ID: AtomicU32 = AtomicU32::new(0);
let counter = DECODER_SESSION_ID.fetch_add(1, Ordering::SeqCst);
}
impl fmt::Display for AllocId {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
}
}
///
/// This must be inserted into the `local_decls` list as the first local.
#[inline]
- pub fn new_return_place(return_ty: Ty, span: Span) -> LocalDecl {
+ pub fn new_return_place(return_ty: Ty<'_>, span: Span) -> LocalDecl<'_> {
LocalDecl {
mutability: Mutability::Mut,
ty: return_ty,
iter::Chain<option::IntoIter<&'a mut BasicBlock>, slice::IterMut<'a, BasicBlock>>;
impl<'tcx> Terminator<'tcx> {
- pub fn successors(&self) -> Successors {
+ pub fn successors(&self) -> Successors<'_> {
self.kind.successors()
}
- pub fn successors_mut(&mut self) -> SuccessorsMut {
+ pub fn successors_mut(&mut self) -> SuccessorsMut<'_> {
self.kind.successors_mut()
}
}
}
- pub fn successors(&self) -> Successors {
+ pub fn successors(&self) -> Successors<'_> {
use self::TerminatorKind::*;
match *self {
Resume
}
}
- pub fn successors_mut(&mut self) -> SuccessorsMut {
+ pub fn successors_mut(&mut self) -> SuccessorsMut<'_> {
use self::TerminatorKind::*;
match *self {
Resume
pub fn retain_statements<F>(&mut self, mut f: F)
where
- F: FnMut(&mut Statement) -> bool,
+ F: FnMut(&mut Statement<'_>) -> bool,
{
for s in &mut self.statements {
if !f(s) {
}
impl<'tcx> Debug for TerminatorKind<'tcx> {
- fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
self.fmt_head(fmt)?;
let successor_count = self.successors().count();
let labels = self.fmt_successor_labels();
}
impl Debug for ValidationOp {
- fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
use self::ValidationOp::*;
match *self {
Acquire => write!(fmt, "Acquire"),
}
impl<'tcx, T: Debug> Debug for ValidationOperand<'tcx, T> {
- fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
write!(fmt, "{:?}: {:?}", self.place, self.ty)?;
if let Some(ce) = self.re {
// (reuse lifetime rendering policy from ppaux.)
}
impl<'tcx> Debug for Statement<'tcx> {
- fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
use self::StatementKind::*;
match self.kind {
Assign(ref place, ref rv) => write!(fmt, "{:?} = {:?}", place, rv),
}
impl<'tcx> Debug for Place<'tcx> {
- fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
use self::Place::*;
match *self {
}
impl<'tcx> Debug for Operand<'tcx> {
- fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
use self::Operand::*;
match *self {
Constant(ref a) => write!(fmt, "{:?}", a),
}
impl<'tcx> Debug for Rvalue<'tcx> {
- fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
use self::Rvalue::*;
match *self {
}
Aggregate(ref kind, ref places) => {
- fn fmt_tuple(fmt: &mut Formatter, places: &[Operand]) -> fmt::Result {
+ fn fmt_tuple(fmt: &mut Formatter<'_>, places: &[Operand<'_>]) -> fmt::Result {
let mut tuple_fmt = fmt.debug_tuple("");
for place in places {
tuple_fmt.field(place);
}
impl<'tcx> Debug for Constant<'tcx> {
- fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
write!(fmt, "const ")?;
fmt_const_val(fmt, self.literal)
}
}
/// Write a `ConstValue` in a way closer to the original source code than the `Debug` output.
-pub fn fmt_const_val(f: &mut impl Write, const_val: &ty::Const) -> fmt::Result {
+pub fn fmt_const_val(f: &mut impl Write, const_val: &ty::Const<'_>) -> fmt::Result {
use ty::TyKind::*;
let value = const_val.val;
let ty = const_val.ty;
}
impl fmt::Debug for Location {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "{:?}[{}]", self.block, self.statement_index)
}
}
}
impl fmt::Display for CrateType {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
CrateType::Executable => "bin".fmt(f),
CrateType::Dylib => "dylib".fmt(f),
.expect("missing sysroot and default_sysroot in Session"),
}
}
- pub fn target_filesearch(&self, kind: PathKind) -> filesearch::FileSearch {
+ pub fn target_filesearch(&self, kind: PathKind) -> filesearch::FileSearch<'_> {
filesearch::FileSearch::new(
self.sysroot(),
self.opts.target_triple.triple(),
kind,
)
}
- pub fn host_filesearch(&self, kind: PathKind) -> filesearch::FileSearch {
+ pub fn host_filesearch(&self, kind: PathKind) -> filesearch::FileSearch<'_> {
filesearch::FileSearch::new(
self.sysroot(),
config::host_triple(),
*incr_comp_session = IncrCompSession::InvalidBecauseOfErrors { session_directory };
}
- pub fn incr_comp_session_dir(&self) -> cell::Ref<PathBuf> {
+ pub fn incr_comp_session_dir(&self) -> cell::Ref<'_, PathBuf> {
let incr_comp_session = self.incr_comp_session.borrow();
cell::Ref::map(
incr_comp_session,
)
}
- pub fn incr_comp_session_dir_opt(&self) -> Option<cell::Ref<PathBuf>> {
+ pub fn incr_comp_session_dir_opt(&self) -> Option<cell::Ref<'_, PathBuf>> {
if self.opts.incremental.is_some() {
Some(self.incr_comp_session_dir())
} else {
}
impl fmt::Display for CrateDisambiguator {
- fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
let (a, b) = self.0.as_value();
let as_u128 = a as u128 | ((b as u128) << 64);
f.write_str(&base_n::encode(as_u128, base_n::CASE_INSENSITIVE))
self.paths.push((kind, PathBuf::from(path)));
}
- pub fn iter(&self, kind: PathKind) -> Iter {
+ pub fn iter(&self, kind: PathKind) -> Iter<'_> {
Iter { kind: kind, iter: self.paths.iter() }
}
}
}
}
- pub fn region_name(&self, region: Region) -> Option<String> {
+ pub fn region_name(&self, region: Region<'_>) -> Option<String> {
match region {
&ty::ReEarlyBound(r) => Some(r.name.to_string()),
_ => None,
}
}
- pub fn get_lifetime(&self, region: Region, names_map: &FxHashMap<String, String>) -> String {
+ pub fn get_lifetime(&self, region: Region<'_>,
+ names_map: &FxHashMap<String, String>) -> String {
self.region_name(region)
.map(|name|
names_map.get(&name).unwrap_or_else(||
finished_map
}
- pub fn is_of_param(&self, substs: &Substs) -> bool {
+ pub fn is_of_param(&self, substs: &Substs<'_>) -> bool {
if substs.is_noop() {
return false;
}
T: Iterator<Item = Obligation<'cx, ty::Predicate<'cx>>>,
>(
&self,
- ty: ty::Ty,
+ ty: ty::Ty<'_>,
nested: T,
computed_preds: &'b mut FxHashSet<ty::Predicate<'cx>>,
fresh_preds: &'b mut FxHashSet<ty::Predicate<'cx>>,
///
/// Note that this function is never called for types that have both type
/// parameters and inference variables.
-fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt,
+fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_, '_>,
trait_ref: ty::TraitRef<'tcx>,
in_crate: InCrate)
-> Result<(), OrphanCheckErr<'tcx>>
return Err(OrphanCheckErr::NoLocalInputType);
}
-fn uncovered_tys<'tcx>(tcx: TyCtxt, ty: Ty<'tcx>, in_crate: InCrate)
+fn uncovered_tys<'tcx>(tcx: TyCtxt<'_, '_, '_>, ty: Ty<'tcx>, in_crate: InCrate)
-> Vec<Ty<'tcx>> {
if ty_is_local_constructor(ty, in_crate) {
vec![]
}
}
-fn is_possibly_remote_type(ty: Ty, _in_crate: InCrate) -> bool {
+fn is_possibly_remote_type(ty: Ty<'_>, _in_crate: InCrate) -> bool {
match ty.sty {
ty::Projection(..) | ty::Param(..) => true,
_ => false,
}
}
-fn ty_is_local(tcx: TyCtxt, ty: Ty, in_crate: InCrate) -> bool {
+fn ty_is_local(tcx: TyCtxt<'_, '_, '_>, ty: Ty<'_>, in_crate: InCrate) -> bool {
ty_is_local_constructor(ty, in_crate) ||
fundamental_ty(tcx, ty) && ty.walk_shallow().any(|t| ty_is_local(tcx, t, in_crate))
}
-fn fundamental_ty(tcx: TyCtxt, ty: Ty) -> bool {
+fn fundamental_ty(tcx: TyCtxt<'_, '_, '_>, ty: Ty<'_>) -> bool {
match ty.sty {
ty::Ref(..) => true,
ty::Adt(def, _) => def.is_fundamental(),
}
}
-fn ty_is_local_constructor(ty: Ty, in_crate: InCrate) -> bool {
+fn ty_is_local_constructor(ty: Ty<'_>, in_crate: InCrate) -> bool {
debug!("ty_is_local_constructor({:?})", ty);
match ty.sty {
fn report_similar_impl_candidates(&self,
mut impl_candidates: Vec<ty::TraitRef<'tcx>>,
- err: &mut DiagnosticBuilder)
+ err: &mut DiagnosticBuilder<'_>)
{
if impl_candidates.is_empty() {
return;
/// returns a span and `ArgKind` information that describes the
/// arguments it expects. This can be supplied to
/// `report_arg_count_mismatch`.
- pub fn get_fn_like_arguments(&self, node: Node) -> (Span, Vec<ArgKind>) {
+ pub fn get_fn_like_arguments(&self, node: Node<'_>) -> (Span, Vec<ArgKind>) {
match node {
Node::Expr(&hir::Expr {
node: hir::ExprKind::Closure(_, ref _decl, id, span, _),
}
fn note_obligation_cause<T>(&self,
- err: &mut DiagnosticBuilder,
+ err: &mut DiagnosticBuilder<'_>,
obligation: &Obligation<'tcx, T>)
where T: fmt::Display
{
}
fn note_obligation_cause_code<T>(&self,
- err: &mut DiagnosticBuilder,
+ err: &mut DiagnosticBuilder<'_>,
predicate: &T,
cause_code: &ObligationCauseCode<'tcx>,
obligated_types: &mut Vec<&ty::TyS<'tcx>>)
}
}
- fn suggest_new_overflow_limit(&self, err: &mut DiagnosticBuilder) {
+ fn suggest_new_overflow_limit(&self, err: &mut DiagnosticBuilder<'_>) {
let current_limit = self.tcx.sess.recursion_limit.get();
let suggested_limit = current_limit * 2;
err.help(&format!("consider adding a `#![recursion_limit=\"{}\"]` attribute to your crate",
}
}
-pub fn provide(providers: &mut ty::query::Providers) {
+pub fn provide(providers: &mut ty::query::Providers<'_>) {
*providers = ty::query::Providers {
is_object_safe: object_safety::is_object_safe_provider,
specialization_graph_of: specialize::specialization_graph_provider,
}
}
-fn parse_error(tcx: TyCtxt, span: Span,
+fn parse_error(tcx: TyCtxt<'_, '_, '_>, span: Span,
message: &str,
label: &str,
note: Option<&str>)
where
G: Fn() -> String,
{
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", (self.description)())
}
}
/// Emits notes when the overlap is caused by complex intercrate ambiguities.
/// See #23980 for details.
pub fn add_intercrate_ambiguity_hint<'a, 'tcx>(&self,
- err: &mut ::errors::DiagnosticBuilder) {
+ err: &mut ::errors::DiagnosticBuilder<'_>) {
err.note(&self.intercrate_ambiguity_hint());
}
/// Wraps a commit_if_ok s.t. obligations collected during it are not returned in selection if
/// the transaction fails and s.t. old obligations are retained.
fn commit_if_ok<T, E, F>(&mut self, f: F) -> Result<T, E> where
- F: FnOnce(&mut Self, &infer::CombinedSnapshot) -> Result<T, E>
+ F: FnOnce(&mut Self, &infer::CombinedSnapshot<'cx, 'tcx>) -> Result<T, E>
{
self.infcx.commit_if_ok(|snapshot| f(self, snapshot))
}
// Winnow, but record the exact outcome of evaluation, which
// is needed for specialization. Propagate overflow if it occurs.
- let candidates: Result<Vec<Option<EvaluatedCandidate>>, _> = candidates
+ let candidates: Result<Vec<Option<EvaluatedCandidate<'_>>>, _> = candidates
.into_iter()
.map(|c| match self.evaluate_candidate(stack, &c) {
Ok(eval) if eval.may_apply() => Ok(Some(EvaluatedCandidate {
})
.collect();
- let mut candidates: Vec<EvaluatedCandidate> =
+ let mut candidates: Vec<EvaluatedCandidate<'_>> =
candidates?.into_iter().filter_map(|c| c).collect();
debug!("winnowed to {} candidates for {:?}: {:?}",
}
fn fast_reject_trait_refs(&mut self,
- obligation: &TraitObligation,
- impl_trait_ref: &ty::TraitRef)
+ obligation: &TraitObligation<'_>,
+ impl_trait_ref: &ty::TraitRef<'_>)
-> bool
{
// We can avoid creating type variables and doing the full
}
impl<'o,'tcx> fmt::Debug for TraitObligationStack<'o,'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "TraitObligationStack({:?})", self.obligation)
}
}
WithDepNode { dep_node, cached_value }
}
- pub fn get(&self, tcx: TyCtxt) -> T {
+ pub fn get(&self, tcx: TyCtxt<'_, '_, '_>) -> T {
tcx.dep_graph.read_index(self.dep_node);
self.cached_value.clone()
}
/// Recovers the "impl X for Y" signature from `impl_def_id` and returns it as a
/// string.
-fn to_pretty_impl_header(tcx: TyCtxt, impl_def_id: DefId) -> Option<String> {
+fn to_pretty_impl_header(tcx: TyCtxt<'_, '_, '_>, impl_def_id: DefId) -> Option<String> {
use std::fmt::Write;
let trait_ref = if let Some(tr) = tcx.impl_trait_ref(impl_def_id) {
possible_sibling,
);
- let overlap_error = |overlap: traits::coherence::OverlapResult| {
+ let overlap_error = |overlap: traits::coherence::OverlapResult<'_>| {
// overlap, but no specialization; error out
let trait_ref = overlap.impl_header.trait_ref.unwrap();
let self_ty = trait_ref.self_ty();
/// Walk up the specialization ancestors of a given impl, starting with that
/// impl itself.
-pub fn ancestors(tcx: TyCtxt,
+pub fn ancestors(tcx: TyCtxt<'_, '_, '_>,
trait_def_id: DefId,
start_from_impl: DefId)
-> Ancestors {
// structural impls for the structs in traits
impl<'tcx, T: fmt::Debug> fmt::Debug for Normalized<'tcx, T> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Normalized({:?},{:?})", self.value, self.obligations)
}
}
impl<'tcx, O: fmt::Debug> fmt::Debug for traits::Obligation<'tcx, O> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if ty::tls::with(|tcx| tcx.sess.verbose()) {
write!(
f,
}
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::Vtable<'tcx, N> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
super::VtableImpl(ref v) => write!(f, "{:?}", v),
}
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::VtableImplData<'tcx, N> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"VtableImpl(impl_def_id={:?}, substs={:?}, nested={:?})",
}
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::VtableGeneratorData<'tcx, N> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"VtableGenerator(generator_def_id={:?}, substs={:?}, nested={:?})",
}
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::VtableClosureData<'tcx, N> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"VtableClosure(closure_def_id={:?}, substs={:?}, nested={:?})",
}
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::VtableBuiltinData<N> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "VtableBuiltin(nested={:?})", self.nested)
}
}
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::VtableAutoImplData<N> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"VtableAutoImplData(trait_def_id={:?}, nested={:?})",
}
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::VtableObjectData<'tcx, N> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"VtableObject(upcast={:?}, vtable_base={}, nested={:?})",
}
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::VtableFnPointerData<'tcx, N> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"VtableFnPointer(fn_ty={:?}, nested={:?})",
}
impl<'tcx> fmt::Debug for traits::FulfillmentError<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "FulfillmentError({:?},{:?})", self.obligation, self.code)
}
}
impl<'tcx> fmt::Debug for traits::FulfillmentErrorCode<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
super::CodeSelectionError(ref e) => write!(f, "{:?}", e),
super::CodeProjectionError(ref e) => write!(f, "{:?}", e),
}
impl<'tcx> fmt::Debug for traits::MismatchedProjectionTypes<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "MismatchedProjectionTypes({:?})", self.err)
}
}
}
impl<'tcx> fmt::Display for traits::WhereClause<'tcx> {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
use traits::WhereClause::*;
match self {
}
impl<'tcx> fmt::Display for traits::WellFormed<'tcx> {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
use traits::WellFormed::*;
match self {
}
impl<'tcx> fmt::Display for traits::FromEnv<'tcx> {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
use traits::FromEnv::*;
match self {
}
impl<'tcx> fmt::Display for traits::DomainGoal<'tcx> {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
use traits::DomainGoal::*;
match self {
}
impl fmt::Display for traits::QuantifierKind {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
use traits::QuantifierKind::*;
match self {
}
impl<'tcx> fmt::Display for traits::Goal<'tcx> {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
use traits::Goal::*;
match self {
}
impl<'tcx> fmt::Display for traits::ProgramClause<'tcx> {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let traits::ProgramClause { goal, hypotheses } = self;
write!(fmt, "{}", goal)?;
if !hypotheses.is_empty() {
}
impl<'tcx> fmt::Display for traits::Clause<'tcx> {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
use traits::Clause::*;
match self {
read_f64 -> f64;
read_f32 -> f32;
read_char -> char;
- read_str -> Cow<str>;
+ read_str -> Cow<'_, str>;
}
fn error(&mut self, err: &str) -> Self::Error {
}
}
}
-
self.data.get(&id.local_id)
}
- pub fn iter(&self) -> hash_map::Iter<hir::ItemLocalId, V> {
+ pub fn iter(&self) -> hash_map::Iter<'_, hir::ItemLocalId, V> {
self.data.iter()
}
}
self.data.get_mut(&id.local_id)
}
- pub fn entry(&mut self, id: hir::HirId) -> Entry<hir::ItemLocalId, V> {
+ pub fn entry(&mut self, id: hir::HirId) -> Entry<'_, hir::ItemLocalId, V> {
validate_hir_id_for_typeck_tables(self.local_id_root, id, true);
self.data.entry(id.local_id)
}
}
}
- pub fn type_dependent_defs(&self) -> LocalTableInContext<Def> {
+ pub fn type_dependent_defs(&self) -> LocalTableInContext<'_, Def> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.type_dependent_defs
}
}
- pub fn type_dependent_defs_mut(&mut self) -> LocalTableInContextMut<Def> {
+ pub fn type_dependent_defs_mut(&mut self) -> LocalTableInContextMut<'_, Def> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.type_dependent_defs
}
}
- pub fn field_indices(&self) -> LocalTableInContext<usize> {
+ pub fn field_indices(&self) -> LocalTableInContext<'_, usize> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.field_indices
}
}
- pub fn field_indices_mut(&mut self) -> LocalTableInContextMut<usize> {
+ pub fn field_indices_mut(&mut self) -> LocalTableInContextMut<'_, usize> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.field_indices
}
}
- pub fn user_provided_tys(&self) -> LocalTableInContext<CanonicalTy<'tcx>> {
+ pub fn user_provided_tys(&self) -> LocalTableInContext<'_, CanonicalTy<'tcx>> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.user_provided_tys
}
}
- pub fn user_provided_tys_mut(&mut self) -> LocalTableInContextMut<CanonicalTy<'tcx>> {
+ pub fn user_provided_tys_mut(&mut self) -> LocalTableInContextMut<'_, CanonicalTy<'tcx>> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.user_provided_tys
}
}
- pub fn node_types(&self) -> LocalTableInContext<Ty<'tcx>> {
+ pub fn node_types(&self) -> LocalTableInContext<'_, Ty<'tcx>> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.node_types
}
}
- pub fn node_types_mut(&mut self) -> LocalTableInContextMut<Ty<'tcx>> {
+ pub fn node_types_mut(&mut self) -> LocalTableInContextMut<'_, Ty<'tcx>> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.node_types
self.node_types.get(&id.local_id).cloned()
}
- pub fn node_substs_mut(&mut self) -> LocalTableInContextMut<&'tcx Substs<'tcx>> {
+ pub fn node_substs_mut(&mut self) -> LocalTableInContextMut<'_, &'tcx Substs<'tcx>> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.node_substs
self.node_substs.get(&id.local_id).cloned()
}
- pub fn user_substs_mut(&mut self) -> LocalTableInContextMut<CanonicalSubsts<'tcx>> {
+ pub fn user_substs_mut(&mut self) -> LocalTableInContextMut<'_, CanonicalSubsts<'tcx>> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.user_substs
self.node_id_to_type_opt(expr.hir_id)
}
- pub fn adjustments(&self) -> LocalTableInContext<Vec<ty::adjustment::Adjustment<'tcx>>> {
+ pub fn adjustments(&self) -> LocalTableInContext<'_, Vec<ty::adjustment::Adjustment<'tcx>>> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.adjustments
}
pub fn adjustments_mut(&mut self)
- -> LocalTableInContextMut<Vec<ty::adjustment::Adjustment<'tcx>>> {
+ -> LocalTableInContextMut<'_, Vec<ty::adjustment::Adjustment<'tcx>>> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.adjustments
}
}
- pub fn pat_binding_modes(&self) -> LocalTableInContext<BindingMode> {
+ pub fn pat_binding_modes(&self) -> LocalTableInContext<'_, BindingMode> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.pat_binding_modes
}
pub fn pat_binding_modes_mut(&mut self)
- -> LocalTableInContextMut<BindingMode> {
+ -> LocalTableInContextMut<'_, BindingMode> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.pat_binding_modes
}
}
- pub fn pat_adjustments(&self) -> LocalTableInContext<Vec<Ty<'tcx>>> {
+ pub fn pat_adjustments(&self) -> LocalTableInContext<'_, Vec<Ty<'tcx>>> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.pat_adjustments,
}
pub fn pat_adjustments_mut(&mut self)
- -> LocalTableInContextMut<Vec<Ty<'tcx>>> {
+ -> LocalTableInContextMut<'_, Vec<Ty<'tcx>>> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.pat_adjustments,
self.upvar_capture_map[&upvar_id]
}
- pub fn closure_kind_origins(&self) -> LocalTableInContext<(Span, ast::Name)> {
+ pub fn closure_kind_origins(&self) -> LocalTableInContext<'_, (Span, ast::Name)> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.closure_kind_origins
}
}
- pub fn closure_kind_origins_mut(&mut self) -> LocalTableInContextMut<(Span, ast::Name)> {
+ pub fn closure_kind_origins_mut(&mut self) -> LocalTableInContextMut<'_, (Span, ast::Name)> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.closure_kind_origins
}
}
- pub fn liberated_fn_sigs(&self) -> LocalTableInContext<ty::FnSig<'tcx>> {
+ pub fn liberated_fn_sigs(&self) -> LocalTableInContext<'_, ty::FnSig<'tcx>> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.liberated_fn_sigs
}
}
- pub fn liberated_fn_sigs_mut(&mut self) -> LocalTableInContextMut<ty::FnSig<'tcx>> {
+ pub fn liberated_fn_sigs_mut(&mut self) -> LocalTableInContextMut<'_, ty::FnSig<'tcx>> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.liberated_fn_sigs
}
}
- pub fn fru_field_types(&self) -> LocalTableInContext<Vec<Ty<'tcx>>> {
+ pub fn fru_field_types(&self) -> LocalTableInContext<'_, Vec<Ty<'tcx>>> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.fru_field_types
}
}
- pub fn fru_field_types_mut(&mut self) -> LocalTableInContextMut<Vec<Ty<'tcx>>> {
+ pub fn fru_field_types_mut(&mut self) -> LocalTableInContextMut<'_, Vec<Ty<'tcx>>> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.fru_field_types
}
}
- pub fn cast_kinds(&self) -> LocalTableInContext<ty::cast::CastKind> {
+ pub fn cast_kinds(&self) -> LocalTableInContext<'_, ty::cast::CastKind> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.cast_kinds
}
}
- pub fn cast_kinds_mut(&mut self) -> LocalTableInContextMut<ty::cast::CastKind> {
+ pub fn cast_kinds_mut(&mut self) -> LocalTableInContextMut<'_, ty::cast::CastKind> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.cast_kinds
impl<'tcx> CommonTypes<'tcx> {
fn new(interners: &CtxtInterners<'tcx>) -> CommonTypes<'tcx> {
// Ensure our type representation does not grow
- #[cfg(all(not(stage0), target_pointer_width = "64"))]
+ #[cfg(target_pointer_width = "64")]
#[allow(dead_code)]
- static ASSERT_TY_KIND: () = [()][!(::std::mem::size_of::<ty::TyKind>() <= 24) as usize];
- #[cfg(all(not(stage0), target_pointer_width = "64"))]
+ static ASSERT_TY_KIND: () =
+ [()][!(::std::mem::size_of::<ty::TyKind<'_>>() <= 24) as usize];
+ #[cfg(target_pointer_width = "64")]
#[allow(dead_code)]
- static ASSERT_TYS: () = [()][!(::std::mem::size_of::<ty::TyS>() <= 32) as usize];
+ static ASSERT_TYS: () = [()][!(::std::mem::size_of::<ty::TyS<'_>>() <= 32) as usize];
let mk = |sty| CtxtInterners::intern_ty(interners, interners, sty);
let mk_region = |r| {
/// This is a callback from libsyntax as it cannot access the implicit state
/// in librustc otherwise
- fn span_debug(span: syntax_pos::Span, f: &mut fmt::Formatter) -> fmt::Result {
+ fn span_debug(span: syntax_pos::Span, f: &mut fmt::Formatter<'_>) -> fmt::Result {
with(|tcx| {
write!(f, "{}", tcx.sess.source_map().span_to_string(span))
})
} else {
// We could get a ImplicitCtxt pointer from another thread.
// Ensure that ImplicitCtxt is Sync
- sync::assert_sync::<ImplicitCtxt>();
+ sync::assert_sync::<ImplicitCtxt<'_, '_, '_>>();
- unsafe { f(Some(&*(context as *const ImplicitCtxt))) }
+ unsafe { f(Some(&*(context as *const ImplicitCtxt<'_, '_, '_>))) }
}
}
unsafe {
let gcx = tcx.gcx as *const _ as usize;
assert!(context.tcx.gcx as *const _ as usize == gcx);
- let context: &ImplicitCtxt = mem::transmute(context);
+ let context: &ImplicitCtxt<'_, '_, '_> = mem::transmute(context);
f(context)
}
})
let interners = tcx.interners as *const _ as usize;
assert!(context.tcx.gcx as *const _ as usize == gcx);
assert!(context.tcx.interners as *const _ as usize == interners);
- let context: &ImplicitCtxt = mem::transmute(context);
+ let context: &ImplicitCtxt<'_, '_, '_> = mem::transmute(context);
f(context)
}
})
both_infer: usize,
}
- pub fn go(tcx: TyCtxt) {
+ pub fn go(tcx: TyCtxt<'_, '_, '_>) {
let mut total = DebugStat {
total: 0,
region_infer: 0, ty_infer: 0, both_infer: 0,
direct_interners!('tcx,
region: mk_region(|r: &RegionKind| r.keep_in_local_tcx()) -> RegionKind,
- const_: mk_const(|c: &Const| keep_local(&c.ty) || keep_local(&c.val)) -> Const<'tcx>
+ const_: mk_const(|c: &Const<'_>| keep_local(&c.ty) || keep_local(&c.val)) -> Const<'tcx>
);
macro_rules! slice_interners {
&[$ty<'tcx>],
|a, v| List::from_arena(a, v),
Deref::deref,
- |xs: &[$ty]| xs.iter().any(keep_local)) -> List<$ty<'tcx>>);)+
+ |xs: &[$ty<'_>]| xs.iter().any(keep_local)) -> List<$ty<'tcx>>);)+
)
}
iter.intern_with(|xs| self.intern_goals(xs))
}
- pub fn mk_goal(self, goal: Goal<'tcx>) -> &'tcx Goal {
+ pub fn mk_goal(self, goal: Goal<'tcx>) -> &'tcx Goal<'_> {
&self.intern_goals(&[goal])[0]
}
}
}
-pub fn provide(providers: &mut ty::query::Providers) {
+pub fn provide(providers: &mut ty::query::Providers<'_>) {
// FIXME(#44234) - almost all of these queries have no sub-queries and
// therefore no actual inputs, they're just reading tables calculated in
// resolve! Does this work? Unsure! That's what the issue is about
use ty::{self, Ty, TyCtxt};
use ty::fold::{TypeFolder, TypeFoldable};
-pub(super) fn provide(providers: &mut ty::query::Providers) {
+pub(super) fn provide(providers: &mut ty::query::Providers<'_>) {
*providers = ty::query::Providers {
erase_regions_ty,
..*providers
/// afterwards to present additional details, particularly when it comes to lifetime-related
/// errors.
impl<'tcx> fmt::Display for TypeError<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use self::TypeError::*;
- fn report_maybe_different(f: &mut fmt::Formatter,
+ fn report_maybe_different(f: &mut fmt::Formatter<'_>,
expected: String, found: String) -> fmt::Result {
// A naive approach to making sure that we're not reporting silly errors such as:
// (expected closure, found closure).
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
pub fn note_and_explain_type_err(self,
- db: &mut DiagnosticBuilder,
+ db: &mut DiagnosticBuilder<'_>,
err: &TypeError<'tcx>,
sp: Span) {
use self::TypeError::*;
/// `can_simplify_params` should be true if type parameters appear free in `ty` and `false` if they
/// are to be considered bound.
pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
- ty: Ty,
+ ty: Ty<'_>,
can_simplify_params: bool)
-> Option<SimplifiedType>
{
}
}
- pub fn for_sty(st: &ty::TyKind) -> FlagComputation {
+ pub fn for_sty(st: &ty::TyKind<'_>) -> FlagComputation {
let mut result = FlagComputation::new();
result.add_sty(st);
result
}
}
- fn add_sty(&mut self, st: &ty::TyKind) {
+ fn add_sty(&mut self, st: &ty::TyKind<'_>) {
match st {
&ty::Bool |
&ty::Char |
}
}
- fn add_ty(&mut self, ty: Ty) {
+ fn add_ty(&mut self, ty: Ty<'_>) {
self.add_flags(ty.flags);
self.add_exclusive_binder(ty.outer_exclusive_binder);
}
- fn add_tys(&mut self, tys: &[Ty]) {
+ fn add_tys(&mut self, tys: &[Ty<'_>]) {
for &ty in tys {
self.add_ty(ty);
}
}
- fn add_fn_sig(&mut self, fn_sig: ty::PolyFnSig) {
+ fn add_fn_sig(&mut self, fn_sig: ty::PolyFnSig<'_>) {
let mut computation = FlagComputation::new();
computation.add_tys(fn_sig.skip_binder().inputs());
self.add_bound_computation(&computation);
}
- fn add_region(&mut self, r: ty::Region) {
+ fn add_region(&mut self, r: ty::Region<'_>) {
self.add_flags(r.type_flags());
if let ty::ReLateBound(debruijn, _) = *r {
self.add_binder(debruijn);
}
}
- fn add_const(&mut self, constant: &ty::Const) {
+ fn add_const(&mut self, constant: &ty::Const<'_>) {
self.add_ty(constant.ty);
if let ConstValue::Unevaluated(_, substs) = constant.val {
self.add_flags(TypeFlags::HAS_PROJECTION);
}
}
- fn add_existential_projection(&mut self, projection: &ty::ExistentialProjection) {
+ fn add_existential_projection(&mut self, projection: &ty::ExistentialProjection<'_>) {
self.add_substs(projection.substs);
self.add_ty(projection.ty);
}
- fn add_projection_ty(&mut self, projection_ty: &ty::ProjectionTy) {
+ fn add_projection_ty(&mut self, projection_ty: &ty::ProjectionTy<'_>) {
self.add_substs(projection_ty.substs);
}
- fn add_substs(&mut self, substs: &Substs) {
+ fn add_substs(&mut self, substs: &Substs<'_>) {
for ty in substs.types() {
self.add_ty(ty);
}
}
impl<'tcx> TypeVisitor<'tcx> for HasTypeFlagsVisitor {
- fn visit_ty(&mut self, t: Ty) -> bool {
+ fn visit_ty(&mut self, t: Ty<'_>) -> bool {
debug!("HasTypeFlagsVisitor: t={:?} t.flags={:?} self.flags={:?}", t, t.flags, self.flags);
t.flags.intersects(self.flags)
}
}
impl<'tcx> fmt::Display for Instance<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
ppaux::parameterized(f, self.substs, self.def_id(), &[])?;
match self.def {
InstanceDef::Item(_) => Ok(()),
/// function tries to find a "characteristic def-id" for a
/// type. It's just a heuristic so it makes some questionable
/// decisions and we may want to adjust it later.
-pub fn characteristic_def_id_of_type(ty: Ty) -> Option<DefId> {
+pub fn characteristic_def_id_of_type(ty: Ty<'_>) -> Option<DefId> {
match ty.sty {
ty::Adt(adt_def, _) => Some(adt_def.did),
}
impl<'tcx> fmt::Display for LayoutError<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
LayoutError::Unknown(ty) => {
write!(f, "the type `{:?}` has an unknown layout", ty)
})
}
-pub fn provide(providers: &mut ty::query::Providers) {
+pub fn provide(providers: &mut ty::query::Providers<'_>) {
*providers = ty::query::Providers {
layout_raw,
..*providers
/// A univariant, but with a prefix of an arbitrary size & alignment (e.g. enum tag).
Prefixed(Size, Align),
}
- let univariant_uninterned = |fields: &[TyLayout], repr: &ReprOptions, kind| {
+ let univariant_uninterned = |fields: &[TyLayout<'_>], repr: &ReprOptions, kind| {
let packed = repr.packed();
if packed && repr.align > 0 {
bug!("struct cannot be packed and aligned");
fields.len()
};
let optimizing = &mut inverse_memory_index[..end];
- let field_align = |f: &TyLayout| {
+ let field_align = |f: &TyLayout<'_>| {
if packed { f.align.min(pack).abi() } else { f.align.abi() }
};
match kind {
size
})
};
- let univariant = |fields: &[TyLayout], repr: &ReprOptions, kind| {
+ let univariant = |fields: &[TyLayout<'_>], repr: &ReprOptions, kind| {
Ok(tcx.intern_layout(univariant_uninterned(fields, repr, kind)?))
};
debug_assert!(!ty.has_infer_types());
// but *not* an encoding of the discriminant (e.g. a tag value).
// See issue #49298 for more details on the need to leave space
// for non-ZST uninhabited data (mostly partial initialization).
- let absent = |fields: &[TyLayout]| {
+ let absent = |fields: &[TyLayout<'_>]| {
let uninhabited = fields.iter().any(|f| f.abi == Abi::Uninhabited);
let is_zst = fields.iter().all(|f| f.is_zst());
uninhabited && is_zst
}
}
- pub fn same_size(self, other: SizeSkeleton) -> bool {
+ pub fn same_size(self, other: SizeSkeleton<'_>) -> bool {
match (self, other) {
(SizeSkeleton::Known(a), SizeSkeleton::Known(b)) => a == b,
(SizeSkeleton::Pointer { tail: a, .. },
}
impl Visibility {
- pub fn from_hir(visibility: &hir::Visibility, id: NodeId, tcx: TyCtxt) -> Self {
+ pub fn from_hir(visibility: &hir::Visibility, id: NodeId, tcx: TyCtxt<'_, '_, '_>) -> Self {
match visibility.node {
hir::VisibilityKind::Public => Visibility::Public,
hir::VisibilityKind::Crate(_) => Visibility::Restricted(DefId::local(CRATE_DEF_INDEX)),
impl<'tcx> Hash for TyS<'tcx> {
fn hash<H: Hasher>(&self, s: &mut H) {
- (self as *const TyS).hash(s)
+ (self as *const TyS<'_>).hash(s)
}
}
}
impl<T: fmt::Debug> fmt::Debug for List<T> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
(**self).fmt(f)
}
}
self.skip_binder().projection_ty.item_def_id
}
- pub fn to_poly_trait_ref(&self, tcx: TyCtxt) -> PolyTraitRef<'tcx> {
+ pub fn to_poly_trait_ref(&self, tcx: TyCtxt<'_, '_, '_>) -> PolyTraitRef<'tcx> {
// Note: unlike with TraitRef::to_poly_trait_ref(),
// self.0.trait_ref is permitted to have escaping regions.
// This is because here `self` has a `Binder` and so does our
}
impl fmt::Debug for UniverseIndex {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "U{}", self.as_u32())
}
}
});
impl ReprOptions {
- pub fn new(tcx: TyCtxt, did: DefId) -> ReprOptions {
+ pub fn new(tcx: TyCtxt<'_, '_, '_>, did: DefId) -> ReprOptions {
let mut flags = ReprFlags::empty();
let mut size = None;
let mut max_align = 0;
}
impl<'a, 'gcx, 'tcx> AdtDef {
- fn new(tcx: TyCtxt,
+ fn new(tcx: TyCtxt<'_, '_, '_>,
did: DefId,
kind: AdtKind,
variants: Vec<VariantDef>,
}
}
- pub fn field_index(self, node_id: NodeId, tables: &TypeckTables) -> usize {
+ pub fn field_index(self, node_id: NodeId, tables: &TypeckTables<'_>) -> usize {
let hir_id = self.hir.node_to_hir_id(node_id);
tables.field_indices().get(hir_id).cloned().expect("no index for a field")
}
}
/// Yields the parent function's `DefId` if `def_id` is an `impl Trait` definition
-pub fn is_impl_trait_defn(tcx: TyCtxt, def_id: DefId) -> Option<DefId> {
+pub fn is_impl_trait_defn(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option<DefId> {
if let Some(node_id) = tcx.hir.as_local_node_id(def_id) {
if let Node::Item(item) = tcx.hir.get(node_id) {
if let hir::ItemKind::Existential(ref exist_ty) = item.node {
}
}
-pub fn provide(providers: &mut ty::query::Providers) {
+pub fn provide(providers: &mut ty::query::Providers<'_>) {
context::provide(providers);
erase_regions::provide(providers);
layout::provide(providers);
}
impl fmt::Display for SymbolName {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&self.name, fmt)
}
}
impl fmt::Debug for SymbolName {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&self.name, fmt)
}
}
```rust
impl<'tcx> QueryDescription for queries::type_of<'tcx> {
- fn describe(tcx: TyCtxt, key: DefId) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, key: DefId) -> String {
format!("computing the type of `{}`", tcx.item_path_str(key))
}
}
}
pub(super) trait QueryDescription<'tcx>: QueryAccessors<'tcx> {
- fn describe(tcx: TyCtxt, key: Self::Key) -> String;
+ fn describe(tcx: TyCtxt<'_, '_, '_>, key: Self::Key) -> String;
#[inline]
fn cache_on_disk(_: Self::Key) -> bool {
}
impl<'tcx, M: QueryAccessors<'tcx, Key=DefId>> QueryDescription<'tcx> for M {
- default fn describe(tcx: TyCtxt, def_id: DefId) -> String {
+ default fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> String {
if !tcx.sess.verbose() {
format!("processing `{}`", tcx.item_path_str(def_id))
} else {
impl<'tcx> QueryDescription<'tcx> for queries::normalize_projection_ty<'tcx> {
fn describe(
- _tcx: TyCtxt,
+ _tcx: TyCtxt<'_, '_, '_>,
goal: CanonicalProjectionGoal<'tcx>,
) -> String {
format!("normalizing `{:?}`", goal)
}
impl<'tcx> QueryDescription<'tcx> for queries::implied_outlives_bounds<'tcx> {
- fn describe(_tcx: TyCtxt, goal: CanonicalTyGoal<'tcx>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: CanonicalTyGoal<'tcx>) -> String {
format!("computing implied outlives bounds for `{:?}`", goal)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::dropck_outlives<'tcx> {
- fn describe(_tcx: TyCtxt, goal: CanonicalTyGoal<'tcx>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: CanonicalTyGoal<'tcx>) -> String {
format!("computing dropck types for `{:?}`", goal)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::normalize_ty_after_erasing_regions<'tcx> {
- fn describe(_tcx: TyCtxt, goal: ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
format!("normalizing `{:?}`", goal)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::evaluate_obligation<'tcx> {
- fn describe(_tcx: TyCtxt, goal: CanonicalPredicateGoal<'tcx>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: CanonicalPredicateGoal<'tcx>) -> String {
format!("evaluating trait selection obligation `{}`", goal.value.value)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::type_op_eq<'tcx> {
- fn describe(_tcx: TyCtxt, goal: CanonicalTypeOpEqGoal<'tcx>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: CanonicalTypeOpEqGoal<'tcx>) -> String {
format!("evaluating `type_op_eq` `{:?}`", goal)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::type_op_subtype<'tcx> {
- fn describe(_tcx: TyCtxt, goal: CanonicalTypeOpSubtypeGoal<'tcx>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: CanonicalTypeOpSubtypeGoal<'tcx>) -> String {
format!("evaluating `type_op_subtype` `{:?}`", goal)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::type_op_prove_predicate<'tcx> {
- fn describe(_tcx: TyCtxt, goal: CanonicalTypeOpProvePredicateGoal<'tcx>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: CanonicalTypeOpProvePredicateGoal<'tcx>) -> String {
format!("evaluating `type_op_prove_predicate` `{:?}`", goal)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::type_op_normalize_ty<'tcx> {
- fn describe(_tcx: TyCtxt, goal: CanonicalTypeOpNormalizeGoal<'tcx, Ty<'tcx>>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>,
+ goal: CanonicalTypeOpNormalizeGoal<'tcx, Ty<'tcx>>) -> String {
format!("normalizing `{:?}`", goal)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::type_op_normalize_predicate<'tcx> {
fn describe(
- _tcx: TyCtxt,
+ _tcx: TyCtxt<'_, '_, '_>,
goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::Predicate<'tcx>>,
) -> String {
format!("normalizing `{:?}`", goal)
impl<'tcx> QueryDescription<'tcx> for queries::type_op_normalize_poly_fn_sig<'tcx> {
fn describe(
- _tcx: TyCtxt,
+ _tcx: TyCtxt<'_, '_, '_>,
goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::PolyFnSig<'tcx>>,
) -> String {
format!("normalizing `{:?}`", goal)
}
impl<'tcx> QueryDescription<'tcx> for queries::type_op_normalize_fn_sig<'tcx> {
- fn describe(_tcx: TyCtxt, goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::FnSig<'tcx>>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>,
+ goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::FnSig<'tcx>>) -> String {
format!("normalizing `{:?}`", goal)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_copy_raw<'tcx> {
- fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
format!("computing whether `{}` is `Copy`", env.value)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_sized_raw<'tcx> {
- fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
format!("computing whether `{}` is `Sized`", env.value)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_freeze_raw<'tcx> {
- fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
format!("computing whether `{}` is freeze", env.value)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::needs_drop_raw<'tcx> {
- fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
format!("computing whether `{}` needs drop", env.value)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::layout_raw<'tcx> {
- fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
format!("computing layout of `{}`", env.value)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::super_predicates_of<'tcx> {
- fn describe(tcx: TyCtxt, def_id: DefId) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> String {
format!("computing the supertraits of `{}`",
tcx.item_path_str(def_id))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::erase_regions_ty<'tcx> {
- fn describe(_tcx: TyCtxt, ty: Ty<'tcx>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, ty: Ty<'tcx>) -> String {
format!("erasing regions from `{:?}`", ty)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::type_param_predicates<'tcx> {
- fn describe(tcx: TyCtxt, (_, def_id): (DefId, DefId)) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, (_, def_id): (DefId, DefId)) -> String {
let id = tcx.hir.as_local_node_id(def_id).unwrap();
format!("computing the bounds for type parameter `{}`",
tcx.hir.ty_param_name(id))
}
impl<'tcx> QueryDescription<'tcx> for queries::coherent_trait<'tcx> {
- fn describe(tcx: TyCtxt, def_id: DefId) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> String {
format!("coherence checking all impls of trait `{}`",
tcx.item_path_str(def_id))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::upstream_monomorphizations<'tcx> {
- fn describe(_: TyCtxt, k: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, k: CrateNum) -> String {
format!("collecting available upstream monomorphizations `{:?}`", k)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::crate_inherent_impls<'tcx> {
- fn describe(_: TyCtxt, k: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, k: CrateNum) -> String {
format!("all inherent impls defined in crate `{:?}`", k)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::crate_inherent_impls_overlap_check<'tcx> {
- fn describe(_: TyCtxt, _: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"check for overlap between inherent impls defined in this crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::crate_variances<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"computing the variances for items in this crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::inferred_outlives_crate<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"computing the inferred outlives predicates for items in this crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::mir_shims<'tcx> {
- fn describe(tcx: TyCtxt, def: ty::InstanceDef<'tcx>) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, def: ty::InstanceDef<'tcx>) -> String {
format!("generating MIR shim for `{}`",
tcx.item_path_str(def.def_id()))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::privacy_access_levels<'tcx> {
- fn describe(_: TyCtxt, _: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"privacy access levels".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::typeck_item_bodies<'tcx> {
- fn describe(_: TyCtxt, _: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"type-checking all item bodies".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::reachable_set<'tcx> {
- fn describe(_: TyCtxt, _: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"reachability".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::const_eval<'tcx> {
- fn describe(tcx: TyCtxt, key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>) -> String {
format!("const-evaluating `{}`", tcx.item_path_str(key.value.instance.def.def_id()))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::mir_keys<'tcx> {
- fn describe(_: TyCtxt, _: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"getting a list of all mir_keys".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::symbol_name<'tcx> {
- fn describe(_tcx: TyCtxt, instance: ty::Instance<'tcx>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, instance: ty::Instance<'tcx>) -> String {
format!("computing the symbol for `{}`", instance)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::describe_def<'tcx> {
- fn describe(_: TyCtxt, _: DefId) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> String {
bug!("describe_def")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::def_span<'tcx> {
- fn describe(_: TyCtxt, _: DefId) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> String {
bug!("def_span")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::lookup_stability<'tcx> {
- fn describe(_: TyCtxt, _: DefId) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> String {
bug!("stability")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::lookup_deprecation_entry<'tcx> {
- fn describe(_: TyCtxt, _: DefId) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> String {
bug!("deprecation")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::item_attrs<'tcx> {
- fn describe(_: TyCtxt, _: DefId) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> String {
bug!("item_attrs")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_reachable_non_generic<'tcx> {
- fn describe(_: TyCtxt, _: DefId) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> String {
bug!("is_reachable_non_generic")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::fn_arg_names<'tcx> {
- fn describe(_: TyCtxt, _: DefId) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> String {
bug!("fn_arg_names")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::impl_parent<'tcx> {
- fn describe(_: TyCtxt, _: DefId) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> String {
bug!("impl_parent")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::trait_of_item<'tcx> {
- fn describe(_: TyCtxt, _: DefId) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> String {
bug!("trait_of_item")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::const_is_rvalue_promotable_to_static<'tcx> {
- fn describe(tcx: TyCtxt, def_id: DefId) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> String {
format!("const checking if rvalue is promotable to static `{}`",
tcx.item_path_str(def_id))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::rvalue_promotable_map<'tcx> {
- fn describe(tcx: TyCtxt, def_id: DefId) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> String {
format!("checking which parts of `{}` are promotable to static",
tcx.item_path_str(def_id))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_mir_available<'tcx> {
- fn describe(tcx: TyCtxt, def_id: DefId) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> String {
format!("checking if item is mir available: `{}`",
tcx.item_path_str(def_id))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::codegen_fulfill_obligation<'tcx> {
- fn describe(tcx: TyCtxt, key: (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>,
+ key: (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) -> String {
format!("checking if `{}` fulfills its obligations", tcx.item_path_str(key.1.def_id()))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::trait_impls_of<'tcx> {
- fn describe(tcx: TyCtxt, def_id: DefId) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> String {
format!("trait impls of `{}`", tcx.item_path_str(def_id))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_object_safe<'tcx> {
- fn describe(tcx: TyCtxt, def_id: DefId) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> String {
format!("determine object safety of trait `{}`", tcx.item_path_str(def_id))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_const_fn<'tcx> {
- fn describe(tcx: TyCtxt, def_id: DefId) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> String {
format!("checking if item is const fn: `{}`", tcx.item_path_str(def_id))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::dylib_dependency_formats<'tcx> {
- fn describe(_: TyCtxt, _: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"dylib dependency formats of crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_panic_runtime<'tcx> {
- fn describe(_: TyCtxt, _: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"checking if the crate is_panic_runtime".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_compiler_builtins<'tcx> {
- fn describe(_: TyCtxt, _: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"checking if the crate is_compiler_builtins".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::has_global_allocator<'tcx> {
- fn describe(_: TyCtxt, _: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"checking if the crate has_global_allocator".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::has_panic_handler<'tcx> {
- fn describe(_: TyCtxt, _: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"checking if the crate has_panic_handler".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::extern_crate<'tcx> {
- fn describe(_: TyCtxt, _: DefId) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> String {
"getting crate's ExternCrateData".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::lint_levels<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"computing the lint levels for items in this crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::specializes<'tcx> {
- fn describe(_tcx: TyCtxt, _: (DefId, DefId)) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: (DefId, DefId)) -> String {
"computing whether impls specialize one another".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::in_scope_traits_map<'tcx> {
- fn describe(_tcx: TyCtxt, _: DefIndex) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: DefIndex) -> String {
"traits in scope at a block".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_no_builtins<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"test whether a crate has #![no_builtins]".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::panic_strategy<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"query a crate's configured panic strategy".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_profiler_runtime<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"query a crate is #![profiler_runtime]".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_sanitizer_runtime<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"query a crate is #![sanitizer_runtime]".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::reachable_non_generics<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up the exported symbols of a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::native_libraries<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up the native libraries of a linked crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::foreign_modules<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up the foreign modules of a linked crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::plugin_registrar_fn<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up the plugin registrar for a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::derive_registrar_fn<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up the derive registrar for a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::crate_disambiguator<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up the disambiguator a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::crate_hash<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up the hash a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::original_crate_name<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up the original name a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::extra_filename<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up the extra filename for a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::implementations_of_trait<'tcx> {
- fn describe(_tcx: TyCtxt, _: (CrateNum, DefId)) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: (CrateNum, DefId)) -> String {
"looking up implementations of a trait in a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::all_trait_implementations<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up all (?) trait implementations".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::link_args<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up link arguments for a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::resolve_lifetimes<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"resolving lifetimes".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::named_region_map<'tcx> {
- fn describe(_tcx: TyCtxt, _: DefIndex) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: DefIndex) -> String {
"looking up a named region".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_late_bound_map<'tcx> {
- fn describe(_tcx: TyCtxt, _: DefIndex) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: DefIndex) -> String {
"testing if a region is late bound".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::object_lifetime_defaults_map<'tcx> {
- fn describe(_tcx: TyCtxt, _: DefIndex) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: DefIndex) -> String {
"looking up lifetime defaults for a region".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::dep_kind<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"fetching what a dependency looks like".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::crate_name<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"fetching what a crate is named".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::get_lib_features<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
format!("calculating the lib features map")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::defined_lib_features<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
format!("calculating the lib features defined in a crate")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::get_lang_items<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"calculating the lang items map".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::defined_lang_items<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"calculating the lang items defined in a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::missing_lang_items<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"calculating the missing lang items in a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::visible_parent_map<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"calculating the visible parent map".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::missing_extern_crate_item<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"seeing if we're missing an `extern crate` item for this crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::used_crate_source<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking at the source for a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::postorder_cnums<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"generating a postorder list of CrateNums".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::maybe_unused_extern_crates<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up all possibly unused extern crates".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::stability_index<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"calculating the stability index for the local crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::all_traits<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"fetching all foreign and local traits".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::all_crate_nums<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"fetching all foreign CrateNum instances".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::exported_symbols<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"exported_symbols".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::collect_and_partition_mono_items<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"collect_and_partition_mono_items".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::codegen_unit<'tcx> {
- fn describe(_tcx: TyCtxt, _: InternedString) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: InternedString) -> String {
"codegen_unit".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::output_filenames<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"output_filenames".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::vtable_methods<'tcx> {
- fn describe(tcx: TyCtxt, key: ty::PolyTraitRef<'tcx> ) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, key: ty::PolyTraitRef<'tcx> ) -> String {
format!("finding all methods for trait {}", tcx.item_path_str(key.def_id()))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::features_query<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up enabled feature gates".to_string()
}
}
}
impl<'tcx> QueryDescription<'tcx> for queries::substitute_normalize_and_test_predicates<'tcx> {
- fn describe(tcx: TyCtxt, key: (DefId, &'tcx Substs<'tcx>)) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, key: (DefId, &'tcx Substs<'tcx>)) -> String {
format!("testing substituted normalized predicates:`{}`", tcx.item_path_str(key.0))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::target_features_whitelist<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up the whitelist of target features".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::instance_def_size_estimate<'tcx> {
- fn describe(tcx: TyCtxt, def: ty::InstanceDef<'tcx>) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, def: ty::InstanceDef<'tcx>) -> String {
format!("estimating size for `{}`", tcx.item_path_str(def.def_id()))
}
}
}
impl<'tcx> QueryDescription<'tcx> for queries::program_clauses_for<'tcx> {
- fn describe(_tcx: TyCtxt, _: DefId) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: DefId) -> String {
"generating chalk-style clauses".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::program_clauses_for_env<'tcx> {
- fn describe(_tcx: TyCtxt, _: ty::ParamEnv<'tcx>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: ty::ParamEnv<'tcx>) -> String {
"generating chalk-style clauses for param env".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::wasm_import_module_map<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"wasm import module map".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::dllimport_foreign_items<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"wasm import module map".to_string()
}
}
/// In the event that a cycle occurs, if no explicit span has been
/// given for a query with key `self`, what span should we use?
- fn default_span(&self, tcx: TyCtxt) -> Span;
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span;
}
impl<'tcx> Key for ty::InstanceDef<'tcx> {
LOCAL_CRATE
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
tcx.def_span(self.def_id())
}
}
LOCAL_CRATE
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
tcx.def_span(self.def_id())
}
}
self.instance.query_crate()
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
self.instance.default_span(tcx)
}
}
fn query_crate(&self) -> CrateNum {
*self
}
- fn default_span(&self, _: TyCtxt) -> Span {
+ fn default_span(&self, _: TyCtxt<'_, '_, '_>) -> Span {
DUMMY_SP
}
}
fn query_crate(&self) -> CrateNum {
LOCAL_CRATE
}
- fn default_span(&self, _tcx: TyCtxt) -> Span {
+ fn default_span(&self, _tcx: TyCtxt<'_, '_, '_>) -> Span {
DUMMY_SP
}
}
fn query_crate(&self) -> CrateNum {
self.krate
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
tcx.def_span(*self)
}
}
fn query_crate(&self) -> CrateNum {
self.0.krate
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
self.1.default_span(tcx)
}
}
fn query_crate(&self) -> CrateNum {
self.0
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
self.1.default_span(tcx)
}
}
fn query_crate(&self) -> CrateNum {
self.0.krate
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
self.0.default_span(tcx)
}
}
fn query_crate(&self) -> CrateNum {
self.0.krate
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
self.0.default_span(tcx)
}
}
fn query_crate(&self) -> CrateNum {
self.1.def_id().krate
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
tcx.def_span(self.1.def_id())
}
}
fn query_crate(&self) -> CrateNum {
self.def_id().krate
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
tcx.def_span(self.def_id())
}
}
fn query_crate(&self) -> CrateNum {
LOCAL_CRATE
}
- fn default_span(&self, _: TyCtxt) -> Span {
+ fn default_span(&self, _: TyCtxt<'_, '_, '_>) -> Span {
DUMMY_SP
}
}
fn query_crate(&self) -> CrateNum {
LOCAL_CRATE
}
- fn default_span(&self, _: TyCtxt) -> Span {
+ fn default_span(&self, _: TyCtxt<'_, '_, '_>) -> Span {
DUMMY_SP
}
}
fn query_crate(&self) -> CrateNum {
LOCAL_CRATE
}
- fn default_span(&self, _: TyCtxt) -> Span {
+ fn default_span(&self, _: TyCtxt<'_, '_, '_>) -> Span {
DUMMY_SP
}
}
fn query_crate(&self) -> CrateNum {
self.value.query_crate()
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
self.value.default_span(tcx)
}
}
fn query_crate(&self) -> CrateNum {
LOCAL_CRATE
}
- fn default_span(&self, _tcx: TyCtxt) -> Span {
+ fn default_span(&self, _tcx: TyCtxt<'_, '_, '_>) -> Span {
DUMMY_SP
}
}
LOCAL_CRATE
}
- fn default_span(&self, _tcx: TyCtxt) -> Span {
+ fn default_span(&self, _tcx: TyCtxt<'_, '_, '_>) -> Span {
DUMMY_SP
}
}
span: Span,
key: DefId,
) -> Result<&'tcx [Ty<'tcx>], DiagnosticBuilder<'a>> {
- self.try_get_query::<queries::adt_sized_constraint>(span, key)
+ self.try_get_query::<queries::adt_sized_constraint<'_>>(span, key)
}
pub fn try_needs_drop_raw(
self,
span: Span,
key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>,
) -> Result<bool, DiagnosticBuilder<'a>> {
- self.try_get_query::<queries::needs_drop_raw>(span, key)
+ self.try_get_query::<queries::needs_drop_raw<'_>>(span, key)
}
pub fn try_optimized_mir(
self,
span: Span,
key: DefId,
) -> Result<&'tcx mir::Mir<'tcx>, DiagnosticBuilder<'a>> {
- self.try_get_query::<queries::optimized_mir>(span, key)
+ self.try_get_query::<queries::optimized_mir<'_>>(span, key)
}
}
let enc = &mut encoder;
let qri = &mut query_result_index;
- encode_query_results::<type_of, _>(tcx, enc, qri)?;
- encode_query_results::<generics_of, _>(tcx, enc, qri)?;
- encode_query_results::<predicates_of, _>(tcx, enc, qri)?;
- encode_query_results::<used_trait_imports, _>(tcx, enc, qri)?;
- encode_query_results::<typeck_tables_of, _>(tcx, enc, qri)?;
- encode_query_results::<codegen_fulfill_obligation, _>(tcx, enc, qri)?;
- encode_query_results::<optimized_mir, _>(tcx, enc, qri)?;
- encode_query_results::<unsafety_check_result, _>(tcx, enc, qri)?;
- encode_query_results::<borrowck, _>(tcx, enc, qri)?;
- encode_query_results::<mir_borrowck, _>(tcx, enc, qri)?;
- encode_query_results::<mir_const_qualif, _>(tcx, enc, qri)?;
- encode_query_results::<def_symbol_name, _>(tcx, enc, qri)?;
- encode_query_results::<const_is_rvalue_promotable_to_static, _>(tcx, enc, qri)?;
- encode_query_results::<symbol_name, _>(tcx, enc, qri)?;
- encode_query_results::<check_match, _>(tcx, enc, qri)?;
- encode_query_results::<codegen_fn_attrs, _>(tcx, enc, qri)?;
- encode_query_results::<specialization_graph_of, _>(tcx, enc, qri)?;
+ encode_query_results::<type_of<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<generics_of<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<predicates_of<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<used_trait_imports<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<typeck_tables_of<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<codegen_fulfill_obligation<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<optimized_mir<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<unsafety_check_result<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<borrowck<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<mir_borrowck<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<mir_const_qualif<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<def_symbol_name<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<const_is_rvalue_promotable_to_static<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<symbol_name<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<check_match<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<codegen_fn_attrs<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<specialization_graph_of<'_>, _>(tcx, enc, qri)?;
// const eval is special, it only encodes successfully evaluated constants
use ty::query::QueryAccessors;
return Ok(());
- fn sorted_cnums_including_local_crate(tcx: TyCtxt) -> Vec<CrateNum> {
+ fn sorted_cnums_including_local_crate(tcx: TyCtxt<'_, '_, '_>) -> Vec<CrateNum> {
let mut cnums = vec![LOCAL_CRATE];
cnums.extend_from_slice(&tcx.crates()[..]);
cnums.sort_unstable();
// current-session-CrateNum. There might be CrateNums from the previous
// Session that don't occur in the current one. For these, the mapping
// maps to None.
- fn compute_cnum_map(tcx: TyCtxt,
+ fn compute_cnum_map(tcx: TyCtxt<'_, '_, '_>,
prev_cnums: &[(u32, String, CrateDisambiguator)])
-> IndexVec<CrateNum, Option<CrateNum>>
{
}
}
- pub fn describe(&self, tcx: TyCtxt) -> String {
+ pub fn describe(&self, tcx: TyCtxt<'_, '_, '_>) -> String {
let (r, name) = match *self {
$(Query::$name(key) => {
(queries::$name::describe(tcx, key), stringify!($name))
///
/// Note: The optimization is only available during incr. comp.
pub fn ensure(tcx: TyCtxt<'a, $tcx, 'lcx>, key: $K) -> () {
- tcx.ensure_query::<queries::$name>(key);
+ tcx.ensure_query::<queries::$name<'_>>(key);
}
})*
impl<'a, $tcx, 'lcx> TyCtxtAt<'a, $tcx, 'lcx> {
$($(#[$attr])*
pub fn $name(self, key: $K) -> $V {
- self.tcx.get_query::<queries::$name>(self.span, key)
+ self.tcx.get_query::<queries::$name<'_>>(self.span, key)
})*
}
)
);
- match tcx.force_query::<::ty::query::queries::$query>($key, DUMMY_SP, *dep_node) {
+ match tcx.force_query::<::ty::query::queries::$query<'_>>(
+ $key, DUMMY_SP, *dep_node
+ ) {
Ok(_) => {},
Err(e) => {
tcx.report_cycle(e).emit();
impl DepNode {
// Check whether the query invocation corresponding to the given
// DepNode is eligible for on-disk-caching.
- pub fn cache_on_disk(&self, tcx: TyCtxt) -> bool {
+ pub fn cache_on_disk(&self, tcx: TyCtxt<'_, '_, '_>) -> bool {
use ty::query::queries;
use ty::query::QueryDescription;
// above `cache_on_disk` methods returns true.
// Also, as a sanity check, it expects that the corresponding query
// invocation has been marked as green already.
- pub fn load_from_on_disk_cache(&self, tcx: TyCtxt) {
+ pub fn load_from_on_disk_cache(&self, tcx: TyCtxt<'_, '_, '_>) {
match self.kind {
$(DepKind::$dep_kind => {
debug_assert!(tcx.dep_graph
}
}
- pub fn borrow(&self) -> MappedReadGuard<T> {
+ pub fn borrow(&self) -> MappedReadGuard<'_, T> {
ReadGuard::map(self.value.borrow(), |opt| match *opt {
None => bug!("attempted to read from stolen value"),
Some(ref v) => v
pub fn with_self_ty(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, self_ty: Ty<'tcx>)
-> ty::TraitRef<'tcx> {
// otherwise the escaping regions would be captured by the binder
- debug_assert!(!self_ty.has_escaping_regions());
+ // debug_assert!(!self_ty.has_escaping_regions());
ty::TraitRef {
def_id: self.def_id,
/// Construct a ProjectionTy by searching the trait from trait_ref for the
/// associated item named item_name.
pub fn from_ref_and_name(
- tcx: TyCtxt, trait_ref: ty::TraitRef<'tcx>, item_name: Ident
+ tcx: TyCtxt<'_, '_, '_>, trait_ref: ty::TraitRef<'tcx>, item_name: Ident
) -> ProjectionTy<'tcx> {
let item_def_id = tcx.associated_items(trait_ref.def_id).find(|item| {
item.kind == ty::AssociatedKind::Type &&
/// Extracts the underlying trait reference from this projection.
/// For example, if this is a projection of `<T as Iterator>::Item`,
/// then this function would return a `T: Iterator` trait reference.
- pub fn trait_ref(&self, tcx: TyCtxt) -> ty::TraitRef<'tcx> {
+ pub fn trait_ref(&self, tcx: TyCtxt<'_, '_, '_>) -> ty::TraitRef<'tcx> {
let def_id = tcx.associated_item(self.item_def_id).container.id();
ty::TraitRef {
def_id,
/// For example, if this is a projection of `exists T. <T as Iterator>::Item == X`,
/// then this function would return a `exists T. T: Iterator` existential trait
/// reference.
- pub fn trait_ref(&self, tcx: TyCtxt) -> ty::ExistentialTraitRef<'tcx> {
+ pub fn trait_ref(&self, tcx: TyCtxt<'_, '_, '_>) -> ty::ExistentialTraitRef<'tcx> {
let def_id = tcx.associated_item(self.item_def_id).container.id();
ty::ExistentialTraitRef{
def_id,
}
}
- pub fn simd_size(&self, _cx: TyCtxt) -> usize {
+ pub fn simd_size(&self, _cx: TyCtxt<'_, '_, '_>) -> usize {
match self.sty {
Adt(def, _) => def.non_enum_variant().fields.len(),
_ => bug!("simd_size called on invalid type")
}
impl<'tcx> Ord for Kind<'tcx> {
- fn cmp(&self, other: &Kind) -> Ordering {
+ fn cmp(&self, other: &Kind<'_>) -> Ordering {
self.unpack().cmp(&other.unpack())
}
}
impl<'tcx> PartialOrd for Kind<'tcx> {
- fn partial_cmp(&self, other: &Kind) -> Option<Ordering> {
+ fn partial_cmp(&self, other: &Kind<'_>) -> Option<Ordering> {
Some(self.cmp(&other))
}
}
}
impl<'tcx> fmt::Debug for Kind<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.unpack() {
UnpackedKind::Lifetime(lt) => write!(f, "{:?}", lt),
UnpackedKind::Type(ty) => write!(f, "{:?}", ty),
}
impl<'tcx> fmt::Display for Kind<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.unpack() {
UnpackedKind::Lifetime(lt) => write!(f, "{}", lt),
UnpackedKind::Type(ty) => write!(f, "{}", ty),
}
impl<'tcx> fmt::Display for Discr<'tcx> {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.ty.sty {
ty::Int(ity) => {
let bits = ty::tls::with(|tcx| {
// To avoid a stack overflow when checking an enum variant or struct that
// contains a different, structurally recursive type, maintain a stack
// of seen types and check recursion for each of them (issues #3008, #3779).
- let mut seen: Vec<Ty> = Vec::new();
+ let mut seen: Vec<Ty<'_>> = Vec::new();
let mut representable_cache = FxHashMap();
let r = is_type_structurally_recursive(
tcx, sp, &mut seen, &mut representable_cache, self);
}
}
-pub fn provide(providers: &mut ty::query::Providers) {
+pub fn provide(providers: &mut ty::query::Providers<'_>) {
*providers = ty::query::Providers {
is_copy_raw,
is_sized_raw,
#[cold]
#[inline(never)]
-pub fn bug_fmt(file: &'static str, line: u32, args: fmt::Arguments) -> ! {
+pub fn bug_fmt(file: &'static str, line: u32, args: fmt::Arguments<'_>) -> ! {
// this wrapper mostly exists so I don't have to write a fully
// qualified path of None::<Span> inside the bug!() macro definition
opt_span_bug_fmt(file, line, None::<Span>, args);
file: &'static str,
line: u32,
span: S,
- args: fmt::Arguments,
+ args: fmt::Arguments<'_>,
) -> ! {
opt_span_bug_fmt(file, line, Some(span), args);
}
file: &'static str,
line: u32,
span: Option<S>,
- args: fmt::Arguments,
+ args: fmt::Arguments<'_>,
) -> ! {
tls::with_opt(move |tcx| {
let msg = format!("{}:{}: {}", file, line, args);
thread_local!(static TIME_DEPTH: Cell<usize> = Cell::new(0));
lazy_static! {
- static ref DEFAULT_HOOK: Box<dyn Fn(&panic::PanicInfo) + Sync + Send + 'static> = {
+ static ref DEFAULT_HOOK: Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static> = {
let hook = panic::take_hook();
panic::set_hook(Box::new(panic_hook));
hook
};
}
-fn panic_hook(info: &panic::PanicInfo) {
+fn panic_hook(info: &panic::PanicInfo<'_>) {
if !proc_macro::__internal::in_sess() {
(*DEFAULT_HOOK)(info);
macro_rules! gen_display_debug_body {
( $with:path ) => {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut cx = PrintContext::new();
$with(self, f, &mut cx)
}
impl PrintContext {
fn fn_sig<F: fmt::Write>(&mut self,
f: &mut F,
- inputs: &[Ty],
+ inputs: &[Ty<'_>],
variadic: bool,
- output: Ty)
+ output: Ty<'_>)
-> fmt::Result {
write!(f, "(")?;
let mut inputs = inputs.iter();
fn parameterized<F: fmt::Write>(&mut self,
f: &mut F,
- substs: &subst::Substs,
+ substs: &subst::Substs<'_>,
mut did: DefId,
- projections: &[ty::ProjectionPredicate])
+ projections: &[ty::ProjectionPredicate<'_>])
-> fmt::Result {
let key = ty::tls::with(|tcx| tcx.def_key(did));
let mut item_name = if let Some(name) = key.disambiguated_data.data.get_opt_name() {
let print_regions = |f: &mut F, start: &str, skip, count| {
// Don't print any regions if they're all erased.
let regions = || substs.regions().skip(skip).take(count);
- if regions().all(|r: ty::Region| *r == ty::ReErased) {
+ if regions().all(|r: ty::Region<'_>| *r == ty::ReErased) {
return Ok(());
}
for region in regions() {
- let region: ty::Region = region;
+ let region: ty::Region<'_> = region;
start_or_continue(f, start, ", ")?;
if verbose {
write!(f, "{:?}", region)?;
}
pub fn parameterized<F: fmt::Write>(f: &mut F,
- substs: &subst::Substs,
+ substs: &subst::Substs<'_>,
did: DefId,
- projections: &[ty::ProjectionPredicate])
+ projections: &[ty::ProjectionPredicate<'_>])
-> fmt::Result {
PrintContext::new().parameterized(f, substs, did, projections)
}
}
impl fmt::Debug for ty::GenericParamDef {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let type_name = match self.kind {
ty::GenericParamDefKind::Lifetime => "Lifetime",
ty::GenericParamDefKind::Type {..} => "Type",
}
impl fmt::Debug for ty::TraitDef {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
ty::tls::with(|tcx| {
write!(f, "{}", tcx.item_path_str(self.def_id))
})
}
impl fmt::Debug for ty::AdtDef {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
ty::tls::with(|tcx| {
write!(f, "{}", tcx.item_path_str(self.did))
})
}
impl<'tcx> fmt::Debug for ty::ClosureUpvar<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ClosureUpvar({:?},{:?})",
self.def,
self.ty)
}
impl fmt::Debug for ty::UpvarId {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "UpvarId({:?};`{}`;{:?})",
self.var_id,
ty::tls::with(|tcx| tcx.hir.name(tcx.hir.hir_to_node_id(self.var_id))),
}
impl<'tcx> fmt::Debug for ty::UpvarBorrow<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "UpvarBorrow({:?}, {:?})",
self.kind, self.region)
}
}
impl fmt::Debug for ty::TyVid {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "_#{}t", self.index)
}
}
impl fmt::Debug for ty::IntVid {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "_#{}i", self.index)
}
}
impl fmt::Debug for ty::FloatVid {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "_#{}f", self.index)
}
}
impl fmt::Debug for ty::RegionVid {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let Some((region, counter)) = get_highlight_region_for_regionvid() {
debug!("RegionVid.fmt: region={:?} self={:?} counter={:?}", region, self, counter);
return if *self == region {
}
impl fmt::Debug for ty::IntVarValue {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
ty::IntType(ref v) => v.fmt(f),
ty::UintType(ref v) => v.fmt(f),
}
impl fmt::Debug for ty::FloatVarValue {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
where T: fmt::Display + for<'a> ty::Lift<'a>,
for<'a> <T as ty::Lift<'a>>::Lifted: fmt::Display + TypeFoldable<'a>
{
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
ty::tls::with(|tcx| in_binder(f, tcx, self, tcx.lift(self)))
}
}*/
}
}
- fn print(&self, lock: &mut StdoutLock) {
+ fn print(&self, lock: &mut StdoutLock<'_>) {
writeln!(lock, "| Phase | Time (ms) | Queries | Hits (%) |")
.unwrap();
writeln!(lock, "| ---------------- | -------------- | -------------- | -------- |")
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(rustc_private)]
#[macro_use] extern crate log;
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![forbid(unsafe_code)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(try_from)]
// See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
#[allow(unused_extern_crates)]
#![sanitizer_runtime]
#![feature(alloc_system)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(sanitizer_runtime)]
#![feature(staged_api)]
#![no_std]
#![allow(non_camel_case_types)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(quote)]
#![recursion_limit="256"]
#![feature(in_band_lifetimes)]
#![allow(unused_attributes)]
#![feature(libc)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(quote)]
#![feature(range_contains)]
#![feature(rustc_diagnostic_macros)]
use abi::{FnType, FnTypeExt};
use common::*;
-use llvm;
use rustc::hir;
use rustc::ty::{self, Ty, TypeFoldable};
use rustc::ty::layout::{self, Align, LayoutOf, Size, TyLayout};
-use rustc_target::spec::PanicStrategy;
use rustc_target::abi::FloatTy;
use rustc_mir::monomorphize::item::DefPathBasedNames;
use type_::Type;
PointerKind::Shared
},
hir::MutMutable => {
- // Only emit noalias annotations for LLVM >= 6 or in panic=abort
- // mode, as prior versions had many bugs in conjunction with
- // unwinding. See also issue #31681.
+ // Previously we would only emit noalias annotations for LLVM >= 6 or in
+ // panic=abort mode. That was deemed right, as prior versions had many bugs
+ // in conjunction with unwinding, but later versions didn’t seem to have
+ // said issues. See issue #31681.
+ //
+ // Alas, later on we encountered a case where noalias would generate wrong
+ // code altogether even with recent versions of LLVM in *safe* code with no
+ // unwinding involved. See #54462.
+ //
+ // For now, do not enable mutable_noalias by default at all, while the
+ // issue is being figured out.
let mutable_noalias = cx.tcx.sess.opts.debugging_opts.mutable_noalias
- .unwrap_or(unsafe { llvm::LLVMRustVersionMajor() >= 6 }
- || cx.tcx.sess.panic_strategy() == PanicStrategy::Abort);
+ .unwrap_or(false);
if mutable_noalias {
PointerKind::UniqueBorrowed
} else {
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(custom_attribute)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![allow(unused_attributes)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
// See Cargo.toml for a comment explaining this crate.
#![allow(unused_extern_crates)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
extern crate bitflags;
extern crate log;
#![feature(unsize)]
#![feature(specialization)]
#![feature(optin_builtin_traits)]
-#![cfg_attr(stage0, feature(macro_vis_matcher))]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(allow_internal_unstable)]
#![feature(vec_resize_with)]
#![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)]
#![allow(unused_attributes)]
#![feature(range_contains)]
#![cfg_attr(unix, feature(libc))]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(optin_builtin_traits)]
extern crate atty;
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(specialization)]
#![recursion_limit="256"]
#![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)]
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(static_nobundle)]
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
#![sanitizer_runtime]
#![feature(alloc_system)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(sanitizer_runtime)]
#![feature(staged_api)]
#![no_std]
#![feature(box_patterns)]
#![feature(libc)]
#![feature(macro_at_most_once_rep)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(proc_macro_internals)]
#![feature(proc_macro_quote)]
#![feature(quote)]
if let Err(terr) = self.eq_opaque_type_and_type(
mir_output_ty,
normalized_output_ty,
+ self.mir_def_id,
Locations::All(output_span),
ConstraintCategory::BoringNoLocation,
) {
)
}
+ /// Try to relate `sub <: sup`; if this fails, instantiate opaque
+ /// variables in `sub` with their inferred definitions and try
+ /// again. This is used for opaque types in places (e.g., `let x:
+ /// impl Foo = ..`).
fn sub_types_or_anon(
&mut self,
sub: Ty<'tcx>,
) -> Fallible<()> {
if let Err(terr) = self.sub_types(sub, sup, locations, category) {
if let TyKind::Opaque(..) = sup.sty {
- return self.eq_opaque_type_and_type(sub, sup, locations, category);
+ // When you have `let x: impl Foo = ...` in a closure,
+ // the resulting inferend values are stored with the
+ // def-id of the base function.
+ let parent_def_id = self.tcx().closure_base_def_id(self.mir_def_id);
+ return self.eq_opaque_type_and_type(sub, sup, parent_def_id, locations, category);
} else {
return Err(terr);
}
&mut self,
revealed_ty: Ty<'tcx>,
anon_ty: Ty<'tcx>,
+ anon_owner_def_id: DefId,
locations: Locations,
category: ConstraintCategory,
) -> Fallible<()> {
+ debug!(
+ "eq_opaque_type_and_type( \
+ revealed_ty={:?}, \
+ anon_ty={:?})",
+ revealed_ty, anon_ty
+ );
let infcx = self.infcx;
let tcx = infcx.tcx;
let param_env = self.param_env;
- let parent_def_id = infcx.tcx.closure_base_def_id(self.mir_def_id);
+ debug!("eq_opaque_type_and_type: mir_def_id={:?}", self.mir_def_id);
let opaque_type_map = self.fully_perform_op(
locations,
category,
let dummy_body_id = ObligationCause::dummy().body_id;
let (output_ty, opaque_type_map) =
obligations.add(infcx.instantiate_opaque_types(
- parent_def_id,
+ anon_owner_def_id,
dummy_body_id,
param_env,
&anon_ty,
let opaque_defn_ty = opaque_defn_ty.subst(tcx, opaque_decl.substs);
let opaque_defn_ty = renumber::renumber_regions(infcx, &opaque_defn_ty);
debug!(
- "eq_opaque_type_and_type: concrete_ty={:?} opaque_defn_ty={:?}",
- opaque_decl.concrete_ty, opaque_defn_ty
+ "eq_opaque_type_and_type: concrete_ty={:?}={:?} opaque_defn_ty={:?}",
+ opaque_decl.concrete_ty,
+ infcx.resolve_type_vars_if_possible(&opaque_decl.concrete_ty),
+ opaque_defn_ty
);
obligations.add(infcx
.at(&ObligationCause::dummy(), param_env)
#![feature(core_intrinsics)]
#![feature(const_fn)]
#![feature(decl_macro)]
-#![cfg_attr(stage0, feature(macro_vis_matcher))]
#![feature(exhaustive_patterns)]
#![feature(range_contains)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_attrs)]
-#![cfg_attr(stage0, feature(attr_literals))]
#![feature(never_type)]
#![feature(specialization)]
#![feature(try_trait)]
#![sanitizer_runtime]
#![feature(alloc_system)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(sanitizer_runtime)]
#![feature(staged_api)]
#![no_std]
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)]
#[macro_use]
#![allow(nonstandard_style)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
pub struct Intrinsic {
pub inputs: &'static [&'static Type],
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)]
#[macro_use] extern crate syntax;
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"]
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)]
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"]
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![feature(box_syntax)]
-#![cfg_attr(stage0, feature(const_fn))]
-#![cfg_attr(not(stage0), feature(min_const_fn))]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(min_const_fn)]
+#![feature(nll)]
#![feature(slice_patterns)]
#[macro_use]
//! New recursive solver modeled on Chalk's recursive solver. Most of
//! the guts are broken up into modules; see the comments in those modules.
-#![cfg_attr(stage0, feature(crate_in_paths))]
#![feature(crate_visibility_modifier)]
-#![cfg_attr(stage0, feature(extern_prelude))]
#![feature(in_band_lifetimes)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![recursion_limit="256"]
#![sanitizer_runtime]
#![feature(alloc_system)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(sanitizer_runtime)]
#![feature(staged_api)]
#![no_std]
bound_region: ty::BrNamed(id, name)
}))
- // (*) -- not late-bound, won't change
+ // (*) -- not late-bound, won't change
}
None => {
};
debug!("ast_region_to_region(lifetime={:?}) yields {:?}",
- lifetime,
- r);
+ lifetime,
+ r);
r
}
span,
E0632,
"cannot provide explicit type parameters when `impl Trait` is \
- used in argument position."
+ used in argument position."
};
err.emit();
// region with the current anon region binding (in other words,
// whatever & would get replaced with).
debug!("create_substs_for_ast_path(def_id={:?}, self_ty={:?}, \
- generic_args={:?})",
+ generic_args={:?})",
def_id, self_ty, generic_args);
let tcx = self.tcx();
if default_needs_object_self(param) {
struct_span_err!(tcx.sess, span, E0393,
"the type parameter `{}` must be explicitly \
- specified",
+ specified",
param.name)
.span_label(span,
format!("missing reference to `{}`", param.name))
self.normalize_ty(
span,
tcx.at(span).type_of(param.def_id)
- .subst_spanned(tcx, substs.unwrap(), Some(span))
+ .subst_spanned(tcx, substs.unwrap(), Some(span))
).into()
}
} else if infer_types {
binding.span,
E0582,
"binding for associated type `{}` references lifetime `{}`, \
- which does not appear in the trait input types",
+ which does not appear in the trait input types",
binding.item_name, br_name)
.emit();
}
ref_id,
binding.span,
&format!("associated type binding `{}` specified more than once",
- binding.item_name)
+ binding.item_name)
);
err.span_label(binding.span, "used more than once");
err.span_label(*prev_span, format!("first use of `{}`", binding.item_name));
if !object_safety_violations.is_empty() {
tcx.report_object_safety_error(
span, principal.def_id(), object_safety_violations)
- .emit();
+ .emit();
return tcx.types.err;
}
for item_def_id in associated_types {
let assoc_item = tcx.associated_item(item_def_id);
let trait_def_id = assoc_item.container.id();
- struct_span_err!(tcx.sess, span, E0191,
- "the value of the associated type `{}` (from the trait `{}`) must be specified",
- assoc_item.ident,
- tcx.item_path_str(trait_def_id))
- .span_label(span, format!(
- "missing associated type `{}` value", assoc_item.ident))
- .emit();
+ struct_span_err!(tcx.sess, span, E0191, "the value of the associated type `{}` \
+ (from the trait `{}`) must be specified",
+ assoc_item.ident,
+ tcx.item_path_str(trait_def_id))
+ .span_label(span, format!("missing associated type `{}` value",
+ assoc_item.ident))
+ .emit();
}
// Dedup auto traits so that `dyn Trait + Send + Send` is the same as `dyn Trait + Send`.
iter::once(ty::ExistentialPredicate::Trait(*existential_principal.skip_binder()))
.chain(auto_traits.into_iter().map(ty::ExistentialPredicate::AutoTrait))
.chain(existential_projections
- .map(|x| ty::ExistentialPredicate::Projection(*x.skip_binder())))
+ .map(|x| ty::ExistentialPredicate::Projection(*x.skip_binder())))
.collect::<SmallVec<[_; 8]>>();
v.sort_by(|a, b| a.stable_cmp(tcx, b));
let existential_predicates = ty::Binder::bind(tcx.mk_existential_predicates(v.into_iter()));
-
// Explicitly specified region bound. Use that.
let region_bound = if !lifetime.is_elided() {
self.ast_region_to_region(lifetime, None)
struct_span_err!(self.tcx().sess, span, E0223, "ambiguous associated type")
.span_label(span, "ambiguous associated type")
.note(&format!("specify the type using the syntax `<{} as {}>::{}`",
- type_str, trait_str, name))
+ type_str, trait_str, name))
.emit();
}
// Check that there is exactly one way to find an associated type with the
// correct name.
- let suitable_bounds =
- traits::transitive_bounds(tcx, &bounds)
+ let suitable_bounds = traits::transitive_bounds(tcx, &bounds)
.filter(|b| self.trait_defines_associated_type_named(b.def_id(), assoc_name));
let param_node_id = tcx.hir.as_local_node_id(ty_param_def_id).unwrap();
// Checks that bounds contains exactly one element and reports appropriate
// errors otherwise.
fn one_bound_for_assoc_type<I>(&self,
- mut bounds: I,
- ty_param_name: &str,
- assoc_name: ast::Ident,
- span: Span)
+ mut bounds: I,
+ ty_param_name: &str,
+ assoc_name: ast::Ident,
+ span: Span)
-> Result<ty::PolyTraitRef<'tcx>, ErrorReported>
where I: Iterator<Item=ty::PolyTraitRef<'tcx>>
{
Some(bound) => bound,
None => {
struct_span_err!(self.tcx().sess, span, E0220,
- "associated type `{}` not found for `{}`",
- assoc_name,
- ty_param_name)
+ "associated type `{}` not found for `{}`",
+ assoc_name,
+ ty_param_name)
.span_label(span, format!("associated type `{}` not found", assoc_name))
.emit();
return Err(ErrorReported);
for bound in bounds {
let bound_span = self.tcx().associated_items(bound.def_id()).find(|item| {
item.kind == ty::AssociatedKind::Type &&
- self.tcx().hygienic_eq(assoc_name, item.ident, bound.def_id())
+ self.tcx().hygienic_eq(assoc_name, item.ident, bound.def_id())
})
.and_then(|item| self.tcx().hir.span_if_local(item.def_id));
if let Some(span) = bound_span {
err.span_label(span, format!("ambiguous `{}` from `{}`",
- assoc_name,
- bound));
+ assoc_name,
+ bound));
} else {
span_note!(&mut err, span,
"associated type `{}` could derive from `{}`",
}
};
- let candidates =
- traits::supertraits(tcx, ty::Binder::bind(trait_ref))
+ let candidates = traits::supertraits(tcx, ty::Binder::bind(trait_ref))
.filter(|r| self.trait_defines_associated_type_named(r.def_id(), assoc_name));
match self.one_bound_for_assoc_type(candidates, "Self", assoc_name, span) {
let (assoc_ident, def_scope) = tcx.adjust_ident(assoc_name, trait_did, ref_id);
let item = tcx.associated_items(trait_did).find(|i| {
Namespace::from(i.kind) == Namespace::Type &&
- i.ident.modern() == assoc_ident
+ i.ident.modern() == assoc_ident
})
.expect("missing associated type");
if err_for_lt { continue }
err_for_lt = true;
(struct_span_err!(self.tcx().sess, lt.span, E0110,
- "lifetime parameters are not allowed on \
- this type"),
+ "lifetime parameters are not allowed on this type"),
lt.span,
"lifetime")
}
if err_for_ty { continue }
err_for_ty = true;
(struct_span_err!(self.tcx().sess, ty.span, E0109,
- "type parameters are not allowed on this type"),
+ "type parameters are not allowed on this type"),
ty.span,
"type")
}
));
// Find any late-bound regions declared in return type that do
- // not appear in the arguments. These are not wellformed.
+ // not appear in the arguments. These are not well-formed.
//
// Example:
// for<'a> fn() -> &'a str <-- 'a is bad
let msg = if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) {
format!("unused import: `{}`", snippet)
} else {
- "unused import".to_string()
+ "unused import".to_owned()
};
self.tcx.lint_node(lint::builtin::UNUSED_IMPORTS, id, span, &msg);
}
}
fn visit_implementation_of_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: DefId) {
- match tcx.type_of(impl_did).sty {
- ty::Adt(..) => {}
- _ => {
- // Destructors only work on nominal types.
- if let Some(impl_node_id) = tcx.hir.as_local_node_id(impl_did) {
- match tcx.hir.find(impl_node_id) {
- Some(Node::Item(item)) => {
- let span = match item.node {
- ItemKind::Impl(.., ref ty, _) => ty.span,
- _ => item.span,
- };
- struct_span_err!(tcx.sess,
- span,
- E0120,
- "the Drop trait may only be implemented on \
- structures")
- .span_label(span, "implementing Drop requires a struct")
- .emit();
- }
- _ => {
- bug!("didn't find impl in ast map");
- }
- }
+ if let ty::Adt(..) = tcx.type_of(impl_did).sty {
+ /* do nothing */
+ } else {
+ // Destructors only work on nominal types.
+ if let Some(impl_node_id) = tcx.hir.as_local_node_id(impl_did) {
+ if let Some(Node::Item(item)) = tcx.hir.find(impl_node_id) {
+ let span = match item.node {
+ ItemKind::Impl(.., ref ty, _) => ty.span,
+ _ => item.span,
+ };
+ struct_span_err!(tcx.sess,
+ span,
+ E0120,
+ "the Drop trait may only be implemented on \
+ structures")
+ .span_label(span, "implementing Drop requires a struct")
+ .emit();
} else {
- bug!("found external impl of Drop trait on \
- something other than a struct");
+ bug!("didn't find impl in ast map");
}
+ } else {
+ bug!("found external impl of Drop trait on \
+ something other than a struct");
}
}
}
let impl_node_id = if let Some(n) = tcx.hir.as_local_node_id(impl_did) {
n
} else {
- debug!("visit_implementation_of_copy(): impl not in this \
- crate");
+ debug!("visit_implementation_of_copy(): impl not in this crate");
return;
};
};
let mut err = struct_span_err!(tcx.sess,
- span,
- E0204,
- "the trait `Copy` may not be implemented for this type");
+ span,
+ E0204,
+ "the trait `Copy` may not be implemented for this type");
for span in fields.iter().map(|f| tcx.def_span(f.did)) {
- err.span_label(span, "this field does not implement `Copy`");
+ err.span_label(span, "this field does not implement `Copy`");
}
err.emit()
}
debug!("compute_coerce_unsized_info(impl_did={:?})", impl_did);
let coerce_unsized_trait = gcx.lang_items().coerce_unsized_trait().unwrap();
- let unsize_trait = match gcx.lang_items().require(UnsizeTraitLangItem) {
- Ok(id) => id,
- Err(err) => {
- gcx.sess.fatal(&format!("`CoerceUnsized` implementation {}", err));
- }
- };
+ let unsize_trait = gcx.lang_items().require(UnsizeTraitLangItem).unwrap_or_else(|err| {
+ gcx.sess.fatal(&format!("`CoerceUnsized` implementation {}", err));
+ });
// this provider should only get invoked for local def-ids
let impl_node_id = gcx.hir.as_local_node_id(impl_did).unwrap_or_else(|| {
mk_ptr: &dyn Fn(Ty<'gcx>) -> Ty<'gcx>| {
if (mt_a.mutbl, mt_b.mutbl) == (hir::MutImmutable, hir::MutMutable) {
infcx.report_mismatched_types(&cause,
- mk_ptr(mt_b.ty),
- target,
- ty::error::TypeError::Mutability)
+ mk_ptr(mt_b.ty),
+ target,
+ ty::error::TypeError::Mutability)
.emit();
}
(mt_a.ty, mt_b.ty, unsize_trait, None)
}
(&ty::Adt(def_a, substs_a), &ty::Adt(def_b, substs_b)) if def_a.is_struct() &&
- def_b.is_struct() => {
+ def_b.is_struct() => {
if def_a != def_b {
let source_path = gcx.item_path_str(def_a.did);
let target_path = gcx.item_path_str(def_b.did);
E0116,
"cannot define inherent `impl` for a type outside of the crate \
where the type is defined")
- .span_label(item.span,
- "impl for type defined outside of crate.")
+ .span_label(item.span, "impl for type defined outside of crate.")
.note("define and implement a trait or new type instead")
.emit();
}
if let Some(trait_ref) = tcx.impl_trait_ref(impl_def_id) {
debug!("(checking implementation) adding impl for trait '{:?}', item '{}'",
- trait_ref,
- tcx.item_path_str(impl_def_id));
+ trait_ref,
+ tcx.item_path_str(impl_def_id));
// Skip impls where one of the self type is an error type.
// This occurs with e.g. resolve failures (#30589).
/// reports.
fn visit_item(&mut self, item: &hir::Item) {
let def_id = self.tcx.hir.local_def_id(item.id);
- match item.node {
- hir::ItemKind::Impl(.., Some(_), _, _) => {
- // "Trait" impl
- debug!("coherence2::orphan check: trait impl {}",
- self.tcx.hir.node_to_string(item.id));
- let trait_ref = self.tcx.impl_trait_ref(def_id).unwrap();
- let trait_def_id = trait_ref.def_id;
- let cm = self.tcx.sess.source_map();
- let sp = cm.def_span(item.span);
- match traits::orphan_check(self.tcx, def_id) {
- Ok(()) => {}
- Err(traits::OrphanCheckErr::NoLocalInputType) => {
- struct_span_err!(self.tcx.sess,
- sp,
- E0117,
- "only traits defined in the current crate can be \
- implemented for arbitrary types")
- .span_label(sp, "impl doesn't use types inside crate")
- .note("the impl does not reference any types defined in this crate")
- .note("define and implement a trait or new type instead")
- .emit();
- return;
- }
- Err(traits::OrphanCheckErr::UncoveredTy(param_ty)) => {
- struct_span_err!(self.tcx.sess,
- sp,
- E0210,
- "type parameter `{}` must be used as the type parameter \
- for some local type (e.g. `MyStruct<{}>`)",
- param_ty,
- param_ty)
- .span_label(sp,
- format!("type parameter `{}` must be used as the type \
- parameter for some local type", param_ty))
- .note("only traits defined in the current crate can be implemented \
- for a type parameter")
- .emit();
- return;
- }
+ // "Trait" impl
+ if let hir::ItemKind::Impl(.., Some(_), _, _) = item.node {
+ debug!("coherence2::orphan check: trait impl {}",
+ self.tcx.hir.node_to_string(item.id));
+ let trait_ref = self.tcx.impl_trait_ref(def_id).unwrap();
+ let trait_def_id = trait_ref.def_id;
+ let cm = self.tcx.sess.source_map();
+ let sp = cm.def_span(item.span);
+ match traits::orphan_check(self.tcx, def_id) {
+ Ok(()) => {}
+ Err(traits::OrphanCheckErr::NoLocalInputType) => {
+ struct_span_err!(self.tcx.sess,
+ sp,
+ E0117,
+ "only traits defined in the current crate can be \
+ implemented for arbitrary types")
+ .span_label(sp, "impl doesn't use types inside crate")
+ .note("the impl does not reference any types defined in this crate")
+ .note("define and implement a trait or new type instead")
+ .emit();
+ return;
+ }
+ Err(traits::OrphanCheckErr::UncoveredTy(param_ty)) => {
+ struct_span_err!(self.tcx.sess,
+ sp,
+ E0210,
+ "type parameter `{}` must be used as the type parameter \
+ for some local type (e.g. `MyStruct<{}>`)",
+ param_ty,
+ param_ty)
+ .span_label(sp,
+ format!("type parameter `{}` must be used as the type \
+ parameter for some local type", param_ty))
+ .note("only traits defined in the current crate can be implemented \
+ for a type parameter")
+ .emit();
+ return;
}
+ }
- // In addition to the above rules, we restrict impls of auto traits
- // so that they can only be implemented on nominal types, such as structs,
- // enums or foreign types. To see why this restriction exists, consider the
- // following example (#22978). Imagine that crate A defines an auto trait
- // `Foo` and a fn that operates on pairs of types:
- //
- // ```
- // // Crate A
- // auto trait Foo { }
- // fn two_foos<A:Foo,B:Foo>(..) {
- // one_foo::<(A,B)>(..)
- // }
- // fn one_foo<T:Foo>(..) { .. }
- // ```
- //
- // This type-checks fine; in particular the fn
- // `two_foos` is able to conclude that `(A,B):Foo`
- // because `A:Foo` and `B:Foo`.
- //
- // Now imagine that crate B comes along and does the following:
- //
- // ```
- // struct A { }
- // struct B { }
- // impl Foo for A { }
- // impl Foo for B { }
- // impl !Send for (A, B) { }
- // ```
- //
- // This final impl is legal according to the orpan
- // rules, but it invalidates the reasoning from
- // `two_foos` above.
- debug!("trait_ref={:?} trait_def_id={:?} trait_is_auto={}",
- trait_ref,
- trait_def_id,
- self.tcx.trait_is_auto(trait_def_id));
- if self.tcx.trait_is_auto(trait_def_id) &&
- !trait_def_id.is_local() {
- let self_ty = trait_ref.self_ty();
- let opt_self_def_id = match self_ty.sty {
- ty::Adt(self_def, _) => Some(self_def.did),
- ty::Foreign(did) => Some(did),
- _ => None,
- };
+ // In addition to the above rules, we restrict impls of auto traits
+ // so that they can only be implemented on nominal types, such as structs,
+ // enums or foreign types. To see why this restriction exists, consider the
+ // following example (#22978). Imagine that crate A defines an auto trait
+ // `Foo` and a fn that operates on pairs of types:
+ //
+ // ```
+ // // Crate A
+ // auto trait Foo { }
+ // fn two_foos<A:Foo,B:Foo>(..) {
+ // one_foo::<(A,B)>(..)
+ // }
+ // fn one_foo<T:Foo>(..) { .. }
+ // ```
+ //
+ // This type-checks fine; in particular the fn
+ // `two_foos` is able to conclude that `(A,B):Foo`
+ // because `A:Foo` and `B:Foo`.
+ //
+ // Now imagine that crate B comes along and does the following:
+ //
+ // ```
+ // struct A { }
+ // struct B { }
+ // impl Foo for A { }
+ // impl Foo for B { }
+ // impl !Send for (A, B) { }
+ // ```
+ //
+ // This final impl is legal according to the orpan
+ // rules, but it invalidates the reasoning from
+ // `two_foos` above.
+ debug!("trait_ref={:?} trait_def_id={:?} trait_is_auto={}",
+ trait_ref,
+ trait_def_id,
+ self.tcx.trait_is_auto(trait_def_id));
+ if self.tcx.trait_is_auto(trait_def_id) &&
+ !trait_def_id.is_local() {
+ let self_ty = trait_ref.self_ty();
+ let opt_self_def_id = match self_ty.sty {
+ ty::Adt(self_def, _) => Some(self_def.did),
+ ty::Foreign(did) => Some(did),
+ _ => None,
+ };
- let msg = match opt_self_def_id {
- // We only want to permit nominal types, but not *all* nominal types.
- // They must be local to the current crate, so that people
- // can't do `unsafe impl Send for Rc<SomethingLocal>` or
- // `impl !Send for Box<SomethingLocalAndSend>`.
- Some(self_def_id) => {
- if self_def_id.is_local() {
- None
- } else {
- Some((
- format!("cross-crate traits with a default impl, like `{}`, \
- can only be implemented for a struct/enum type \
- defined in the current crate",
- self.tcx.item_path_str(trait_def_id)),
- "can't implement cross-crate trait for type in another crate"
- ))
- }
- }
- _ => {
- Some((format!("cross-crate traits with a default impl, like `{}`, can \
- only be implemented for a struct/enum type, not `{}`",
- self.tcx.item_path_str(trait_def_id),
- self_ty),
- "can't implement cross-crate trait with a default impl for \
- non-struct/enum type"))
+ let msg = match opt_self_def_id {
+ // We only want to permit nominal types, but not *all* nominal types.
+ // They must be local to the current crate, so that people
+ // can't do `unsafe impl Send for Rc<SomethingLocal>` or
+ // `impl !Send for Box<SomethingLocalAndSend>`.
+ Some(self_def_id) => {
+ if self_def_id.is_local() {
+ None
+ } else {
+ Some((
+ format!("cross-crate traits with a default impl, like `{}`, \
+ can only be implemented for a struct/enum type \
+ defined in the current crate",
+ self.tcx.item_path_str(trait_def_id)),
+ "can't implement cross-crate trait for type in another crate"
+ ))
}
- };
-
- if let Some((msg, label)) = msg {
- struct_span_err!(self.tcx.sess, sp, E0321, "{}", msg)
- .span_label(sp, label)
- .emit();
- return;
}
+ _ => {
+ Some((format!("cross-crate traits with a default impl, like `{}`, can \
+ only be implemented for a struct/enum type, not `{}`",
+ self.tcx.item_path_str(trait_def_id),
+ self_ty),
+ "can't implement cross-crate trait with a default impl for \
+ non-struct/enum type"))
+ }
+ };
+
+ if let Some((msg, label)) = msg {
+ struct_span_err!(self.tcx.sess, sp, E0321, "{}", msg)
+ .span_label(sp, label)
+ .emit();
+ return;
}
}
- _ => {
- // Not an impl
- }
}
}
item: &'v hir::Item,
impl_generics: Option<&hir::Generics>,
unsafety: hir::Unsafety,
- polarity: hir::ImplPolarity) {
- match self.tcx.impl_trait_ref(self.tcx.hir.local_def_id(item.id)) {
- None => {}
-
- Some(trait_ref) => {
- let trait_def = self.tcx.trait_def(trait_ref.def_id);
- let unsafe_attr = impl_generics.and_then(|generics| {
- generics.params.iter().find(|p| p.pure_wrt_drop).map(|_| "may_dangle")
- });
- match (trait_def.unsafety, unsafe_attr, unsafety, polarity) {
- (Unsafety::Normal, None, Unsafety::Unsafe, hir::ImplPolarity::Positive) => {
- span_err!(self.tcx.sess,
- item.span,
- E0199,
- "implementing the trait `{}` is not unsafe",
- trait_ref);
- }
+ polarity: hir::ImplPolarity)
+ {
+ if let Some(trait_ref) = self.tcx.impl_trait_ref(self.tcx.hir.local_def_id(item.id)) {
+ let trait_def = self.tcx.trait_def(trait_ref.def_id);
+ let unsafe_attr = impl_generics.and_then(|generics| {
+ generics.params.iter().find(|p| p.pure_wrt_drop).map(|_| "may_dangle")
+ });
+ match (trait_def.unsafety, unsafe_attr, unsafety, polarity) {
+ (Unsafety::Normal, None, Unsafety::Unsafe, hir::ImplPolarity::Positive) => {
+ span_err!(self.tcx.sess,
+ item.span,
+ E0199,
+ "implementing the trait `{}` is not unsafe",
+ trait_ref);
+ }
- (Unsafety::Unsafe, _, Unsafety::Normal, hir::ImplPolarity::Positive) => {
- span_err!(self.tcx.sess,
- item.span,
- E0200,
- "the trait `{}` requires an `unsafe impl` declaration",
- trait_ref);
- }
+ (Unsafety::Unsafe, _, Unsafety::Normal, hir::ImplPolarity::Positive) => {
+ span_err!(self.tcx.sess,
+ item.span,
+ E0200,
+ "the trait `{}` requires an `unsafe impl` declaration",
+ trait_ref);
+ }
- (Unsafety::Normal, Some(attr_name), Unsafety::Normal,
- hir::ImplPolarity::Positive) =>
- {
- span_err!(self.tcx.sess,
- item.span,
- E0569,
- "requires an `unsafe impl` declaration due to `#[{}]` attribute",
- attr_name);
- }
+ (Unsafety::Normal, Some(attr_name), Unsafety::Normal,
+ hir::ImplPolarity::Positive) =>
+ {
+ span_err!(self.tcx.sess,
+ item.span,
+ E0569,
+ "requires an `unsafe impl` declaration due to `#[{}]` attribute",
+ attr_name);
+ }
- (_, _, Unsafety::Unsafe, hir::ImplPolarity::Negative) => {
- // Reported in AST validation
- self.tcx.sess.delay_span_bug(item.span, "unsafe negative impl");
- }
- (_, _, Unsafety::Normal, hir::ImplPolarity::Negative) |
- (Unsafety::Unsafe, _, Unsafety::Unsafe, hir::ImplPolarity::Positive) |
- (Unsafety::Normal, Some(_), Unsafety::Unsafe, hir::ImplPolarity::Positive) |
- (Unsafety::Normal, None, Unsafety::Normal, _) => {
- // OK
- }
+ (_, _, Unsafety::Unsafe, hir::ImplPolarity::Negative) => {
+ // Reported in AST validation
+ self.tcx.sess.delay_span_bug(item.span, "unsafe negative impl");
+ }
+ (_, _, Unsafety::Normal, hir::ImplPolarity::Negative) |
+ (Unsafety::Unsafe, _, Unsafety::Unsafe, hir::ImplPolarity::Positive) |
+ (Unsafety::Normal, Some(_), Unsafety::Unsafe, hir::ImplPolarity::Positive) |
+ (Unsafety::Normal, None, Unsafety::Normal, _) => {
+ // OK
}
}
}
impl<'cx, 'tcx, 'v> ItemLikeVisitor<'v> for UnsafetyChecker<'cx, 'tcx> {
fn visit_item(&mut self, item: &'v hir::Item) {
- match item.node {
- hir::ItemKind::Impl(unsafety, polarity, _, ref generics, ..) => {
- self.check_unsafety_coherence(item, Some(generics), unsafety, polarity);
- }
- _ => {}
+ if let hir::ItemKind::Impl(unsafety, polarity, _, ref generics, ..) = item.node {
+ self.check_unsafety_coherence(item, Some(generics), unsafety, polarity);
}
}
pub fn collect_item_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
let mut visitor = CollectItemTypesVisitor { tcx: tcx };
tcx.hir
- .krate()
- .visit_all_item_likes(&mut visitor.as_deep_visitor());
+ .krate()
+ .visit_all_item_likes(&mut visitor.as_deep_visitor());
}
pub fn provide(providers: &mut Providers) {
E0121,
"the type placeholder `_` is not allowed within types on item signatures"
).span_label(span, "not allowed in type signatures")
- .emit();
+ .emit();
+
self.tcx().types.err
}
).span_label(
variant.span,
format!("overflowed on value after {}", prev_discr.unwrap()),
- )
- .note(&format!(
- "explicitly set `{} = {}` if that is desired outcome",
- variant.node.name, wrapped_discr
- ))
- .emit();
+ ).note(&format!(
+ "explicitly set `{} = {}` if that is desired outcome",
+ variant.node.name, wrapped_discr
+ ))
+ .emit();
None
}.unwrap_or(wrapped_discr),
);
"field `{}` is already declared",
f.ident
).span_label(f.span, "field already declared")
- .span_label(prev_span, format!("`{}` first declared here", f.ident))
- .emit();
+ .span_label(prev_span, format!("`{}` first declared here", f.ident))
+ .emit();
} else {
seen_fields.insert(f.ident.modern(), f.span);
}
has_late_bound_regions: None,
};
for param in &generics.params {
- match param.kind {
- GenericParamKind::Lifetime { .. } => {
- let hir_id = tcx.hir.node_to_hir_id(param.id);
- if tcx.is_late_bound(hir_id) {
- return Some(param.span);
- }
+ if let GenericParamKind::Lifetime { .. } = param.kind {
+ let hir_id = tcx.hir.node_to_hir_id(param.id);
+ if tcx.is_late_bound(hir_id) {
+ return Some(param.span);
}
- _ => {}
}
}
visitor.visit_fn_decl(decl);
def_id: DefId,
found: Option<(Span, ty::Ty<'tcx>)>,
}
+
impl<'a, 'tcx> ConstraintLocator<'a, 'tcx> {
fn check(&mut self, def_id: DefId) {
trace!("checking {:?}", def_id);
}
}
}
+
impl<'a, 'tcx> intravisit::Visitor<'tcx> for ConstraintLocator<'a, 'tcx> {
fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'tcx> {
intravisit::NestedVisitorMap::All(&self.tcx.hir)
intravisit::walk_trait_item(self, it);
}
}
+
let mut locator = ConstraintLocator {
def_id,
tcx,
};
let node_id = tcx.hir.as_local_node_id(def_id).unwrap();
let parent = tcx.hir.get_parent(node_id);
+
trace!("parent_id: {:?}", parent);
+
if parent == ast::CRATE_NODE_ID {
intravisit::walk_crate(&mut locator, tcx.hir.krate());
} else {
),
}
}
+
match locator.found {
Some((_, ty)) => ty,
None => {
// Collect the predicates that were written inline by the user on each
// type parameter (e.g., `<T:Foo>`).
for param in &ast_generics.params {
- match param.kind {
- GenericParamKind::Type { .. } => {
- let name = param.name.ident().as_interned_str();
- let param_ty = ty::ParamTy::new(index, name).to_ty(tcx);
- index += 1;
-
- let sized = SizedByDefault::Yes;
- let bounds = compute_bounds(&icx, param_ty, ¶m.bounds, sized, param.span);
- predicates.extend(bounds.predicates(tcx, param_ty));
- }
- _ => {}
+ if let GenericParamKind::Type { .. } = param.kind {
+ let name = param.name.ident().as_interned_str();
+ let param_ty = ty::ParamTy::new(index, name).to_ty(tcx);
+ index += 1;
+
+ let sized = SizedByDefault::Yes;
+ let bounds = compute_bounds(&icx, param_ty, ¶m.bounds, sized, param.span);
+ predicates.extend(bounds.predicates(tcx, param_ty));
}
}
&mut projections,
);
- predicates.push((trait_ref.to_predicate(), poly_trait_ref.span));
- predicates.extend(projections.iter().map(|&(p, span)| {
- (p.to_predicate(), span)
- }));
+ predicates.extend(
+ iter::once((trait_ref.to_predicate(), poly_trait_ref.span)).chain(
+ projections.iter().map(|&(p, span)| (p.to_predicate(), span)
+ )));
}
&hir::GenericBound::Outlives(ref lifetime) => {
&hir::WherePredicate::RegionPredicate(ref region_pred) => {
let r1 = AstConv::ast_region_to_region(&icx, ®ion_pred.lifetime, None);
- for bound in ®ion_pred.bounds {
+ predicates.extend(region_pred.bounds.iter().map(|bound| {
let (r2, span) = match bound {
hir::GenericBound::Outlives(lt) => {
(AstConv::ast_region_to_region(&icx, lt, None), lt.span)
_ => bug!(),
};
let pred = ty::Binder::bind(ty::OutlivesPredicate(r1, r2));
- predicates.push((ty::Predicate::RegionOutlives(pred), span))
- }
+
+ (ty::Predicate::RegionOutlives(pred), span)
+ }))
}
&hir::WherePredicate::EqPredicate(..) => {
let trait_item = tcx.hir.trait_item(trait_item_ref.id);
let bounds = match trait_item.node {
hir::TraitItemKind::Type(ref bounds, _) => bounds,
- _ => {
- return vec![].into_iter();
- }
+ _ => return vec![].into_iter()
};
let assoc_ty =
) -> Bounds<'tcx> {
let mut region_bounds = vec![];
let mut trait_bounds = vec![];
+
for ast_bound in ast_bounds {
match *ast_bound {
hir::GenericBound::Trait(ref b, hir::TraitBoundModifier::None) => trait_bounds.push(b),
let check = |ast_ty: &hir::Ty, ty: Ty| {
if ty.is_simd() {
tcx.sess
- .struct_span_err(
- ast_ty.span,
- &format!(
- "use of SIMD type `{}` in FFI is highly experimental and \
- may result in invalid code",
- tcx.hir.node_to_pretty_string(ast_ty.id)
- ),
- )
- .help("add #![feature(simd_ffi)] to the crate attributes to enable")
- .emit();
+ .struct_span_err(
+ ast_ty.span,
+ &format!(
+ "use of SIMD type `{}` in FFI is highly experimental and \
+ may result in invalid code",
+ tcx.hir.node_to_pretty_string(ast_ty.id)
+ ),
+ )
+ .help("add #![feature(simd_ffi)] to the crate attributes to enable")
+ .emit();
}
};
for (input, ty) in decl.inputs.iter().zip(*fty.inputs().skip_binder()) {
};
// We allow comma separation to enable multiple features
- for feature in value.as_str().split(',') {
+ target_features.extend(value.as_str().split(',').filter_map(|feature| {
// Only allow whitelisted features per platform
let feature_gate = match whitelist.get(feature) {
Some(g) => g,
}
}
err.emit();
- continue;
+ return None;
}
};
feature_gate::GateIssue::Language,
&format!("the target feature `{}` is currently unstable", feature),
);
- continue;
+ return None;
}
- target_features.push(Symbol::intern(feature));
- }
+ Some(Symbol::intern(feature))
+ }));
}
}
tcx.sess.span_fatal(span, "invalid linkage specified")
} else {
tcx.sess
- .fatal(&format!("invalid linkage specified: {}", name))
+ .fatal(&format!("invalid linkage specified: {}", name))
}
}
}
E0558,
"`export_name` attribute has invalid format"
).span_label(attr.span, "did you mean #[export_name=\"*\"]?")
- .emit();
+ .emit();
}
} else if attr.check_name("target_feature") {
if tcx.fn_sig(id).unsafety() == Unsafety::Normal {
}
fn visit_region(&mut self, r: ty::Region<'tcx>) -> bool {
- match *r {
- ty::ReEarlyBound(data) => {
- self.parameters.push(Parameter::from(data));
- }
- _ => {}
+ if let ty::ReEarlyBound(data) = *r {
+ self.parameters.push(Parameter::from(data));
}
false
}
}
debug!("setup_constraining_predicates: predicates={:?} \
i={} impl_trait_ref={:?} input_parameters={:?}",
- predicates, i, impl_trait_ref, input_parameters);
+ predicates, i, impl_trait_ref, input_parameters);
}
}
impl<'a, 'tcx> ItemLikeVisitor<'tcx> for ImplWfCheck<'a, 'tcx> {
fn visit_item(&mut self, item: &'tcx hir::Item) {
- match item.node {
- hir::ItemKind::Impl(.., ref impl_item_refs) => {
- let impl_def_id = self.tcx.hir.local_def_id(item.id);
- enforce_impl_params_are_constrained(self.tcx,
- impl_def_id,
- impl_item_refs);
- enforce_impl_items_are_distinct(self.tcx, impl_item_refs);
- }
- _ => { }
+ if let hir::ItemKind::Impl(.., ref impl_item_refs) = item.node {
+ let impl_def_id = self.tcx.hir.local_def_id(item.id);
+ enforce_impl_params_are_constrained(self.tcx,
+ impl_def_id,
+ impl_item_refs);
+ enforce_impl_items_are_distinct(self.tcx, impl_item_refs);
}
}
let impl_item = tcx.hir.impl_item(impl_item_ref.id);
let seen_items = match impl_item.node {
hir::ImplItemKind::Type(_) => &mut seen_type_items,
- _ => &mut seen_value_items,
+ _ => &mut seen_value_items,
};
match seen_items.entry(impl_item.ident.modern()) {
Occupied(entry) => {
impl_item.ident);
err.span_label(*entry.get(),
format!("previous definition of `{}` here",
- impl_item.ident));
+ impl_item.ident));
err.span_label(impl_item.span, "duplicate definition");
err.emit();
}
#![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)]
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();
}
}
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);
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(
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)
}
let principal = astconv::AstConv::instantiate_poly_trait_ref_inner(
&item_cx, hir_trait, tcx.types.err, &mut projections, true
);
+
(principal, projections)
}
.iter()
.map(|out_pred| match out_pred {
ty::Predicate::RegionOutlives(p) => p.to_string(),
-
ty::Predicate::TypeOutlives(p) => p.to_string(),
-
err => bug!("unexpected predicate {:?}", err),
}).collect();
pred.sort();
pub fn test_inferred_outlives<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
tcx.hir
- .krate()
- .visit_all_item_likes(&mut OutlivesTest { tcx });
+ .krate()
+ .visit_all_item_likes(&mut OutlivesTest { tcx });
}
struct OutlivesTest<'a, 'tcx: 'a> {
// field: &'static T, // this would generate a ReStatic
// }
RegionKind::ReStatic => {
- if tcx
- .sess
- .features_untracked()
- .infer_static_outlives_requirements
- {
- true
- } else {
- false
- }
+ tcx.sess
+ .features_untracked()
+ .infer_static_outlives_requirements
}
// Late-bound regions can appear in `fn` types:
}
fn variances_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_def_id: DefId)
- -> Lrc<Vec<ty::Variance>> {
+ -> Lrc<Vec<ty::Variance>> {
let id = tcx.hir.as_local_node_id(item_def_id).expect("expected local def-id");
let unsupported = || {
// Variance not relevant.
#![feature(rustc_private)]
#![feature(box_patterns)]
#![feature(box_syntax)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(set_stdio)]
#![feature(slice_sort_by_cached_key)]
#![feature(test)]
#![feature(core_intrinsics)]
#![feature(specialization)]
#![feature(never_type)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![cfg_attr(test, feature(test))]
pub use self::serialize::{Decoder, Encoder, Decodable, Encodable};
// ABI
#[rustc_std_internal_symbol]
- #[cfg_attr(stage0, no_mangle)]
pub unsafe extern fn __rdl_alloc(size: usize, align: usize) -> *mut u8 {
let layout = Layout::from_size_align_unchecked(size, align);
System.alloc(layout)
}
#[rustc_std_internal_symbol]
- #[cfg_attr(stage0, no_mangle)]
pub unsafe extern fn __rdl_dealloc(ptr: *mut u8,
size: usize,
align: usize) {
}
#[rustc_std_internal_symbol]
- #[cfg_attr(stage0, no_mangle)]
pub unsafe extern fn __rdl_realloc(ptr: *mut u8,
old_size: usize,
align: usize,
}
#[rustc_std_internal_symbol]
- #[cfg_attr(stage0, no_mangle)]
pub unsafe extern fn __rdl_alloc_zeroed(size: usize, align: usize) -> *mut u8 {
let layout = Layout::from_size_align_unchecked(size, align);
System.alloc_zeroed(layout)
#![feature(cfg_target_vendor)]
#![feature(char_error_internals)]
#![feature(compiler_builtins_lib)]
-#![cfg_attr(stage0, feature(const_fn))]
-#![cfg_attr(not(stage0), feature(min_const_fn))]
+#![feature(min_const_fn)]
#![feature(const_int_ops)]
#![feature(const_ip)]
#![feature(core_intrinsics)]
#![feature(libc)]
#![feature(link_args)]
#![feature(linkage)]
-#![cfg_attr(stage0, feature(macro_vis_matcher))]
#![feature(needs_panic_runtime)]
#![feature(never_type)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(exhaustive_patterns)]
#![feature(on_unimplemented)]
#![feature(optin_builtin_traits)]
#![feature(rustc_attrs)]
#![feature(rustc_const_unstable)]
#![feature(std_internals)]
-#![feature(stdsimd)]
+#![cfg_attr(not(stage0), feature(stdsimd))]
#![feature(shrink_to)]
#![feature(slice_concat_ext)]
#![feature(slice_internals)]
#![feature(unboxed_closures)]
#![feature(untagged_unions)]
#![feature(unwind_attributes)]
-#![cfg_attr(stage0, feature(use_extern_macros))]
#![feature(doc_cfg)]
#![feature(doc_masked)]
#![feature(doc_spotlight)]
-#![cfg_attr(all(windows, stage0), feature(used))]
#![feature(doc_alias)]
#![feature(doc_keyword)]
#![feature(panic_info_message)]
-#![cfg_attr(stage0, feature(panic_implementation))]
#![feature(non_exhaustive)]
#![default_lib_allocator]
/// 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)
#[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.
#![feature(crate_visibility_modifier)]
#![feature(macro_at_most_once_rep)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(rustc_attrs)]
#![feature(rustc_diagnostic_macros)]
#![feature(slice_sort_by_cached_key)]
#![feature(proc_macro_internals)]
#![feature(decl_macro)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(str_escape)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![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;
#![cfg_attr(windows, feature(libc))]
// Handle rustfmt skips
#![feature(custom_attribute)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![allow(unused_attributes)]
use std::io::prelude::*;
#![feature(asm)]
#![feature(fnbox)]
#![cfg_attr(any(unix, target_os = "cloudabi"), feature(libc))]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(set_stdio)]
#![feature(panic_unwind)]
#![feature(staged_api)]
#![feature(cfg_target_vendor)]
#![feature(link_cfg)]
-#![cfg_attr(not(stage0), feature(nll))]
+#![feature(nll)]
#![feature(staged_api)]
#![feature(unwind_attributes)]
#![feature(static_nobundle)]
# source tarball for a stable release you'll likely see `1.x.0` for rustc and
# `0.x.0` for Cargo where they were released on `date`.
-date: 2018-09-11
+date: 2018-09-23
rustc: beta
cargo: beta
pub fn unsafe_borrow(_: &UnsafeInner) {
}
-// CHECK: @mutable_unsafe_borrow(i16* noalias dereferenceable(2) %arg0)
+// CHECK: @mutable_unsafe_borrow(i16* dereferenceable(2) %arg0)
// ... unless this is a mutable borrow, those never alias
#[no_mangle]
pub fn mutable_unsafe_borrow(_: &mut UnsafeInner) {
}
-// CHECK: @mutable_borrow(i32* noalias dereferenceable(4) %arg0)
+// CHECK: @mutable_borrow(i32* dereferenceable(4) %arg0)
// FIXME #25759 This should also have `nocapture`
#[no_mangle]
pub fn mutable_borrow(_: &mut i32) {
pub fn slice(_: &[u8]) {
}
-// CHECK: @mutable_slice([0 x i8]* noalias nonnull %arg0.0, [[USIZE]] %arg0.1)
+// CHECK: @mutable_slice([0 x i8]* nonnull %arg0.0, [[USIZE]] %arg0.1)
// FIXME #25759 This should also have `nocapture`
#[no_mangle]
pub fn mutable_slice(_: &mut [u8]) {
#![feature(plugin_registrar, rustc_private)]
#![feature(box_syntax)]
-#![cfg_attr(stage0, feature(macro_vis_matcher))]
#![feature(macro_at_most_once_rep)]
#[macro_use] extern crate rustc;
#![feature(plugin_registrar)]
#![feature(box_syntax, rustc_private)]
-#![cfg_attr(stage0, feature(macro_vis_matcher))]
#![feature(macro_at_most_once_rep)]
// Load rustc as a plugin to get macros
#![feature(plugin_registrar)]
#![feature(box_syntax, rustc_private)]
-#![cfg_attr(stage0, feature(macro_vis_matcher))]
#![feature(macro_at_most_once_rep)]
extern crate syntax;
#![feature(plugin_registrar, rustc_private)]
#![feature(box_syntax)]
-#![cfg_attr(stage0, feature(macro_vis_matcher))]
#![feature(macro_at_most_once_rep)]
#[macro_use] extern crate rustc;
// except according to those terms.
#![feature(box_syntax, plugin, plugin_registrar, rustc_private)]
-#![cfg_attr(stage0, feature(macro_vis_matcher))]
#![feature(macro_at_most_once_rep)]
#![crate_type = "dylib"]
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+//
+// compile-flags: -Ccodegen-units=1 -O
+
+fn linidx(row: usize, col: usize) -> usize {
+ row * 1 + col * 3
+}
+
+fn main() {
+ let mut mat = [1.0f32, 5.0, 9.0, 2.0, 6.0, 10.0, 3.0, 7.0, 11.0, 4.0, 8.0, 12.0];
+
+ for i in 0..2 {
+ for j in i+1..3 {
+ if mat[linidx(j, 3)] > mat[linidx(i, 3)] {
+ for k in 0..4 {
+ let (x, rest) = mat.split_at_mut(linidx(i, k) + 1);
+ let a = x.last_mut().unwrap();
+ let b = rest.get_mut(linidx(j, k) - linidx(i, k) - 1).unwrap();
+ ::std::mem::swap(a, b);
+ }
+ }
+ }
+ }
+ assert_eq!([9.0, 5.0, 1.0, 10.0, 6.0, 2.0, 11.0, 7.0, 3.0, 12.0, 8.0, 4.0], mat);
+}
// except according to those terms.
// run-pass
-#![cfg_attr(stage0, feature(macro_vis_matcher))]
//{{{ issue 40569 ==============================================================
// run-pass
#![allow(dead_code, unused_imports)]
-#![cfg_attr(stage0, feature(macro_vis_matcher))]
#![feature(crate_visibility_modifier)]
/**
#![feature(plugin_registrar)]
#![feature(box_syntax, rustc_private)]
-#![cfg_attr(stage0, feature(macro_vis_matcher))]
#![feature(macro_at_most_once_rep)]
// Load rustc as a plugin to get macros
#![feature(plugin_registrar)]
#![feature(box_syntax, rustc_private)]
-#![cfg_attr(stage0, feature(macro_vis_matcher))]
#![feature(macro_at_most_once_rep)]
extern crate syntax;
#![feature(plugin_registrar)]
#![feature(box_syntax, rustc_private)]
-#![cfg_attr(stage0, feature(macro_vis_matcher))]
#![feature(macro_at_most_once_rep)]
extern crate syntax;
--- /dev/null
+#![feature(nll)]
+
+// Regression test for #54593: the MIR type checker was going wrong
+// when a closure returns the `impl Copy` from its parent fn. It was
+// (incorrectly) replacing the `impl Copy` in its return type with the
+// hidden type (`()`) but that type resulted from a recursive call to
+// `foo` and hence is treated opaquely within the closure body. This
+// resulted in a failed subtype relationship.
+//
+// run-pass
+
+fn foo() -> impl Copy { || foo(); }
+fn bar() -> impl Copy { || bar(); }
+fn main() { }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![cfg_attr(stage0, feature(macro_vis_matcher))]
macro_rules! foo {
($($p:vis)*) => {} //~ ERROR repetition matches empty token tree
error: repetition matches empty token tree
- --> $DIR/issue-42755.rs:14:7
+ --> $DIR/issue-42755.rs:13:7
|
LL | ($($p:vis)*) => {} //~ ERROR repetition matches empty token tree
| ^^^^^^^^
// compile-pass
-#![cfg_attr(stage0, feature(macro_vis_matcher))]
#![allow(unused)]
#![warn(unreachable_pub)]
warning: unreachable `pub` item
- --> $DIR/unreachable_pub-pub_crate.rs:26:5
+ --> $DIR/unreachable_pub-pub_crate.rs:25:5
|
LL | pub use std::fmt;
| ---^^^^^^^^^^^^^^
| help: consider restricting its visibility: `pub(crate)`
|
note: lint level defined here
- --> $DIR/unreachable_pub-pub_crate.rs:22:9
+ --> $DIR/unreachable_pub-pub_crate.rs:21:9
|
LL | #![warn(unreachable_pub)]
| ^^^^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
- --> $DIR/unreachable_pub-pub_crate.rs:27:24
+ --> $DIR/unreachable_pub-pub_crate.rs:26:24
|
LL | pub use std::env::{Args}; // braced-use has different item spans than unbraced
| --- ^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
- --> $DIR/unreachable_pub-pub_crate.rs:29:5
+ --> $DIR/unreachable_pub-pub_crate.rs:28:5
|
LL | pub struct Hydrogen {
| ---^^^^^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` field
- --> $DIR/unreachable_pub-pub_crate.rs:31:9
+ --> $DIR/unreachable_pub-pub_crate.rs:30:9
|
LL | pub neutrons: usize,
| ---^^^^^^^^^^^^^^^^
| help: consider restricting its visibility: `pub(crate)`
warning: unreachable `pub` item
- --> $DIR/unreachable_pub-pub_crate.rs:37:9
+ --> $DIR/unreachable_pub-pub_crate.rs:36:9
|
LL | pub fn count_neutrons(&self) -> usize { self.neutrons }
| ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| help: consider restricting its visibility: `pub(crate)`
warning: unreachable `pub` item
- --> $DIR/unreachable_pub-pub_crate.rs:41:5
+ --> $DIR/unreachable_pub-pub_crate.rs:40:5
|
LL | pub enum Helium {}
| ---^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
- --> $DIR/unreachable_pub-pub_crate.rs:42:5
+ --> $DIR/unreachable_pub-pub_crate.rs:41:5
|
LL | pub union Lithium { c1: usize, c2: u8 }
| ---^^^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
- --> $DIR/unreachable_pub-pub_crate.rs:43:5
+ --> $DIR/unreachable_pub-pub_crate.rs:42:5
|
LL | pub fn beryllium() {}
| ---^^^^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
- --> $DIR/unreachable_pub-pub_crate.rs:44:5
+ --> $DIR/unreachable_pub-pub_crate.rs:43:5
|
LL | pub trait Boron {}
| ---^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
- --> $DIR/unreachable_pub-pub_crate.rs:45:5
+ --> $DIR/unreachable_pub-pub_crate.rs:44:5
|
LL | pub const CARBON: usize = 1;
| ---^^^^^^^^^^^^^^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
- --> $DIR/unreachable_pub-pub_crate.rs:46:5
+ --> $DIR/unreachable_pub-pub_crate.rs:45:5
|
LL | pub static NITROGEN: usize = 2;
| ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
- --> $DIR/unreachable_pub-pub_crate.rs:47:5
+ --> $DIR/unreachable_pub-pub_crate.rs:46:5
|
LL | pub type Oxygen = bool;
| ---^^^^^^^^^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
- --> $DIR/unreachable_pub-pub_crate.rs:50:47
+ --> $DIR/unreachable_pub-pub_crate.rs:49:47
|
LL | ($visibility: vis, $name: ident) => { $visibility struct $name {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
- --> $DIR/unreachable_pub-pub_crate.rs:55:9
+ --> $DIR/unreachable_pub-pub_crate.rs:54:9
|
LL | pub fn catalyze() -> bool;
| ---^^^^^^^^^^^^^^^^^^^^^^^
// compile-pass
#![feature(crate_visibility_modifier)]
-#![cfg_attr(stage0, feature(macro_vis_matcher))]
#![allow(unused)]
#![warn(unreachable_pub)]
warning: unreachable `pub` item
- --> $DIR/unreachable_pub.rs:21:5
+ --> $DIR/unreachable_pub.rs:20:5
|
LL | pub use std::fmt;
| ---^^^^^^^^^^^^^^
| help: consider restricting its visibility: `crate`
|
note: lint level defined here
- --> $DIR/unreachable_pub.rs:17:9
+ --> $DIR/unreachable_pub.rs:16:9
|
LL | #![warn(unreachable_pub)]
| ^^^^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
- --> $DIR/unreachable_pub.rs:22:24
+ --> $DIR/unreachable_pub.rs:21:24
|
LL | pub use std::env::{Args}; // braced-use has different item spans than unbraced
| --- ^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
- --> $DIR/unreachable_pub.rs:24:5
+ --> $DIR/unreachable_pub.rs:23:5
|
LL | pub struct Hydrogen {
| ---^^^^^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` field
- --> $DIR/unreachable_pub.rs:26:9
+ --> $DIR/unreachable_pub.rs:25:9
|
LL | pub neutrons: usize,
| ---^^^^^^^^^^^^^^^^
| help: consider restricting its visibility: `crate`
warning: unreachable `pub` item
- --> $DIR/unreachable_pub.rs:32:9
+ --> $DIR/unreachable_pub.rs:31:9
|
LL | pub fn count_neutrons(&self) -> usize { self.neutrons }
| ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| help: consider restricting its visibility: `crate`
warning: unreachable `pub` item
- --> $DIR/unreachable_pub.rs:36:5
+ --> $DIR/unreachable_pub.rs:35:5
|
LL | pub enum Helium {}
| ---^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
- --> $DIR/unreachable_pub.rs:37:5
+ --> $DIR/unreachable_pub.rs:36:5
|
LL | pub union Lithium { c1: usize, c2: u8 }
| ---^^^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
- --> $DIR/unreachable_pub.rs:38:5
+ --> $DIR/unreachable_pub.rs:37:5
|
LL | pub fn beryllium() {}
| ---^^^^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
- --> $DIR/unreachable_pub.rs:39:5
+ --> $DIR/unreachable_pub.rs:38:5
|
LL | pub trait Boron {}
| ---^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
- --> $DIR/unreachable_pub.rs:40:5
+ --> $DIR/unreachable_pub.rs:39:5
|
LL | pub const CARBON: usize = 1;
| ---^^^^^^^^^^^^^^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
- --> $DIR/unreachable_pub.rs:41:5
+ --> $DIR/unreachable_pub.rs:40:5
|
LL | pub static NITROGEN: usize = 2;
| ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
- --> $DIR/unreachable_pub.rs:42:5
+ --> $DIR/unreachable_pub.rs:41:5
|
LL | pub type Oxygen = bool;
| ---^^^^^^^^^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
- --> $DIR/unreachable_pub.rs:45:47
+ --> $DIR/unreachable_pub.rs:44:47
|
LL | ($visibility: vis, $name: ident) => { $visibility struct $name {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
- --> $DIR/unreachable_pub.rs:50:9
+ --> $DIR/unreachable_pub.rs:49:9
|
LL | pub fn catalyze() -> bool;
| ---^^^^^^^^^^^^^^^^^^^^^^^