diff options
Diffstat (limited to 'library/core/src')
| -rw-r--r-- | library/core/src/async_iter/async_iter.rs | 8 | ||||
| -rw-r--r-- | library/core/src/cmp.rs | 16 | ||||
| -rw-r--r-- | library/core/src/intrinsics/simd.rs | 2 | ||||
| -rw-r--r-- | library/core/src/ptr/const_ptr.rs | 12 | ||||
| -rw-r--r-- | library/core/src/ptr/mod.rs | 2 | ||||
| -rw-r--r-- | library/core/src/ptr/mut_ptr.rs | 12 | ||||
| -rw-r--r-- | library/core/src/ptr/non_null.rs | 2 | ||||
| -rw-r--r-- | library/core/src/tuple.rs | 140 |
8 files changed, 21 insertions, 173 deletions
diff --git a/library/core/src/async_iter/async_iter.rs b/library/core/src/async_iter/async_iter.rs index 8a45bd36f7a..a8197332fd0 100644 --- a/library/core/src/async_iter/async_iter.rs +++ b/library/core/src/async_iter/async_iter.rs @@ -13,7 +13,7 @@ use crate::task::{Context, Poll}; #[unstable(feature = "async_iterator", issue = "79024")] #[must_use = "async iterators do nothing unless polled"] #[doc(alias = "Stream")] -#[cfg_attr(not(bootstrap), lang = "async_iterator")] +#[lang = "async_iterator"] pub trait AsyncIterator { /// The type of items yielded by the async iterator. type Item; @@ -116,7 +116,7 @@ impl<T> Poll<Option<T>> { /// A helper function for internal desugaring -- produces `Ready(Some(t))`, /// which corresponds to the async iterator yielding a value. #[unstable(feature = "async_gen_internals", issue = "none")] - #[cfg_attr(not(bootstrap), lang = "AsyncGenReady")] + #[lang = "AsyncGenReady"] pub fn async_gen_ready(t: T) -> Self { Poll::Ready(Some(t)) } @@ -124,13 +124,13 @@ impl<T> Poll<Option<T>> { /// A helper constant for internal desugaring -- produces `Pending`, /// which corresponds to the async iterator pending on an `.await`. #[unstable(feature = "async_gen_internals", issue = "none")] - #[cfg_attr(not(bootstrap), lang = "AsyncGenPending")] + #[lang = "AsyncGenPending"] // FIXME(gen_blocks): This probably could be deduplicated. pub const PENDING: Self = Poll::Pending; /// A helper constant for internal desugaring -- produces `Ready(None)`, /// which corresponds to the async iterator finishing its iteration. #[unstable(feature = "async_gen_internals", issue = "none")] - #[cfg_attr(not(bootstrap), lang = "AsyncGenFinished")] + #[lang = "AsyncGenFinished"] pub const FINISHED: Self = Poll::Ready(None); } diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index d7c41ac5c06..bffd3b2af97 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -224,13 +224,13 @@ use self::Ordering::*; append_const_msg )] #[rustc_diagnostic_item = "PartialEq"] -#[cfg_attr(not(bootstrap), const_trait)] +#[const_trait] pub trait PartialEq<Rhs: ?Sized = Self> { /// This method tests for `self` and `other` values to be equal, and is used /// by `==`. #[must_use] #[stable(feature = "rust1", since = "1.0.0")] - #[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_partialeq_eq")] + #[rustc_diagnostic_item = "cmp_partialeq_eq"] fn eq(&self, other: &Rhs) -> bool; /// This method tests for `!=`. The default implementation is almost always @@ -238,7 +238,7 @@ pub trait PartialEq<Rhs: ?Sized = Self> { #[inline] #[must_use] #[stable(feature = "rust1", since = "1.0.0")] - #[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_partialeq_ne")] + #[rustc_diagnostic_item = "cmp_partialeq_ne"] fn ne(&self, other: &Rhs) -> bool { !self.eq(other) } @@ -1417,17 +1417,7 @@ mod impls { macro_rules! partial_eq_impl { ($($t:ty)*) => ($( #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(bootstrap)] - impl PartialEq for $t { - #[inline] - fn eq(&self, other: &$t) -> bool { (*self) == (*other) } - #[inline] - fn ne(&self, other: &$t) -> bool { (*self) != (*other) } - } - - #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_cmp", issue = "92391")] - #[cfg(not(bootstrap))] impl const PartialEq for $t { #[inline] fn eq(&self, other: &$t) -> bool { (*self) == (*other) } diff --git a/library/core/src/intrinsics/simd.rs b/library/core/src/intrinsics/simd.rs index 68c8a335b40..0fd27974dce 100644 --- a/library/core/src/intrinsics/simd.rs +++ b/library/core/src/intrinsics/simd.rs @@ -257,7 +257,6 @@ extern "platform-intrinsic" { /// type). /// /// `mask` must only contain `0` or `!0` values. - #[cfg(not(bootstrap))] pub fn simd_masked_load<V, U, T>(mask: V, ptr: U, val: T) -> T; /// Write to a vector of pointers. @@ -277,7 +276,6 @@ extern "platform-intrinsic" { /// type). /// /// `mask` must only contain `0` or `!0` values. - #[cfg(not(bootstrap))] pub fn simd_masked_store<V, U, T>(mask: V, ptr: U, val: T); /// Add two simd vectors elementwise, with saturation. diff --git a/library/core/src/ptr/const_ptr.rs b/library/core/src/ptr/const_ptr.rs index a444c30c756..12ff64de879 100644 --- a/library/core/src/ptr/const_ptr.rs +++ b/library/core/src/ptr/const_ptr.rs @@ -1772,7 +1772,7 @@ impl<T> *const [T] { #[stable(feature = "rust1", since = "1.0.0")] impl<T: ?Sized> PartialEq for *const T { #[inline] - #[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))] + #[allow(ambiguous_wide_pointer_comparisons)] fn eq(&self, other: &*const T) -> bool { *self == *other } @@ -1785,7 +1785,7 @@ impl<T: ?Sized> Eq for *const T {} #[stable(feature = "rust1", since = "1.0.0")] impl<T: ?Sized> Ord for *const T { #[inline] - #[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))] + #[allow(ambiguous_wide_pointer_comparisons)] fn cmp(&self, other: &*const T) -> Ordering { if self < other { Less @@ -1805,25 +1805,25 @@ impl<T: ?Sized> PartialOrd for *const T { } #[inline] - #[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))] + #[allow(ambiguous_wide_pointer_comparisons)] fn lt(&self, other: &*const T) -> bool { *self < *other } #[inline] - #[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))] + #[allow(ambiguous_wide_pointer_comparisons)] fn le(&self, other: &*const T) -> bool { *self <= *other } #[inline] - #[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))] + #[allow(ambiguous_wide_pointer_comparisons)] fn gt(&self, other: &*const T) -> bool { *self > *other } #[inline] - #[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))] + #[allow(ambiguous_wide_pointer_comparisons)] fn ge(&self, other: &*const T) -> bool { *self >= *other } diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index 390e0737197..a9078854125 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -1900,7 +1900,7 @@ pub(crate) const unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usiz #[inline(always)] #[must_use = "pointer comparison produces a value"] #[rustc_diagnostic_item = "ptr_eq"] -#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))] // it's actually clear here +#[allow(ambiguous_wide_pointer_comparisons)] // it's actually clear here pub fn eq<T: ?Sized>(a: *const T, b: *const T) -> bool { a == b } diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs index 9e7b8ec64ac..4f5fca4367d 100644 --- a/library/core/src/ptr/mut_ptr.rs +++ b/library/core/src/ptr/mut_ptr.rs @@ -2199,7 +2199,7 @@ impl<T> *mut [T] { #[stable(feature = "rust1", since = "1.0.0")] impl<T: ?Sized> PartialEq for *mut T { #[inline(always)] - #[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))] + #[allow(ambiguous_wide_pointer_comparisons)] fn eq(&self, other: &*mut T) -> bool { *self == *other } @@ -2211,7 +2211,7 @@ impl<T: ?Sized> Eq for *mut T {} #[stable(feature = "rust1", since = "1.0.0")] impl<T: ?Sized> Ord for *mut T { #[inline] - #[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))] + #[allow(ambiguous_wide_pointer_comparisons)] fn cmp(&self, other: &*mut T) -> Ordering { if self < other { Less @@ -2231,25 +2231,25 @@ impl<T: ?Sized> PartialOrd for *mut T { } #[inline(always)] - #[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))] + #[allow(ambiguous_wide_pointer_comparisons)] fn lt(&self, other: &*mut T) -> bool { *self < *other } #[inline(always)] - #[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))] + #[allow(ambiguous_wide_pointer_comparisons)] fn le(&self, other: &*mut T) -> bool { *self <= *other } #[inline(always)] - #[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))] + #[allow(ambiguous_wide_pointer_comparisons)] fn gt(&self, other: &*mut T) -> bool { *self > *other } #[inline(always)] - #[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))] + #[allow(ambiguous_wide_pointer_comparisons)] fn ge(&self, other: &*mut T) -> bool { *self >= *other } diff --git a/library/core/src/ptr/non_null.rs b/library/core/src/ptr/non_null.rs index 77961506e13..427a9f3f494 100644 --- a/library/core/src/ptr/non_null.rs +++ b/library/core/src/ptr/non_null.rs @@ -1791,7 +1791,7 @@ impl<T: ?Sized> Eq for NonNull<T> {} #[stable(feature = "nonnull", since = "1.25.0")] impl<T: ?Sized> PartialEq for NonNull<T> { #[inline] - #[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))] + #[allow(ambiguous_wide_pointer_comparisons)] fn eq(&self, other: &Self) -> bool { self.as_ptr() == other.as_ptr() } diff --git a/library/core/src/tuple.rs b/library/core/src/tuple.rs index 3689312e6ae..e1b77e34f21 100644 --- a/library/core/src/tuple.rs +++ b/library/core/src/tuple.rs @@ -8,146 +8,6 @@ use crate::marker::{StructuralEq, StructuralPartialEq}; // // Also provides implementations for tuples with lesser arity. For example, tuple_impls!(A B C) // will implement everything for (A, B, C), (A, B) and (A,). -#[cfg(bootstrap)] -macro_rules! tuple_impls { - // Stopping criteria (1-ary tuple) - ($T:ident) => { - tuple_impls!(@impl $T); - }; - // Running criteria (n-ary tuple, with n >= 2) - ($T:ident $( $U:ident )+) => { - tuple_impls!($( $U )+); - tuple_impls!(@impl $T $( $U )+); - }; - // "Private" internal implementation - (@impl $( $T:ident )+) => { - maybe_tuple_doc! { - $($T)+ @ - #[stable(feature = "rust1", since = "1.0.0")] - impl<$($T: PartialEq),+> PartialEq for ($($T,)+) - where - last_type!($($T,)+): ?Sized - { - #[inline] - fn eq(&self, other: &($($T,)+)) -> bool { - $( ${ignore(T)} self.${index()} == other.${index()} )&&+ - } - #[inline] - fn ne(&self, other: &($($T,)+)) -> bool { - $( ${ignore(T)} self.${index()} != other.${index()} )||+ - } - } - } - - maybe_tuple_doc! { - $($T)+ @ - #[stable(feature = "rust1", since = "1.0.0")] - impl<$($T: Eq),+> Eq for ($($T,)+) - where - last_type!($($T,)+): ?Sized - {} - } - - maybe_tuple_doc! { - $($T)+ @ - #[unstable(feature = "structural_match", issue = "31434")] - impl<$($T: ConstParamTy),+> ConstParamTy for ($($T,)+) {} - } - - maybe_tuple_doc! { - $($T)+ @ - #[unstable(feature = "structural_match", issue = "31434")] - impl<$($T),+> StructuralPartialEq for ($($T,)+) {} - } - - maybe_tuple_doc! { - $($T)+ @ - #[unstable(feature = "structural_match", issue = "31434")] - impl<$($T),+> StructuralEq for ($($T,)+) {} - } - - maybe_tuple_doc! { - $($T)+ @ - #[stable(feature = "rust1", since = "1.0.0")] - impl<$($T: PartialOrd),+> PartialOrd for ($($T,)+) - where - last_type!($($T,)+): ?Sized - { - #[inline] - fn partial_cmp(&self, other: &($($T,)+)) -> Option<Ordering> { - lexical_partial_cmp!($( ${ignore(T)} self.${index()}, other.${index()} ),+) - } - #[inline] - fn lt(&self, other: &($($T,)+)) -> bool { - lexical_ord!(lt, Less, $( ${ignore(T)} self.${index()}, other.${index()} ),+) - } - #[inline] - fn le(&self, other: &($($T,)+)) -> bool { - lexical_ord!(le, Less, $( ${ignore(T)} self.${index()}, other.${index()} ),+) - } - #[inline] - fn ge(&self, other: &($($T,)+)) -> bool { - lexical_ord!(ge, Greater, $( ${ignore(T)} self.${index()}, other.${index()} ),+) - } - #[inline] - fn gt(&self, other: &($($T,)+)) -> bool { - lexical_ord!(gt, Greater, $( ${ignore(T)} self.${index()}, other.${index()} ),+) - } - } - } - - maybe_tuple_doc! { - $($T)+ @ - #[stable(feature = "rust1", since = "1.0.0")] - impl<$($T: Ord),+> Ord for ($($T,)+) - where - last_type!($($T,)+): ?Sized - { - #[inline] - fn cmp(&self, other: &($($T,)+)) -> Ordering { - lexical_cmp!($( ${ignore(T)} self.${index()}, other.${index()} ),+) - } - } - } - - maybe_tuple_doc! { - $($T)+ @ - #[stable(feature = "rust1", since = "1.0.0")] - impl<$($T: Default),+> Default for ($($T,)+) { - #[inline] - fn default() -> ($($T,)+) { - ($($T::default(),)+) - } - } - } - - #[stable(feature = "array_tuple_conv", since = "1.71.0")] - impl<T> From<[T; ${count(T)}]> for ($(${ignore(T)} T,)+) { - #[inline] - #[allow(non_snake_case)] - fn from(array: [T; ${count(T)}]) -> Self { - let [$($T,)+] = array; - ($($T,)+) - } - } - - #[stable(feature = "array_tuple_conv", since = "1.71.0")] - impl<T> From<($(${ignore(T)} T,)+)> for [T; ${count(T)}] { - #[inline] - #[allow(non_snake_case)] - fn from(tuple: ($(${ignore(T)} T,)+)) -> Self { - let ($($T,)+) = tuple; - [$($T,)+] - } - } - } -} - -// Recursive macro for implementing n-ary tuple functions and operations -// -// Also provides implementations for tuples with lesser arity. For example, tuple_impls!(A B C) -// will implement everything for (A, B, C), (A, B) and (A,). -#[cfg(not(bootstrap))] macro_rules! tuple_impls { // Stopping criteria (1-ary tuple) ($T:ident) => { |
