trivial cfg(bootstrap) changes
This commit is contained in:
parent
e96538aeeb
commit
181d28bb61
@ -1,5 +1,4 @@
|
||||
#![feature(nll)]
|
||||
#![cfg_attr(bootstrap, feature(native_link_modifiers))]
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
|
||||
// NOTE: This crate only exists to allow linking on mingw targets.
|
||||
|
@ -58,7 +58,7 @@ pub struct Allocation<Tag = AllocId, Extra = ()> {
|
||||
/// means that both the inner type (`Allocation`) and the outer type
|
||||
/// (`ConstAllocation`) are used quite a bit.
|
||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable)]
|
||||
#[cfg_attr(not(bootstrap), rustc_pass_by_value)]
|
||||
#[rustc_pass_by_value]
|
||||
pub struct ConstAllocation<'tcx, Tag = AllocId, Extra = ()>(
|
||||
pub Interned<'tcx, Allocation<Tag, Extra>>,
|
||||
);
|
||||
|
@ -161,7 +161,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for AdtDefData {
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, Ord, PartialOrd, HashStable)]
|
||||
#[cfg_attr(not(bootstrap), rustc_pass_by_value)]
|
||||
#[rustc_pass_by_value]
|
||||
pub struct AdtDef<'tcx>(pub Interned<'tcx, AdtDefData>);
|
||||
|
||||
impl<'tcx> AdtDef<'tcx> {
|
||||
|
@ -1262,7 +1262,7 @@ impl<'a> fmt::Debug for LayoutS<'a> {
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable_Generic)]
|
||||
#[cfg_attr(not(bootstrap), rustc_pass_by_value)]
|
||||
#[rustc_pass_by_value]
|
||||
pub struct Layout<'a>(pub Interned<'a, LayoutS<'a>>);
|
||||
|
||||
impl<'a> fmt::Debug for Layout<'a> {
|
||||
|
@ -326,16 +326,12 @@ unsafe fn exchange_malloc(size: usize, align: usize) -> *mut u8 {
|
||||
#[cfg_attr(not(test), lang = "box_free")]
|
||||
#[inline]
|
||||
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
// This signature has to be the same as `Box`, otherwise an ICE will happen.
|
||||
// When an additional parameter to `Box` is added (like `A: Allocator`), this has to be added here as
|
||||
// well.
|
||||
// For example if `Box` is changed to `struct Box<T: ?Sized, A: Allocator>(Unique<T>, A)`,
|
||||
// this function has to be changed to `fn box_free<T: ?Sized, A: Allocator>(Unique<T>, A)` as well.
|
||||
pub(crate) const unsafe fn box_free<
|
||||
T: ?Sized,
|
||||
A: ~const Allocator + ~const Drop + ~const Destruct,
|
||||
>(
|
||||
pub(crate) const unsafe fn box_free<T: ?Sized, A: ~const Allocator + ~const Destruct>(
|
||||
ptr: Unique<T>,
|
||||
alloc: A,
|
||||
) {
|
||||
|
@ -331,7 +331,6 @@ impl<B: ?Sized + ToOwned> Cow<'_, B> {
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_deref", issue = "88955")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
impl<B: ?Sized + ToOwned> const Deref for Cow<'_, B>
|
||||
where
|
||||
B::Owned: ~const Borrow<B>,
|
||||
|
@ -349,10 +349,9 @@ impl<T, A: Allocator> Box<T, A> {
|
||||
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
|
||||
#[must_use]
|
||||
#[inline]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn new_in(x: T, alloc: A) -> Self
|
||||
where
|
||||
A: ~const Allocator + ~const Drop + ~const Destruct,
|
||||
A: ~const Allocator + ~const Destruct,
|
||||
{
|
||||
let mut boxed = Self::new_uninit_in(alloc);
|
||||
unsafe {
|
||||
@ -379,11 +378,10 @@ impl<T, A: Allocator> Box<T, A> {
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
|
||||
#[inline]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn try_new_in(x: T, alloc: A) -> Result<Self, AllocError>
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
A: ~const Allocator + ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
A: ~const Allocator + ~const Destruct,
|
||||
{
|
||||
let mut boxed = Self::try_new_uninit_in(alloc)?;
|
||||
unsafe {
|
||||
@ -417,10 +415,9 @@ impl<T, A: Allocator> Box<T, A> {
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[must_use]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn new_uninit_in(alloc: A) -> Box<mem::MaybeUninit<T>, A>
|
||||
where
|
||||
A: ~const Allocator + ~const Drop + ~const Destruct,
|
||||
A: ~const Allocator + ~const Destruct,
|
||||
{
|
||||
let layout = Layout::new::<mem::MaybeUninit<T>>();
|
||||
// NOTE: Prefer match over unwrap_or_else since closure sometimes not inlineable.
|
||||
@ -456,10 +453,9 @@ impl<T, A: Allocator> Box<T, A> {
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn try_new_uninit_in(alloc: A) -> Result<Box<mem::MaybeUninit<T>, A>, AllocError>
|
||||
where
|
||||
A: ~const Allocator + ~const Drop + ~const Destruct,
|
||||
A: ~const Allocator + ~const Destruct,
|
||||
{
|
||||
let layout = Layout::new::<mem::MaybeUninit<T>>();
|
||||
let ptr = alloc.allocate(layout)?.cast();
|
||||
@ -491,10 +487,9 @@ impl<T, A: Allocator> Box<T, A> {
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[must_use]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn new_zeroed_in(alloc: A) -> Box<mem::MaybeUninit<T>, A>
|
||||
where
|
||||
A: ~const Allocator + ~const Drop + ~const Destruct,
|
||||
A: ~const Allocator + ~const Destruct,
|
||||
{
|
||||
let layout = Layout::new::<mem::MaybeUninit<T>>();
|
||||
// NOTE: Prefer match over unwrap_or_else since closure sometimes not inlineable.
|
||||
@ -530,10 +525,9 @@ impl<T, A: Allocator> Box<T, A> {
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn try_new_zeroed_in(alloc: A) -> Result<Box<mem::MaybeUninit<T>, A>, AllocError>
|
||||
where
|
||||
A: ~const Allocator + ~const Drop + ~const Destruct,
|
||||
A: ~const Allocator + ~const Destruct,
|
||||
{
|
||||
let layout = Layout::new::<mem::MaybeUninit<T>>();
|
||||
let ptr = alloc.allocate_zeroed(layout)?.cast();
|
||||
@ -547,10 +541,9 @@ impl<T, A: Allocator> Box<T, A> {
|
||||
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
|
||||
#[must_use]
|
||||
#[inline(always)]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn pin_in(x: T, alloc: A) -> Pin<Self>
|
||||
where
|
||||
A: 'static + ~const Allocator + ~const Drop + ~const Destruct,
|
||||
A: 'static + ~const Allocator + ~const Destruct,
|
||||
{
|
||||
Self::into_pin(Self::new_in(x, alloc))
|
||||
}
|
||||
@ -579,10 +572,9 @@ impl<T, A: Allocator> Box<T, A> {
|
||||
#[unstable(feature = "box_into_inner", issue = "80437")]
|
||||
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
|
||||
#[inline]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn into_inner(boxed: Self) -> T
|
||||
where
|
||||
Self: ~const Drop + ~const Destruct,
|
||||
Self: ~const Destruct,
|
||||
{
|
||||
*boxed
|
||||
}
|
||||
|
@ -141,7 +141,6 @@
|
||||
#![feature(box_syntax)]
|
||||
#![feature(cfg_sanitize)]
|
||||
#![feature(const_deref)]
|
||||
#![cfg_attr(bootstrap, feature(const_fn_trait_bound))]
|
||||
#![feature(const_mut_refs)]
|
||||
#![feature(const_ptr_write)]
|
||||
#![feature(const_precise_live_drops)]
|
||||
|
@ -237,7 +237,6 @@ mod hack {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "slice_alloc")]
|
||||
#[cfg(not(test))]
|
||||
impl<T> [T] {
|
||||
/// Sorts the slice.
|
||||
@ -267,7 +266,7 @@ impl<T> [T] {
|
||||
/// assert!(v == [-5, -3, 1, 2, 4]);
|
||||
/// ```
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn sort(&mut self)
|
||||
@ -323,7 +322,7 @@ impl<T> [T] {
|
||||
/// assert!(v == [5, 4, 3, 2, 1]);
|
||||
/// ```
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn sort_by<F>(&mut self, mut compare: F)
|
||||
@ -365,7 +364,7 @@ impl<T> [T] {
|
||||
/// assert!(v == [1, 2, -3, 4, -5]);
|
||||
/// ```
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[stable(feature = "slice_sort_by_key", since = "1.7.0")]
|
||||
#[inline]
|
||||
pub fn sort_by_key<K, F>(&mut self, mut f: F)
|
||||
@ -412,7 +411,7 @@ impl<T> [T] {
|
||||
///
|
||||
/// [pdqsort]: https://github.com/orlp/pdqsort
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[stable(feature = "slice_sort_by_cached_key", since = "1.34.0")]
|
||||
#[inline]
|
||||
pub fn sort_by_cached_key<K, F>(&mut self, f: F)
|
||||
@ -471,7 +470,7 @@ impl<T> [T] {
|
||||
/// // Here, `s` and `x` can be modified independently.
|
||||
/// ```
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[rustc_conversion_suggestion]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -496,7 +495,7 @@ impl<T> [T] {
|
||||
/// // Here, `s` and `x` can be modified independently.
|
||||
/// ```
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[inline]
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
pub fn to_vec_in<A: Allocator>(&self, alloc: A) -> Vec<T, A>
|
||||
@ -521,7 +520,7 @@ impl<T> [T] {
|
||||
///
|
||||
/// assert_eq!(x, vec![10, 40, 30]);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn into_vec<A: Allocator>(self: Box<Self, A>) -> Vec<T, A> {
|
||||
@ -549,7 +548,7 @@ impl<T> [T] {
|
||||
/// // this will panic at runtime
|
||||
/// b"0123456789abcdef".repeat(usize::MAX);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[stable(feature = "repeat_generic_slice", since = "1.40.0")]
|
||||
pub fn repeat(&self, n: usize) -> Vec<T>
|
||||
@ -618,7 +617,7 @@ impl<T> [T] {
|
||||
/// assert_eq!(["hello", "world"].concat(), "helloworld");
|
||||
/// assert_eq!([[1, 2], [3, 4]].concat(), [1, 2, 3, 4]);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn concat<Item: ?Sized>(&self) -> <Self as Concat<Item>>::Output
|
||||
where
|
||||
@ -637,7 +636,7 @@ impl<T> [T] {
|
||||
/// assert_eq!([[1, 2], [3, 4]].join(&0), [1, 2, 0, 3, 4]);
|
||||
/// assert_eq!([[1, 2], [3, 4]].join(&[0, 0][..]), [1, 2, 0, 0, 3, 4]);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[stable(feature = "rename_connect_to_join", since = "1.3.0")]
|
||||
pub fn join<Separator>(&self, sep: Separator) -> <Self as Join<Separator>>::Output
|
||||
where
|
||||
@ -656,7 +655,7 @@ impl<T> [T] {
|
||||
/// assert_eq!(["hello", "world"].connect(" "), "hello world");
|
||||
/// assert_eq!([[1, 2], [3, 4]].connect(&0), [1, 2, 0, 3, 4]);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_deprecated(since = "1.3.0", reason = "renamed to join")]
|
||||
pub fn connect<Separator>(&self, sep: Separator) -> <Self as Join<Separator>>::Output
|
||||
@ -667,7 +666,6 @@ impl<T> [T] {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "slice_u8_alloc")]
|
||||
#[cfg(not(test))]
|
||||
impl [u8] {
|
||||
/// Returns a vector containing a copy of this slice where each byte
|
||||
@ -680,7 +678,7 @@ impl [u8] {
|
||||
///
|
||||
/// [`make_ascii_uppercase`]: slice::make_ascii_uppercase
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "this returns the uppercase bytes as a new Vec, \
|
||||
without modifying the original"]
|
||||
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
|
||||
@ -701,7 +699,7 @@ impl [u8] {
|
||||
///
|
||||
/// [`make_ascii_lowercase`]: slice::make_ascii_lowercase
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "this returns the lowercase bytes as a new Vec, \
|
||||
without modifying the original"]
|
||||
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
|
||||
|
@ -235,7 +235,6 @@ impl ToOwned for str {
|
||||
}
|
||||
|
||||
/// Methods for string slices.
|
||||
#[cfg_attr(bootstrap, lang = "str_alloc")]
|
||||
#[cfg(not(test))]
|
||||
impl str {
|
||||
/// Converts a `Box<str>` into a `Box<[u8]>` without copying or allocating.
|
||||
@ -250,7 +249,7 @@ impl str {
|
||||
/// let boxed_bytes = boxed_str.into_boxed_bytes();
|
||||
/// assert_eq!(*boxed_bytes, *s.as_bytes());
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[stable(feature = "str_box_extras", since = "1.20.0")]
|
||||
#[must_use = "`self` will be dropped if the result is not used"]
|
||||
#[inline]
|
||||
@ -281,7 +280,7 @@ impl str {
|
||||
/// assert_eq!(s, s.replace("cookie monster", "little lamb"));
|
||||
/// ```
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "this returns the replaced string as a new allocation, \
|
||||
without modifying the original"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
@ -322,7 +321,7 @@ impl str {
|
||||
/// assert_eq!(s, s.replacen("cookie monster", "little lamb", 10));
|
||||
/// ```
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "this returns the replaced string as a new allocation, \
|
||||
without modifying the original"]
|
||||
#[stable(feature = "str_replacen", since = "1.16.0")]
|
||||
@ -379,7 +378,7 @@ impl str {
|
||||
/// assert_eq!(new_year, new_year.to_lowercase());
|
||||
/// ```
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "this returns the lowercase string as a new String, \
|
||||
without modifying the original"]
|
||||
#[stable(feature = "unicode_case_mapping", since = "1.2.0")]
|
||||
@ -462,7 +461,7 @@ impl str {
|
||||
/// assert_eq!("TSCHÜSS", s.to_uppercase());
|
||||
/// ```
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "this returns the uppercase string as a new String, \
|
||||
without modifying the original"]
|
||||
#[stable(feature = "unicode_case_mapping", since = "1.2.0")]
|
||||
@ -498,7 +497,7 @@ impl str {
|
||||
/// assert_eq!(boxed_str.into_string(), string);
|
||||
/// ```
|
||||
#[stable(feature = "box_str", since = "1.4.0")]
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "`self` will be dropped if the result is not used"]
|
||||
#[inline]
|
||||
pub fn into_string(self: Box<str>) -> String {
|
||||
@ -527,7 +526,7 @@ impl str {
|
||||
/// let huge = "0123456789abcdef".repeat(usize::MAX);
|
||||
/// ```
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use]
|
||||
#[stable(feature = "repeat_str", since = "1.16.0")]
|
||||
pub fn repeat(&self, n: usize) -> String {
|
||||
@ -556,7 +555,7 @@ impl str {
|
||||
/// [`make_ascii_uppercase`]: str::make_ascii_uppercase
|
||||
/// [`to_uppercase`]: #method.to_uppercase
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "to uppercase the value in-place, use `make_ascii_uppercase()`"]
|
||||
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
|
||||
#[inline]
|
||||
@ -589,7 +588,7 @@ impl str {
|
||||
/// [`make_ascii_lowercase`]: str::make_ascii_lowercase
|
||||
/// [`to_lowercase`]: #method.to_lowercase
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "to lowercase the value in-place, use `make_ascii_lowercase()`"]
|
||||
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
|
||||
#[inline]
|
||||
|
@ -395,7 +395,6 @@ macro_rules! array_impl_default {
|
||||
|
||||
array_impl_default! {32, T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T}
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "array")]
|
||||
impl<T, const N: usize> [T; N] {
|
||||
/// Returns an array of the same size as `self`, with function `f` applied to each element
|
||||
/// in order.
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
use crate::marker::Destruct;
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "bool")]
|
||||
impl bool {
|
||||
/// Returns `Some(t)` if the `bool` is [`true`](../std/keyword.true.html),
|
||||
/// or `None` otherwise.
|
||||
@ -18,10 +17,9 @@ impl bool {
|
||||
#[unstable(feature = "bool_to_option", issue = "80967")]
|
||||
#[rustc_const_unstable(feature = "const_bool_to_option", issue = "91917")]
|
||||
#[inline]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn then_some<T>(self, t: T) -> Option<T>
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
{
|
||||
if self { Some(t) } else { None }
|
||||
}
|
||||
@ -38,11 +36,10 @@ impl bool {
|
||||
#[stable(feature = "lazy_bool_to_option", since = "1.50.0")]
|
||||
#[rustc_const_unstable(feature = "const_bool_to_option", issue = "91917")]
|
||||
#[inline]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn then<T, F>(self, f: F) -> Option<T>
|
||||
where
|
||||
F: ~const FnOnce() -> T,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
{
|
||||
if self { Some(f()) } else { None }
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ use crate::unicode::{self, conversions};
|
||||
|
||||
use super::*;
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "char")]
|
||||
impl char {
|
||||
/// The highest valid code point a `char` can have, `'\u{10FFFF}'`.
|
||||
///
|
||||
|
@ -130,10 +130,9 @@ pub trait Clone: Sized {
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[default_method_body_is_const]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
fn clone_from(&mut self, source: &Self)
|
||||
where
|
||||
Self: ~const Drop + ~const Destruct,
|
||||
Self: ~const Destruct,
|
||||
{
|
||||
*self = source.clone()
|
||||
}
|
||||
|
@ -2348,7 +2348,6 @@ pub const unsafe fn write_bytes<T>(dst: *mut T, val: u8, count: usize) {
|
||||
#[rustc_const_unstable(feature = "const_eval_select", issue = "none")]
|
||||
#[lang = "const_eval_select"]
|
||||
#[rustc_do_not_const_check]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const unsafe fn const_eval_select<ARG, F, G, RET>(
|
||||
arg: ARG,
|
||||
_called_in_const: F,
|
||||
@ -2356,7 +2355,7 @@ pub const unsafe fn const_eval_select<ARG, F, G, RET>(
|
||||
) -> RET
|
||||
where
|
||||
F: ~const FnOnce<ARG, Output = RET>,
|
||||
G: FnOnce<ARG, Output = RET> + ~const Drop + ~const Destruct,
|
||||
G: FnOnce<ARG, Output = RET> + ~const Destruct,
|
||||
{
|
||||
called_at_rt.call_once(arg)
|
||||
}
|
||||
@ -2368,7 +2367,6 @@ where
|
||||
)]
|
||||
#[rustc_const_unstable(feature = "const_eval_select", issue = "none")]
|
||||
#[lang = "const_eval_select_ct"]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const unsafe fn const_eval_select_ct<ARG, F, G, RET>(
|
||||
arg: ARG,
|
||||
called_in_const: F,
|
||||
@ -2376,7 +2374,7 @@ pub const unsafe fn const_eval_select_ct<ARG, F, G, RET>(
|
||||
) -> RET
|
||||
where
|
||||
F: ~const FnOnce<ARG, Output = RET>,
|
||||
G: FnOnce<ARG, Output = RET> + ~const Drop + ~const Destruct,
|
||||
G: FnOnce<ARG, Output = RET> + ~const Destruct,
|
||||
{
|
||||
called_in_const.call_once(arg)
|
||||
}
|
||||
|
@ -84,7 +84,7 @@
|
||||
target_has_atomic_load_store = "ptr",
|
||||
))]
|
||||
#![no_core]
|
||||
#![cfg_attr(not(bootstrap), rustc_coherence_is_core)]
|
||||
#![rustc_coherence_is_core]
|
||||
//
|
||||
// Lints:
|
||||
#![deny(rust_2021_incompatible_or_patterns)]
|
||||
@ -163,15 +163,12 @@
|
||||
#![feature(cfg_target_has_atomic)]
|
||||
#![feature(cfg_target_has_atomic_equal_alignment)]
|
||||
#![feature(const_fn_floating_point_arithmetic)]
|
||||
#![cfg_attr(bootstrap, feature(const_fn_fn_ptr_basics))]
|
||||
#![cfg_attr(bootstrap, feature(const_fn_trait_bound))]
|
||||
#![cfg_attr(bootstrap, feature(const_impl_trait))]
|
||||
#![feature(const_mut_refs)]
|
||||
#![feature(const_precise_live_drops)]
|
||||
#![feature(const_refs_to_cell)]
|
||||
#![feature(decl_macro)]
|
||||
#![feature(derive_default_enum)]
|
||||
#![cfg_attr(not(bootstrap), feature(deprecated_suggestion))]
|
||||
#![feature(deprecated_suggestion)]
|
||||
#![feature(doc_cfg)]
|
||||
#![feature(doc_notable_trait)]
|
||||
#![feature(rustdoc_internals)]
|
||||
@ -208,7 +205,6 @@
|
||||
#![feature(asm_const)]
|
||||
//
|
||||
// Target features:
|
||||
#![cfg_attr(bootstrap, feature(aarch64_target_feature))]
|
||||
#![feature(arm_target_feature)]
|
||||
#![feature(avx512_target_feature)]
|
||||
#![feature(cmpxchg16b_target_feature)]
|
||||
@ -220,7 +216,6 @@
|
||||
#![feature(sse4a_target_feature)]
|
||||
#![feature(tbm_target_feature)]
|
||||
#![feature(wasm_target_feature)]
|
||||
#![cfg_attr(bootstrap, feature(adx_target_feature))]
|
||||
|
||||
// allow using `core::` in intra-doc links
|
||||
#[allow(unused_extern_crates)]
|
||||
|
@ -797,17 +797,10 @@ impl<T: ?Sized> Unpin for *mut T {}
|
||||
/// This should be used for `~const` bounds,
|
||||
/// as non-const bounds will always hold for every type.
|
||||
#[unstable(feature = "const_trait_impl", issue = "67792")]
|
||||
#[cfg_attr(not(bootstrap), lang = "destruct")]
|
||||
#[cfg_attr(
|
||||
not(bootstrap),
|
||||
rustc_on_unimplemented(message = "can't drop `{Self}`", append_const_msg,)
|
||||
)]
|
||||
#[lang = "destruct"]
|
||||
#[rustc_on_unimplemented(message = "can't drop `{Self}`", append_const_msg)]
|
||||
pub trait Destruct {}
|
||||
|
||||
#[cfg(bootstrap)]
|
||||
#[unstable(feature = "const_trait_impl", issue = "67792")]
|
||||
impl<T: ?Sized> const Destruct for T {}
|
||||
|
||||
/// Implementations of `Copy` for primitive types.
|
||||
///
|
||||
/// Implementations that cannot be described in Rust
|
||||
|
@ -370,7 +370,6 @@ pub mod consts {
|
||||
pub const LN_10: f32 = 2.30258509299404568401799145468436421_f32;
|
||||
}
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "f32")]
|
||||
#[cfg(not(test))]
|
||||
impl f32 {
|
||||
/// The radix or base of the internal representation of `f32`.
|
||||
|
@ -370,7 +370,6 @@ pub mod consts {
|
||||
pub const LN_10: f64 = 2.30258509299404568401799145468436421_f64;
|
||||
}
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "f64")]
|
||||
#[cfg(not(test))]
|
||||
impl f64 {
|
||||
/// The radix or base of the internal representation of `f64`.
|
||||
|
@ -193,26 +193,22 @@ macro_rules! widening_impl {
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "i8")]
|
||||
impl i8 {
|
||||
int_impl! { i8, i8, u8, 8, 7, -128, 127, 2, "-0x7e", "0xa", "0x12", "0x12", "0x48",
|
||||
"[0x12]", "[0x12]", "", "" }
|
||||
}
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "i16")]
|
||||
impl i16 {
|
||||
int_impl! { i16, i16, u16, 16, 15, -32768, 32767, 4, "-0x5ffd", "0x3a", "0x1234", "0x3412",
|
||||
"0x2c48", "[0x34, 0x12]", "[0x12, 0x34]", "", "" }
|
||||
}
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "i32")]
|
||||
impl i32 {
|
||||
int_impl! { i32, i32, u32, 32, 31, -2147483648, 2147483647, 8, "0x10000b3", "0xb301",
|
||||
"0x12345678", "0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]",
|
||||
"[0x12, 0x34, 0x56, 0x78]", "", "" }
|
||||
}
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "i64")]
|
||||
impl i64 {
|
||||
int_impl! { i64, i64, u64, 64, 63, -9223372036854775808, 9223372036854775807, 12,
|
||||
"0xaa00000000006e1", "0x6e10aa", "0x1234567890123456", "0x5634129078563412",
|
||||
@ -220,7 +216,6 @@ impl i64 {
|
||||
"[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]", "", "" }
|
||||
}
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "i128")]
|
||||
impl i128 {
|
||||
int_impl! { i128, i128, u128, 128, 127, -170141183460469231731687303715884105728,
|
||||
170141183460469231731687303715884105727, 16,
|
||||
@ -233,7 +228,6 @@ impl i128 {
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "16")]
|
||||
#[cfg_attr(bootstrap, lang = "isize")]
|
||||
impl isize {
|
||||
int_impl! { isize, i16, usize, 16, 15, -32768, 32767, 4, "-0x5ffd", "0x3a", "0x1234",
|
||||
"0x3412", "0x2c48", "[0x34, 0x12]", "[0x12, 0x34]",
|
||||
@ -241,7 +235,6 @@ impl isize {
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
#[cfg_attr(bootstrap, lang = "isize")]
|
||||
impl isize {
|
||||
int_impl! { isize, i32, usize, 32, 31, -2147483648, 2147483647, 8, "0x10000b3", "0xb301",
|
||||
"0x12345678", "0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]",
|
||||
@ -250,7 +243,6 @@ impl isize {
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
#[cfg_attr(bootstrap, lang = "isize")]
|
||||
impl isize {
|
||||
int_impl! { isize, i64, usize, 64, 63, -9223372036854775808, 9223372036854775807,
|
||||
12, "0xaa00000000006e1", "0x6e10aa", "0x1234567890123456", "0x5634129078563412",
|
||||
@ -262,7 +254,6 @@ impl isize {
|
||||
/// If 6th bit set ascii is upper case.
|
||||
const ASCII_CASE_MASK: u8 = 0b0010_0000;
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "u8")]
|
||||
impl u8 {
|
||||
uint_impl! { u8, u8, i8, NonZeroU8, 8, 255, 2, "0x82", "0xa", "0x12", "0x12", "0x48", "[0x12]",
|
||||
"[0x12]", "", "" }
|
||||
@ -816,7 +807,6 @@ impl u8 {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "u16")]
|
||||
impl u16 {
|
||||
uint_impl! { u16, u16, i16, NonZeroU16, 16, 65535, 4, "0xa003", "0x3a", "0x1234", "0x3412", "0x2c48",
|
||||
"[0x34, 0x12]", "[0x12, 0x34]", "", "" }
|
||||
@ -848,14 +838,12 @@ impl u16 {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "u32")]
|
||||
impl u32 {
|
||||
uint_impl! { u32, u32, i32, NonZeroU32, 32, 4294967295, 8, "0x10000b3", "0xb301", "0x12345678",
|
||||
"0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]", "[0x12, 0x34, 0x56, 0x78]", "", "" }
|
||||
widening_impl! { u32, u64, 32, unsigned }
|
||||
}
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "u64")]
|
||||
impl u64 {
|
||||
uint_impl! { u64, u64, i64, NonZeroU64, 64, 18446744073709551615, 12, "0xaa00000000006e1", "0x6e10aa",
|
||||
"0x1234567890123456", "0x5634129078563412", "0x6a2c48091e6a2c48",
|
||||
@ -865,7 +853,6 @@ impl u64 {
|
||||
widening_impl! { u64, u128, 64, unsigned }
|
||||
}
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "u128")]
|
||||
impl u128 {
|
||||
uint_impl! { u128, u128, i128, NonZeroU128, 128, 340282366920938463463374607431768211455, 16,
|
||||
"0x13f40000000000000000000000004f76", "0x4f7613f4", "0x12345678901234567890123456789012",
|
||||
@ -878,7 +865,6 @@ impl u128 {
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "16")]
|
||||
#[cfg_attr(bootstrap, lang = "usize")]
|
||||
impl usize {
|
||||
uint_impl! { usize, u16, isize, NonZeroUsize, 16, 65535, 4, "0xa003", "0x3a", "0x1234", "0x3412", "0x2c48",
|
||||
"[0x34, 0x12]", "[0x12, 0x34]",
|
||||
@ -886,7 +872,6 @@ impl usize {
|
||||
widening_impl! { usize, u32, 16, unsigned }
|
||||
}
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
#[cfg_attr(bootstrap, lang = "usize")]
|
||||
impl usize {
|
||||
uint_impl! { usize, u32, isize, NonZeroUsize, 32, 4294967295, 8, "0x10000b3", "0xb301", "0x12345678",
|
||||
"0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]", "[0x12, 0x34, 0x56, 0x78]",
|
||||
@ -895,7 +880,6 @@ impl usize {
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
#[cfg_attr(bootstrap, lang = "usize")]
|
||||
impl usize {
|
||||
uint_impl! { usize, u64, isize, NonZeroUsize, 64, 18446744073709551615, 12, "0xaa00000000006e1", "0x6e10aa",
|
||||
"0x1234567890123456", "0x5634129078563412", "0x6a2c48091e6a2c48",
|
||||
|
@ -773,10 +773,9 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn unwrap_or(self, default: T) -> T
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(x) => x,
|
||||
@ -796,11 +795,10 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn unwrap_or_else<F>(self, f: F) -> T
|
||||
where
|
||||
F: ~const FnOnce() -> T,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(x) => x,
|
||||
@ -902,11 +900,10 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn map<U, F>(self, f: F) -> Option<U>
|
||||
where
|
||||
F: ~const FnOnce(T) -> U,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(x) => Some(f(x)),
|
||||
@ -932,11 +929,10 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[unstable(feature = "result_option_inspect", issue = "91345")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn inspect<F>(self, f: F) -> Self
|
||||
where
|
||||
F: ~const FnOnce(&T),
|
||||
F: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
{
|
||||
if let Some(ref x) = self {
|
||||
f(x);
|
||||
@ -966,12 +962,11 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn map_or<U, F>(self, default: U, f: F) -> U
|
||||
where
|
||||
F: ~const FnOnce(T) -> U,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
U: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
U: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(t) => f(t),
|
||||
@ -996,13 +991,12 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn map_or_else<U, D, F>(self, default: D, f: F) -> U
|
||||
where
|
||||
D: ~const FnOnce() -> U,
|
||||
D: ~const Drop + ~const Destruct,
|
||||
D: ~const Destruct,
|
||||
F: ~const FnOnce(T) -> U,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(t) => f(t),
|
||||
@ -1034,10 +1028,9 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn ok_or<E>(self, err: E) -> Result<T, E>
|
||||
where
|
||||
E: ~const Drop + ~const Destruct,
|
||||
E: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(v) => Ok(v),
|
||||
@ -1064,11 +1057,10 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn ok_or_else<E, F>(self, err: F) -> Result<T, E>
|
||||
where
|
||||
F: ~const FnOnce() -> E,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(v) => Ok(v),
|
||||
@ -1199,11 +1191,10 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn and<U>(self, optb: Option<U>) -> Option<U>
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
U: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
U: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(_) => optb,
|
||||
@ -1242,11 +1233,10 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn and_then<U, F>(self, f: F) -> Option<U>
|
||||
where
|
||||
F: ~const FnOnce(T) -> Option<U>,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(x) => f(x),
|
||||
@ -1281,12 +1271,11 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[stable(feature = "option_filter", since = "1.27.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn filter<P>(self, predicate: P) -> Self
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
P: ~const FnOnce(&T) -> bool,
|
||||
P: ~const Drop + ~const Destruct,
|
||||
P: ~const Destruct,
|
||||
{
|
||||
if let Some(x) = self {
|
||||
if predicate(&x) {
|
||||
@ -1326,10 +1315,9 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn or(self, optb: Option<T>) -> Option<T>
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(x) => Some(x),
|
||||
@ -1353,11 +1341,10 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn or_else<F>(self, f: F) -> Option<T>
|
||||
where
|
||||
F: ~const FnOnce() -> Option<T>,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(x) => Some(x),
|
||||
@ -1389,10 +1376,9 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[stable(feature = "option_xor", since = "1.37.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn xor(self, optb: Option<T>) -> Option<T>
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
{
|
||||
match (self, optb) {
|
||||
(Some(a), None) => Some(a),
|
||||
@ -1428,10 +1414,9 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[stable(feature = "option_insert", since = "1.53.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn insert(&mut self, value: T) -> &mut T
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
{
|
||||
*self = Some(value);
|
||||
|
||||
@ -1462,10 +1447,9 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[stable(feature = "option_entry", since = "1.20.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn get_or_insert(&mut self, value: T) -> &mut T
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
{
|
||||
if let None = *self {
|
||||
*self = Some(value);
|
||||
@ -1530,11 +1514,10 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[stable(feature = "option_entry", since = "1.20.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn get_or_insert_with<F>(&mut self, f: F) -> &mut T
|
||||
where
|
||||
F: ~const FnOnce() -> T,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
{
|
||||
if let None = *self {
|
||||
// the compiler isn't smart enough to know that we are not dropping a `T`
|
||||
@ -1645,11 +1628,10 @@ impl<T> Option<T> {
|
||||
/// ```
|
||||
#[stable(feature = "option_zip_option", since = "1.46.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn zip<U>(self, other: Option<U>) -> Option<(T, U)>
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
U: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
U: ~const Destruct,
|
||||
{
|
||||
match (self, other) {
|
||||
(Some(a), Some(b)) => Some((a, b)),
|
||||
@ -1687,13 +1669,12 @@ impl<T> Option<T> {
|
||||
/// ```
|
||||
#[unstable(feature = "option_zip", issue = "70086")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn zip_with<U, F, R>(self, other: Option<U>, f: F) -> Option<R>
|
||||
where
|
||||
F: ~const FnOnce(T, U) -> R,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
T: ~const Drop + ~const Destruct,
|
||||
U: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
U: ~const Destruct,
|
||||
{
|
||||
match (self, other) {
|
||||
(Some(a), Some(b)) => Some(f(a, b)),
|
||||
@ -1880,10 +1861,9 @@ const fn expect_failed(msg: &str) -> ! {
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_clone", issue = "91805")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
impl<T> const Clone for Option<T>
|
||||
where
|
||||
T: ~const Clone + ~const Drop + ~const Destruct,
|
||||
T: ~const Clone + ~const Destruct,
|
||||
{
|
||||
#[inline]
|
||||
fn clone(&self) -> Self {
|
||||
|
@ -88,7 +88,6 @@ fn panic_bounds_check(index: usize, len: usize) -> ! {
|
||||
// any extra arguments (including those synthesized by track_caller).
|
||||
#[cold]
|
||||
#[inline(never)]
|
||||
#[cfg_attr(bootstrap, track_caller)]
|
||||
#[lang = "panic_no_unwind"] // needed by codegen for panic in nounwind function
|
||||
fn panic_no_unwind() -> ! {
|
||||
if cfg!(feature = "panic_immediate_abort") {
|
||||
|
@ -4,7 +4,6 @@ use crate::intrinsics;
|
||||
use crate::mem;
|
||||
use crate::slice::{self, SliceIndex};
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "const_ptr")]
|
||||
impl<T: ?Sized> *const T {
|
||||
/// Returns `true` if the pointer is null.
|
||||
///
|
||||
@ -1086,7 +1085,6 @@ impl<T: ?Sized> *const T {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "const_slice_ptr")]
|
||||
impl<T> *const [T] {
|
||||
/// Returns the length of a raw slice.
|
||||
///
|
||||
|
@ -3,7 +3,6 @@ use crate::cmp::Ordering::{self, Equal, Greater, Less};
|
||||
use crate::intrinsics;
|
||||
use crate::slice::{self, SliceIndex};
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "mut_ptr")]
|
||||
impl<T: ?Sized> *mut T {
|
||||
/// Returns `true` if the pointer is null.
|
||||
///
|
||||
@ -1357,7 +1356,6 @@ impl<T: ?Sized> *mut T {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "mut_slice_ptr")]
|
||||
impl<T> *mut [T] {
|
||||
/// Returns the length of a raw slice.
|
||||
///
|
||||
|
@ -636,7 +636,7 @@ impl<T, E> Result<T, E> {
|
||||
#[rustc_const_unstable(feature = "const_result_drop", issue = "92384")]
|
||||
pub const fn ok(self) -> Option<T>
|
||||
where
|
||||
E: ~const Drop + ~const Destruct,
|
||||
E: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Ok(x) => Some(x),
|
||||
@ -667,7 +667,7 @@ impl<T, E> Result<T, E> {
|
||||
#[rustc_const_unstable(feature = "const_result_drop", issue = "92384")]
|
||||
pub const fn err(self) -> Option<E>
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
// FIXME: ~const Drop doesn't quite work right yet
|
||||
@ -1283,9 +1283,9 @@ impl<T, E> Result<T, E> {
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const fn and<U>(self, res: Result<U, E>) -> Result<U, E>
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
U: ~const Drop + ~const Destruct,
|
||||
E: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
U: ~const Destruct,
|
||||
E: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
// FIXME: ~const Drop doesn't quite work right yet
|
||||
@ -1368,9 +1368,9 @@ impl<T, E> Result<T, E> {
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const fn or<F>(self, res: Result<T, F>) -> Result<T, F>
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
E: ~const Drop + ~const Destruct,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
E: ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Ok(v) => Ok(v),
|
||||
@ -1432,8 +1432,8 @@ impl<T, E> Result<T, E> {
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const fn unwrap_or(self, default: T) -> T
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
E: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
E: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Ok(t) => t,
|
||||
@ -1803,11 +1803,10 @@ fn unwrap_failed<T>(_msg: &str, _error: &T) -> ! {
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_clone", issue = "91805")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
impl<T, E> const Clone for Result<T, E>
|
||||
where
|
||||
T: ~const Clone + ~const Drop + ~const Destruct,
|
||||
E: ~const Clone + ~const Drop + ~const Destruct,
|
||||
T: ~const Clone + ~const Destruct,
|
||||
E: ~const Clone + ~const Destruct,
|
||||
{
|
||||
#[inline]
|
||||
fn clone(&self) -> Self {
|
||||
|
@ -6,7 +6,6 @@ use crate::iter;
|
||||
use crate::mem;
|
||||
use crate::ops;
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "slice_u8")]
|
||||
#[cfg(not(test))]
|
||||
impl [u8] {
|
||||
/// Checks if all bytes in this slice are within the ASCII range.
|
||||
|
@ -110,7 +110,6 @@ enum Direction {
|
||||
Back,
|
||||
}
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "slice")]
|
||||
#[cfg(not(test))]
|
||||
impl<T> [T] {
|
||||
/// Returns the number of elements in the slice.
|
||||
|
@ -130,7 +130,6 @@ fn slice_error_fail_rt(s: &str, begin: usize, end: usize) -> ! {
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg_attr(bootstrap, lang = "str")]
|
||||
#[cfg(not(test))]
|
||||
impl str {
|
||||
/// Returns the length of `self`.
|
||||
|
@ -20,8 +20,6 @@
|
||||
#![feature(rustc_allow_const_fn_unstable)]
|
||||
#![feature(nll)]
|
||||
#![feature(staged_api)]
|
||||
#![cfg_attr(bootstrap, feature(const_fn_trait_bound))]
|
||||
#![cfg_attr(bootstrap, feature(const_fn_fn_ptr_basics))]
|
||||
#![feature(allow_internal_unstable)]
|
||||
#![feature(decl_macro)]
|
||||
#![feature(extern_types)]
|
||||
|
@ -315,14 +315,11 @@ pub fn take_alloc_error_hook() -> fn(Layout) {
|
||||
}
|
||||
|
||||
fn default_alloc_error_hook(layout: Layout) {
|
||||
#[cfg(not(bootstrap))]
|
||||
extern "Rust" {
|
||||
// This symbol is emitted by rustc next to __rust_alloc_error_handler.
|
||||
// Its value depends on the -Zoom={panic,abort} compiler option.
|
||||
static __rust_alloc_error_handler_should_panic: u8;
|
||||
}
|
||||
#[cfg(bootstrap)]
|
||||
let __rust_alloc_error_handler_should_panic = 0;
|
||||
|
||||
#[allow(unused_unsafe)]
|
||||
if unsafe { __rust_alloc_error_handler_should_panic != 0 } {
|
||||
|
@ -28,7 +28,6 @@ pub use core::f32::{
|
||||
};
|
||||
|
||||
#[cfg(not(test))]
|
||||
#[cfg_attr(bootstrap, lang = "f32_runtime")]
|
||||
impl f32 {
|
||||
/// Returns the largest integer less than or equal to a number.
|
||||
///
|
||||
@ -43,7 +42,7 @@ impl f32 {
|
||||
/// assert_eq!(g.floor(), 3.0);
|
||||
/// assert_eq!(h.floor(), -4.0);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -62,7 +61,7 @@ impl f32 {
|
||||
/// assert_eq!(f.ceil(), 4.0);
|
||||
/// assert_eq!(g.ceil(), 4.0);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -82,7 +81,7 @@ impl f32 {
|
||||
/// assert_eq!(f.round(), 3.0);
|
||||
/// assert_eq!(g.round(), -3.0);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -103,7 +102,7 @@ impl f32 {
|
||||
/// assert_eq!(g.trunc(), 3.0);
|
||||
/// assert_eq!(h.trunc(), -3.0);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -124,7 +123,7 @@ impl f32 {
|
||||
/// assert!(abs_difference_x <= f32::EPSILON);
|
||||
/// assert!(abs_difference_y <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -149,7 +148,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(f32::NAN.abs().is_nan());
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -173,7 +172,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(f32::NAN.signum().is_nan());
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -200,7 +199,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(f32::NAN.copysign(1.0).is_nan());
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[inline]
|
||||
#[stable(feature = "copysign", since = "1.35.0")]
|
||||
@ -228,7 +227,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -253,7 +252,7 @@ impl f32 {
|
||||
/// assert_eq!(a.div_euclid(-b), -1.0); // 7.0 >= -4.0 * -1.0
|
||||
/// assert_eq!((-a).div_euclid(-b), 2.0); // -7.0 >= -4.0 * 2.0
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[inline]
|
||||
#[stable(feature = "euclidean_division", since = "1.38.0")]
|
||||
@ -288,7 +287,7 @@ impl f32 {
|
||||
/// // limitation due to round-off error
|
||||
/// assert!((-f32::EPSILON).rem_euclid(3.0) != 0.0);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[inline]
|
||||
#[stable(feature = "euclidean_division", since = "1.38.0")]
|
||||
@ -309,7 +308,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -327,7 +326,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -352,7 +351,7 @@ impl f32 {
|
||||
/// assert!(negative.sqrt().is_nan());
|
||||
/// assert!(negative_zero.sqrt() == negative_zero);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -374,7 +373,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -394,7 +393,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -416,7 +415,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -440,7 +439,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -460,7 +459,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -483,7 +482,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -508,7 +507,7 @@ impl f32 {
|
||||
/// assert!(abs_difference_x <= f32::EPSILON);
|
||||
/// assert!(abs_difference_y <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -538,7 +537,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -560,7 +559,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -579,7 +578,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -598,7 +597,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -616,7 +615,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -638,7 +637,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -660,7 +659,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -681,7 +680,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -715,7 +714,7 @@ impl f32 {
|
||||
/// assert!(abs_difference_1 <= f32::EPSILON);
|
||||
/// assert!(abs_difference_2 <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -738,7 +737,7 @@ impl f32 {
|
||||
/// assert!(abs_difference_0 <= f32::EPSILON);
|
||||
/// assert!(abs_difference_1 <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn sin_cos(self) -> (f32, f32) {
|
||||
@ -759,7 +758,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -781,7 +780,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -804,7 +803,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -827,7 +826,7 @@ impl f32 {
|
||||
/// // Same result
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -850,7 +849,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -870,7 +869,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -890,7 +889,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -910,7 +909,7 @@ impl f32 {
|
||||
///
|
||||
/// assert!(abs_difference <= 1e-5);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
|
@ -28,7 +28,6 @@ pub use core::f64::{
|
||||
};
|
||||
|
||||
#[cfg(not(test))]
|
||||
#[cfg_attr(bootstrap, lang = "f64_runtime")]
|
||||
impl f64 {
|
||||
/// Returns the largest integer less than or equal to a number.
|
||||
///
|
||||
@ -43,7 +42,7 @@ impl f64 {
|
||||
/// assert_eq!(g.floor(), 3.0);
|
||||
/// assert_eq!(h.floor(), -4.0);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -62,7 +61,7 @@ impl f64 {
|
||||
/// assert_eq!(f.ceil(), 4.0);
|
||||
/// assert_eq!(g.ceil(), 4.0);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -82,7 +81,7 @@ impl f64 {
|
||||
/// assert_eq!(f.round(), 3.0);
|
||||
/// assert_eq!(g.round(), -3.0);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -103,7 +102,7 @@ impl f64 {
|
||||
/// assert_eq!(g.trunc(), 3.0);
|
||||
/// assert_eq!(h.trunc(), -3.0);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -124,7 +123,7 @@ impl f64 {
|
||||
/// assert!(abs_difference_x < 1e-10);
|
||||
/// assert!(abs_difference_y < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -149,7 +148,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(f64::NAN.abs().is_nan());
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -173,7 +172,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(f64::NAN.signum().is_nan());
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -200,7 +199,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(f64::NAN.copysign(1.0).is_nan());
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "copysign", since = "1.35.0")]
|
||||
#[inline]
|
||||
@ -228,7 +227,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -253,7 +252,7 @@ impl f64 {
|
||||
/// assert_eq!(a.div_euclid(-b), -1.0); // 7.0 >= -4.0 * -1.0
|
||||
/// assert_eq!((-a).div_euclid(-b), 2.0); // -7.0 >= -4.0 * 2.0
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[inline]
|
||||
#[stable(feature = "euclidean_division", since = "1.38.0")]
|
||||
@ -288,7 +287,7 @@ impl f64 {
|
||||
/// // limitation due to round-off error
|
||||
/// assert!((-f64::EPSILON).rem_euclid(3.0) != 0.0);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[inline]
|
||||
#[stable(feature = "euclidean_division", since = "1.38.0")]
|
||||
@ -309,7 +308,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -327,7 +326,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -352,7 +351,7 @@ impl f64 {
|
||||
/// assert!(negative.sqrt().is_nan());
|
||||
/// assert!(negative_zero.sqrt() == negative_zero);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -374,7 +373,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -394,7 +393,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -416,7 +415,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -440,7 +439,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -460,7 +459,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -485,7 +484,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -510,7 +509,7 @@ impl f64 {
|
||||
/// assert!(abs_difference_x < 1e-10);
|
||||
/// assert!(abs_difference_y < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -540,7 +539,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -562,7 +561,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -581,7 +580,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -600,7 +599,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -618,7 +617,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-14);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -640,7 +639,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -662,7 +661,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -683,7 +682,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -717,7 +716,7 @@ impl f64 {
|
||||
/// assert!(abs_difference_1 < 1e-10);
|
||||
/// assert!(abs_difference_2 < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -740,7 +739,7 @@ impl f64 {
|
||||
/// assert!(abs_difference_0 < 1e-10);
|
||||
/// assert!(abs_difference_1 < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn sin_cos(self) -> (f64, f64) {
|
||||
@ -761,7 +760,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-20);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -783,7 +782,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-20);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -806,7 +805,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -829,7 +828,7 @@ impl f64 {
|
||||
/// // Same result
|
||||
/// assert!(abs_difference < 1.0e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -852,7 +851,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1.0e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -872,7 +871,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1.0e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -892,7 +891,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1.0e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -912,7 +911,7 @@ impl f64 {
|
||||
///
|
||||
/// assert!(abs_difference < 1.0e-10);
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -923,7 +922,7 @@ impl f64 {
|
||||
// Solaris/Illumos requires a wrapper around log, log2, and log10 functions
|
||||
// because of their non-standard behavior (e.g., log(-n) returns -Inf instead
|
||||
// of expected NaN).
|
||||
#[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
|
||||
#[rustc_allow_incoherent_impl]
|
||||
fn log_wrapper<F: Fn(f64) -> f64>(self, log_fn: F) -> f64 {
|
||||
if !cfg!(any(target_os = "solaris", target_os = "illumos")) {
|
||||
log_fn(self)
|
||||
|
@ -228,12 +228,10 @@
|
||||
#![feature(c_unwind)]
|
||||
#![feature(cfg_target_thread_local)]
|
||||
#![feature(concat_idents)]
|
||||
#![cfg_attr(bootstrap, feature(const_fn_fn_ptr_basics))]
|
||||
#![cfg_attr(bootstrap, feature(const_fn_trait_bound))]
|
||||
#![feature(const_mut_refs)]
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(decl_macro)]
|
||||
#![cfg_attr(not(bootstrap), feature(deprecated_suggestion))]
|
||||
#![feature(deprecated_suggestion)]
|
||||
#![feature(doc_cfg)]
|
||||
#![feature(doc_cfg_hide)]
|
||||
#![feature(doc_masked)]
|
||||
|
@ -103,12 +103,7 @@ impl ConsoleTestState {
|
||||
exec_time: Option<&TestExecTime>,
|
||||
) -> io::Result<()> {
|
||||
self.write_log(|| {
|
||||
let TestDesc {
|
||||
name,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message,
|
||||
..
|
||||
} = test;
|
||||
let TestDesc { name, ignore_message, .. } = test;
|
||||
format!(
|
||||
"{} {}",
|
||||
match *result {
|
||||
@ -116,14 +111,11 @@ impl ConsoleTestState {
|
||||
TestResult::TrFailed => "failed".to_owned(),
|
||||
TestResult::TrFailedMsg(ref msg) => format!("failed: {msg}"),
|
||||
TestResult::TrIgnored => {
|
||||
#[cfg(not(bootstrap))]
|
||||
if let Some(msg) = ignore_message {
|
||||
format!("ignored: {msg}")
|
||||
} else {
|
||||
"ignored".to_owned()
|
||||
}
|
||||
#[cfg(bootstrap)]
|
||||
"ignored".to_owned()
|
||||
}
|
||||
TestResult::TrBench(ref bs) => fmt_bench_samples(bs),
|
||||
TestResult::TrTimedFail => "failed (time limit exceeded)".to_owned(),
|
||||
|
@ -120,22 +120,16 @@ impl<T: Write> OutputFormatter for JsonFormatter<T> {
|
||||
Some(&*format!(r#""message": "{}""#, EscapedString(m))),
|
||||
),
|
||||
|
||||
TestResult::TrIgnored => {
|
||||
#[cfg(not(bootstrap))]
|
||||
return self.write_event(
|
||||
"test",
|
||||
desc.name.as_slice(),
|
||||
"ignored",
|
||||
exec_time,
|
||||
stdout,
|
||||
desc.ignore_message
|
||||
.map(|msg| format!(r#""message": "{}""#, EscapedString(msg)))
|
||||
.as_deref(),
|
||||
);
|
||||
|
||||
#[cfg(bootstrap)]
|
||||
self.write_event("test", desc.name.as_slice(), "ignored", exec_time, stdout, None)
|
||||
}
|
||||
TestResult::TrIgnored => self.write_event(
|
||||
"test",
|
||||
desc.name.as_slice(),
|
||||
"ignored",
|
||||
exec_time,
|
||||
stdout,
|
||||
desc.ignore_message
|
||||
.map(|msg| format!(r#""message": "{}""#, EscapedString(msg)))
|
||||
.as_deref(),
|
||||
),
|
||||
|
||||
TestResult::TrBench(ref bs) => {
|
||||
let median = bs.ns_iter_summ.median as usize;
|
||||
|
@ -218,12 +218,7 @@ impl<T: Write> OutputFormatter for PrettyFormatter<T> {
|
||||
match *result {
|
||||
TestResult::TrOk => self.write_ok()?,
|
||||
TestResult::TrFailed | TestResult::TrFailedMsg(_) => self.write_failed()?,
|
||||
TestResult::TrIgnored => {
|
||||
#[cfg(not(bootstrap))]
|
||||
self.write_ignored(desc.ignore_message)?;
|
||||
#[cfg(bootstrap)]
|
||||
self.write_ignored(None)?;
|
||||
}
|
||||
TestResult::TrIgnored => self.write_ignored(desc.ignore_message)?,
|
||||
TestResult::TrBench(ref bs) => {
|
||||
self.write_bench()?;
|
||||
self.write_plain(&format!(": {}", fmt_bench_samples(bs)))?;
|
||||
|
@ -61,7 +61,6 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
|
||||
desc: TestDesc {
|
||||
name: StaticTestName("1"),
|
||||
ignore: true,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message: None,
|
||||
should_panic: ShouldPanic::No,
|
||||
compile_fail: false,
|
||||
@ -74,7 +73,6 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
|
||||
desc: TestDesc {
|
||||
name: StaticTestName("2"),
|
||||
ignore: false,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message: None,
|
||||
should_panic: ShouldPanic::No,
|
||||
compile_fail: false,
|
||||
@ -95,7 +93,6 @@ pub fn do_not_run_ignored_tests() {
|
||||
desc: TestDesc {
|
||||
name: StaticTestName("whatever"),
|
||||
ignore: true,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message: None,
|
||||
should_panic: ShouldPanic::No,
|
||||
compile_fail: false,
|
||||
@ -117,7 +114,6 @@ pub fn ignored_tests_result_in_ignored() {
|
||||
desc: TestDesc {
|
||||
name: StaticTestName("whatever"),
|
||||
ignore: true,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message: None,
|
||||
should_panic: ShouldPanic::No,
|
||||
compile_fail: false,
|
||||
@ -143,7 +139,6 @@ fn test_should_panic() {
|
||||
desc: TestDesc {
|
||||
name: StaticTestName("whatever"),
|
||||
ignore: false,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message: None,
|
||||
should_panic: ShouldPanic::Yes,
|
||||
compile_fail: false,
|
||||
@ -169,7 +164,6 @@ fn test_should_panic_good_message() {
|
||||
desc: TestDesc {
|
||||
name: StaticTestName("whatever"),
|
||||
ignore: false,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message: None,
|
||||
should_panic: ShouldPanic::YesWithMessage("error message"),
|
||||
compile_fail: false,
|
||||
@ -200,7 +194,6 @@ fn test_should_panic_bad_message() {
|
||||
desc: TestDesc {
|
||||
name: StaticTestName("whatever"),
|
||||
ignore: false,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message: None,
|
||||
should_panic: ShouldPanic::YesWithMessage(expected),
|
||||
compile_fail: false,
|
||||
@ -235,7 +228,6 @@ fn test_should_panic_non_string_message_type() {
|
||||
desc: TestDesc {
|
||||
name: StaticTestName("whatever"),
|
||||
ignore: false,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message: None,
|
||||
should_panic: ShouldPanic::YesWithMessage(expected),
|
||||
compile_fail: false,
|
||||
@ -262,7 +254,6 @@ fn test_should_panic_but_succeeds() {
|
||||
desc: TestDesc {
|
||||
name: StaticTestName("whatever"),
|
||||
ignore: false,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message: None,
|
||||
should_panic,
|
||||
compile_fail: false,
|
||||
@ -297,7 +288,6 @@ fn report_time_test_template(report_time: bool) -> Option<TestExecTime> {
|
||||
desc: TestDesc {
|
||||
name: StaticTestName("whatever"),
|
||||
ignore: false,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message: None,
|
||||
should_panic: ShouldPanic::No,
|
||||
compile_fail: false,
|
||||
@ -333,7 +323,6 @@ fn time_test_failure_template(test_type: TestType) -> TestResult {
|
||||
desc: TestDesc {
|
||||
name: StaticTestName("whatever"),
|
||||
ignore: false,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message: None,
|
||||
should_panic: ShouldPanic::No,
|
||||
compile_fail: false,
|
||||
@ -373,7 +362,6 @@ fn typed_test_desc(test_type: TestType) -> TestDesc {
|
||||
TestDesc {
|
||||
name: StaticTestName("whatever"),
|
||||
ignore: false,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message: None,
|
||||
should_panic: ShouldPanic::No,
|
||||
compile_fail: false,
|
||||
@ -486,7 +474,6 @@ pub fn exclude_should_panic_option() {
|
||||
desc: TestDesc {
|
||||
name: StaticTestName("3"),
|
||||
ignore: false,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message: None,
|
||||
should_panic: ShouldPanic::Yes,
|
||||
compile_fail: false,
|
||||
@ -511,7 +498,6 @@ pub fn exact_filter_match() {
|
||||
desc: TestDesc {
|
||||
name: StaticTestName(name),
|
||||
ignore: false,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message: None,
|
||||
should_panic: ShouldPanic::No,
|
||||
compile_fail: false,
|
||||
@ -601,7 +587,6 @@ fn sample_tests() -> Vec<TestDescAndFn> {
|
||||
desc: TestDesc {
|
||||
name: DynTestName((*name).clone()),
|
||||
ignore: false,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message: None,
|
||||
should_panic: ShouldPanic::No,
|
||||
compile_fail: false,
|
||||
@ -753,7 +738,6 @@ pub fn test_bench_no_iter() {
|
||||
let desc = TestDesc {
|
||||
name: StaticTestName("f"),
|
||||
ignore: false,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message: None,
|
||||
should_panic: ShouldPanic::No,
|
||||
compile_fail: false,
|
||||
@ -776,7 +760,6 @@ pub fn test_bench_iter() {
|
||||
let desc = TestDesc {
|
||||
name: StaticTestName("f"),
|
||||
ignore: false,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message: None,
|
||||
should_panic: ShouldPanic::No,
|
||||
compile_fail: false,
|
||||
@ -793,7 +776,6 @@ fn should_sort_failures_before_printing_them() {
|
||||
let test_a = TestDesc {
|
||||
name: StaticTestName("a"),
|
||||
ignore: false,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message: None,
|
||||
should_panic: ShouldPanic::No,
|
||||
compile_fail: false,
|
||||
@ -804,7 +786,6 @@ fn should_sort_failures_before_printing_them() {
|
||||
let test_b = TestDesc {
|
||||
name: StaticTestName("b"),
|
||||
ignore: false,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message: None,
|
||||
should_panic: ShouldPanic::No,
|
||||
compile_fail: false,
|
||||
|
@ -117,7 +117,6 @@ pub struct TestId(pub usize);
|
||||
pub struct TestDesc {
|
||||
pub name: TestName,
|
||||
pub ignore: bool,
|
||||
#[cfg(not(bootstrap))]
|
||||
pub ignore_message: Option<&'static str>,
|
||||
pub should_panic: options::ShouldPanic,
|
||||
pub compile_fail: bool,
|
||||
|
@ -1,7 +1,6 @@
|
||||
#![no_std]
|
||||
#![unstable(feature = "panic_unwind", issue = "32837")]
|
||||
#![feature(link_cfg)]
|
||||
#![cfg_attr(bootstrap, feature(native_link_modifiers))]
|
||||
#![feature(native_link_modifiers_bundle)]
|
||||
#![feature(nll)]
|
||||
#![feature(staged_api)]
|
||||
|
@ -1019,7 +1019,6 @@ impl Tester for Collector {
|
||||
Ignore::None => false,
|
||||
Ignore::Some(ref ignores) => ignores.iter().any(|s| target_str.contains(s)),
|
||||
},
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message: None,
|
||||
// compiler failures are test failures
|
||||
should_panic: test::ShouldPanic::No,
|
||||
|
@ -1,7 +1,6 @@
|
||||
// build-fail
|
||||
// compile-flags: --crate-type=rlib --target=aarch64-unknown-linux-gnu
|
||||
// needs-llvm-components: aarch64
|
||||
#![cfg_attr(bootstrap, feature(aarch64_target_feature))]
|
||||
#![feature(no_core, lang_items)]
|
||||
#![no_core]
|
||||
|
||||
|
@ -806,8 +806,7 @@ pub fn make_test_description<R: Read>(
|
||||
cfg: Option<&str>,
|
||||
) -> test::TestDesc {
|
||||
let mut ignore = false;
|
||||
#[cfg(not(bootstrap))]
|
||||
let ignore_message: Option<String> = None;
|
||||
let ignore_message = None;
|
||||
let mut should_fail = false;
|
||||
|
||||
let rustc_has_profiler_support = env::var_os("RUSTC_PROFILER_SUPPORT").is_some();
|
||||
@ -879,7 +878,6 @@ pub fn make_test_description<R: Read>(
|
||||
test::TestDesc {
|
||||
name,
|
||||
ignore,
|
||||
#[cfg(not(bootstrap))]
|
||||
ignore_message,
|
||||
should_panic,
|
||||
compile_fail: false,
|
||||
|
Loading…
x
Reference in New Issue
Block a user