update cfg(bootstrap)s

This commit is contained in:
Pietro Albini 2023-12-22 11:14:11 +01:00
parent bcdaa0d194
commit f9f5840eb4
No known key found for this signature in database
GPG key ID: 3E06ABE80BAAF19C
17 changed files with 24 additions and 452 deletions

View file

@ -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);
}

View file

@ -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)
}
@ -1416,18 +1416,8 @@ 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) }

View file

@ -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.

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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()
}

View file

@ -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) => {