Auto merge of #67402 - Mark-Simulacrum:stage0-step, r=alexcrichton

Switch bootstrap to 1.41

This updates the version number for master to 1.42 and switches the bootstrap compiler to yesterday's beta. Fallout of cfg(bootstrap) changes is also dealt with.
This commit is contained in:
bors 2019-12-18 22:03:29 +00:00
commit c605199e89
40 changed files with 172 additions and 543 deletions

View File

@ -13,7 +13,7 @@ use build_helper::output;
use crate::Build;
// The version number
pub const CFG_RELEASE_NUM: &str = "1.41.0";
pub const CFG_RELEASE_NUM: &str = "1.42.0";
pub struct GitInfo {
inner: Option<Info>,

View File

@ -275,10 +275,7 @@ impl<T> LinkedList<T> {
/// let list: LinkedList<u32> = LinkedList::new();
/// ```
#[inline]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_linked_list_new", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_linked_list_new", since = "1.32.0")]
#[stable(feature = "rust1", since = "1.0.0")]
pub const fn new() -> Self {
LinkedList {

View File

@ -116,8 +116,6 @@
#![feature(unsize)]
#![feature(unsized_locals)]
#![feature(allocator_internals)]
#![cfg_attr(bootstrap, feature(on_unimplemented))]
#![cfg_attr(bootstrap, feature(rustc_const_unstable))]
#![feature(slice_partition_dedup)]
#![feature(maybe_uninit_extra, maybe_uninit_slice)]
#![feature(alloc_layout_extra)]

View File

@ -367,10 +367,7 @@ impl String {
/// let s = String::new();
/// ```
#[inline]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_string_new", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_string_new", since = "1.32.0")]
#[stable(feature = "rust1", since = "1.0.0")]
pub const fn new() -> String {
String { vec: Vec::new() }

View File

@ -315,10 +315,7 @@ impl<T> Vec<T> {
/// let mut vec: Vec<i32> = Vec::new();
/// ```
#[inline]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_vec_new", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_vec_new", since = "1.32.0")]
#[stable(feature = "rust1", since = "1.0.0")]
pub const fn new() -> Vec<T> {
Vec {

View File

@ -100,7 +100,7 @@ impl Layout {
/// This function is unsafe as it does not verify the preconditions from
/// [`Layout::from_size_align`](#method.from_size_align).
#[stable(feature = "alloc_layout", since = "1.28.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "alloc_layout", since = "1.28.0"))]
#[rustc_const_stable(feature = "alloc_layout", since = "1.28.0")]
#[inline]
pub const unsafe fn from_size_align_unchecked(size: usize, align: usize) -> Self {
Layout { size_: size, align_: NonZeroUsize::new_unchecked(align) }

View File

@ -423,14 +423,9 @@ impl TypeId {
/// assert_eq!(is_string(&"cookie monster".to_string()), true);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature="const_type_id"))]
#[cfg_attr(not(bootstrap), rustc_const_unstable(feature="const_type_id", issue = "41875"))]
#[rustc_const_unstable(feature="const_type_id", issue = "41875")]
pub const fn of<T: ?Sized + 'static>() -> TypeId {
TypeId {
#[cfg(bootstrap)]
// SAFETY: going away soon
t: unsafe { intrinsics::type_id::<T>() },
#[cfg(not(bootstrap))]
t: intrinsics::type_id::<T>(),
}
}
@ -462,8 +457,7 @@ impl TypeId {
/// );
/// ```
#[stable(feature = "type_name", since = "1.38.0")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_type_name"))]
#[cfg_attr(not(bootstrap), rustc_const_unstable(feature = "const_type_name", issue = "63084"))]
#[rustc_const_unstable(feature = "const_type_name", issue = "63084")]
pub const fn type_name<T: ?Sized>() -> &'static str {
intrinsics::type_name::<T>()
}
@ -501,8 +495,7 @@ pub const fn type_name<T: ?Sized>() -> &'static str {
/// println!("{}", type_name_of_val(&y));
/// ```
#[unstable(feature = "type_name_of_val", issue = "66359")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_type_name"))]
#[cfg_attr(not(bootstrap), rustc_const_unstable(feature = "const_type_name", issue = "63084"))]
#[rustc_const_unstable(feature = "const_type_name", issue = "63084")]
pub const fn type_name_of_val<T: ?Sized>(val: &T) -> &'static str {
let _ = val;
type_name::<T>()

View File

@ -324,7 +324,7 @@ impl<T> Cell<T> {
/// let c = Cell::new(5);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_cell_new", since = "1.32.0"))]
#[rustc_const_stable(feature = "const_cell_new", since = "1.32.0")]
#[inline]
pub const fn new(value: T) -> Cell<T> {
Cell {
@ -470,7 +470,7 @@ impl<T: ?Sized> Cell<T> {
/// ```
#[inline]
#[stable(feature = "cell_as_ptr", since = "1.12.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_cell_as_ptr", since = "1.32.0"))]
#[rustc_const_stable(feature = "const_cell_as_ptr", since = "1.32.0")]
pub const fn as_ptr(&self) -> *mut T {
self.value.get()
}
@ -651,7 +651,7 @@ impl<T> RefCell<T> {
/// let c = RefCell::new(5);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_refcell_new", since = "1.32.0"))]
#[rustc_const_stable(feature = "const_refcell_new", since = "1.32.0")]
#[inline]
pub const fn new(value: T) -> RefCell<T> {
RefCell {
@ -1504,10 +1504,7 @@ impl<T> UnsafeCell<T> {
/// let uc = UnsafeCell::new(5);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_unsafe_cell_new", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_unsafe_cell_new", since = "1.32.0")]
#[inline]
pub const fn new(value: T) -> UnsafeCell<T> {
UnsafeCell { value }
@ -1550,10 +1547,7 @@ impl<T: ?Sized> UnsafeCell<T> {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_unsafecell_get", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_unsafecell_get", since = "1.32.0")]
pub const fn get(&self) -> *mut T {
// We can just cast the pointer from `UnsafeCell<T>` to `T` because of
// #[repr(transparent)]. This exploits libstd's special status, there is

View File

@ -911,10 +911,7 @@ impl char {
/// assert!(!non_ascii.is_ascii());
/// ```
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_ascii_methods_on_intrinsics", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_ascii_methods_on_intrinsics", since = "1.32.0")]
#[inline]
pub const fn is_ascii(&self) -> bool {
*self as u32 <= 0x7F

View File

@ -101,7 +101,7 @@ pub use num::FloatToInt;
/// assert_eq!(vec![1, 3], filtered);
/// ```
#[stable(feature = "convert_id", since = "1.33.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_identity", since = "1.33.0"))]
#[rustc_const_stable(feature = "const_identity", since = "1.33.0")]
#[inline]
pub const fn identity<T>(x: T) -> T {
x

View File

@ -13,7 +13,6 @@ mod private {
/// Typically doesnt need to be used directly.
#[unstable(feature = "convert_float_to_int", issue = "67057")]
pub trait FloatToInt<Int>: private::Sealed + Sized {
#[cfg(not(bootstrap))]
#[unstable(feature = "float_approx_unchecked_to", issue = "67058")]
#[doc(hidden)]
unsafe fn approx_unchecked(self) -> Int;
@ -26,7 +25,6 @@ macro_rules! impl_float_to_int {
$(
#[unstable(feature = "convert_float_to_int", issue = "67057")]
impl FloatToInt<$Int> for $Float {
#[cfg(not(bootstrap))]
#[doc(hidden)]
#[inline]
unsafe fn approx_unchecked(self) -> $Int {

View File

@ -939,11 +939,7 @@ extern "rust-intrinsic" {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_transmute"))]
#[cfg_attr(
not(bootstrap),
rustc_const_unstable(feature = "const_transmute", issue = "53605"),
)]
#[rustc_const_unstable(feature = "const_transmute", issue = "53605")]
pub fn transmute<T, U>(e: T) -> U;
/// Returns `true` if the actual type given as `T` requires drop
@ -1150,7 +1146,6 @@ extern "rust-intrinsic" {
/// Convert with LLVMs fptoui/fptosi, which may return undef for values out of range
/// https://github.com/rust-lang/rust/issues/10184
#[cfg(not(bootstrap))]
pub fn float_to_int_approx_unchecked<Float, Int>(value: Float) -> Int;
@ -1361,7 +1356,6 @@ extern "rust-intrinsic" {
/// Compiles to a NOP during non-Miri codegen.
///
/// Perma-unstable: do not use
#[cfg(not(bootstrap))]
pub fn miri_start_panic(data: *mut (dyn crate::any::Any + crate::marker::Send)) -> ();
}

View File

@ -517,14 +517,6 @@ impl<I> Iterator for StepBy<I> where I: Iterator {
// overflow handling
loop {
let mul = n.checked_mul(step);
#[cfg(bootstrap)]
{
// SAFETY: going away soon
if unsafe { intrinsics::likely(mul.is_some()) } {
return self.iter.nth(mul.unwrap() - 1);
}
}
#[cfg(not(bootstrap))]
{
if intrinsics::likely(mul.is_some()) {
return self.iter.nth(mul.unwrap() - 1);

View File

@ -281,7 +281,7 @@ impl<T> Default for Empty<T> {
/// assert_eq!(None, nope.next());
/// ```
#[stable(feature = "iter_empty", since = "1.2.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_iter_empty", since = "1.32.0"))]
#[rustc_const_stable(feature = "const_iter_empty", since = "1.32.0")]
pub const fn empty<T>() -> Empty<T> {
Empty(marker::PhantomData)
}

View File

@ -74,8 +74,8 @@
#![feature(const_fn)]
#![feature(const_fn_union)]
#![feature(const_generics)]
#![cfg_attr(not(bootstrap), feature(const_ptr_offset_from))]
#![cfg_attr(not(bootstrap), feature(const_type_name))]
#![feature(const_ptr_offset_from)]
#![feature(const_type_name)]
#![feature(custom_inner_attributes)]
#![feature(decl_macro)]
#![feature(doc_cfg)]
@ -91,18 +91,16 @@
#![feature(nll)]
#![feature(exhaustive_patterns)]
#![feature(no_core)]
#![cfg_attr(bootstrap, feature(on_unimplemented))]
#![feature(optin_builtin_traits)]
#![feature(prelude_import)]
#![feature(repr_simd, platform_intrinsics)]
#![feature(rustc_attrs)]
#![cfg_attr(bootstrap, feature(rustc_const_unstable))]
#![feature(simd_ffi)]
#![feature(specialization)]
#![feature(staged_api)]
#![feature(std_internals)]
#![feature(stmt_expr_attributes)]
#![cfg_attr(not(bootstrap), feature(track_caller))]
#![feature(track_caller)]
#![feature(transparent_unions)]
#![feature(unboxed_closures)]
#![feature(unsized_locals)]

View File

@ -63,10 +63,7 @@ impl<T> ManuallyDrop<T> {
/// ManuallyDrop::new(Box::new(()));
/// ```
#[stable(feature = "manually_drop", since = "1.20.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_manually_drop", since = "1.36.0"),
)]
#[rustc_const_stable(feature = "const_manually_drop", since = "1.36.0")]
#[inline(always)]
pub const fn new(value: T) -> ManuallyDrop<T> {
ManuallyDrop { value }
@ -84,10 +81,7 @@ impl<T> ManuallyDrop<T> {
/// let _: Box<()> = ManuallyDrop::into_inner(x); // This drops the `Box`.
/// ```
#[stable(feature = "manually_drop", since = "1.20.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_manually_drop", since = "1.36.0"),
)]
#[rustc_const_stable(feature = "const_manually_drop", since = "1.36.0")]
#[inline(always)]
pub const fn into_inner(slot: ManuallyDrop<T>) -> T {
slot.value

View File

@ -250,10 +250,7 @@ impl<T> MaybeUninit<T> {
///
/// [`assume_init`]: #method.assume_init
#[stable(feature = "maybe_uninit", since = "1.36.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_maybe_uninit", since = "1.36.0"),
)]
#[rustc_const_stable(feature = "const_maybe_uninit", since = "1.36.0")]
#[inline(always)]
pub const fn new(val: T) -> MaybeUninit<T> {
MaybeUninit { value: ManuallyDrop::new(val) }
@ -268,12 +265,9 @@ impl<T> MaybeUninit<T> {
///
/// [type]: union.MaybeUninit.html
#[stable(feature = "maybe_uninit", since = "1.36.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_maybe_uninit", since = "1.36.0"),
)]
#[rustc_const_stable(feature = "const_maybe_uninit", since = "1.36.0")]
#[inline(always)]
#[cfg_attr(all(not(bootstrap)), rustc_diagnostic_item = "maybe_uninit_uninit")]
#[rustc_diagnostic_item = "maybe_uninit_uninit"]
pub const fn uninit() -> MaybeUninit<T> {
MaybeUninit { uninit: () }
}
@ -357,7 +351,7 @@ impl<T> MaybeUninit<T> {
/// ```
#[stable(feature = "maybe_uninit", since = "1.36.0")]
#[inline]
#[cfg_attr(all(not(bootstrap)), rustc_diagnostic_item = "maybe_uninit_zeroed")]
#[rustc_diagnostic_item = "maybe_uninit_zeroed"]
pub fn zeroed() -> MaybeUninit<T> {
let mut u = MaybeUninit::<T>::uninit();
unsafe {
@ -498,7 +492,7 @@ impl<T> MaybeUninit<T> {
/// ```
#[stable(feature = "maybe_uninit", since = "1.36.0")]
#[inline(always)]
#[cfg_attr(all(not(bootstrap)), rustc_diagnostic_item = "assume_init")]
#[rustc_diagnostic_item = "assume_init"]
pub unsafe fn assume_init(self) -> T {
intrinsics::panic_if_uninhabited::<T>();
ManuallyDrop::into_inner(self.value)

View File

@ -271,7 +271,7 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_size_of", since = "1.32.0"))]
#[rustc_const_stable(feature = "const_size_of", since = "1.32.0")]
pub const fn size_of<T>() -> usize {
intrinsics::size_of::<T>()
}
@ -299,10 +299,6 @@ pub const fn size_of<T>() -> usize {
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn size_of_val<T: ?Sized>(val: &T) -> usize {
#[cfg(bootstrap)]
// SAFETY: going away soon
unsafe { intrinsics::size_of_val(val) }
#[cfg(not(bootstrap))]
intrinsics::size_of_val(val)
}
@ -347,10 +343,6 @@ pub fn min_align_of<T>() -> usize {
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_deprecated(reason = "use `align_of_val` instead", since = "1.2.0")]
pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
#[cfg(bootstrap)]
// SAFETY: going away soon
unsafe { intrinsics::min_align_of_val(val) }
#[cfg(not(bootstrap))]
intrinsics::min_align_of_val(val)
}
@ -372,7 +364,7 @@ pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_align_of", since = "1.32.0"))]
#[rustc_const_stable(feature = "const_align_of", since = "1.32.0")]
pub const fn align_of<T>() -> usize {
intrinsics::min_align_of::<T>()
}
@ -455,7 +447,7 @@ pub fn align_of_val<T: ?Sized>(val: &T) -> usize {
/// ```
#[inline]
#[stable(feature = "needs_drop", since = "1.21.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_needs_drop", since = "1.36.0"))]
#[rustc_const_stable(feature = "const_needs_drop", since = "1.36.0")]
pub const fn needs_drop<T>() -> bool {
intrinsics::needs_drop::<T>()
}
@ -501,7 +493,7 @@ pub const fn needs_drop<T>() -> bool {
#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated_in_future)]
#[allow(deprecated)]
#[cfg_attr(all(not(bootstrap)), rustc_diagnostic_item = "mem_zeroed")]
#[rustc_diagnostic_item = "mem_zeroed"]
pub unsafe fn zeroed<T>() -> T {
intrinsics::panic_if_uninhabited::<T>();
intrinsics::init()
@ -534,7 +526,7 @@ pub unsafe fn zeroed<T>() -> T {
#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated_in_future)]
#[allow(deprecated)]
#[cfg_attr(all(not(bootstrap)), rustc_diagnostic_item = "mem_uninitialized")]
#[rustc_diagnostic_item = "mem_uninitialized"]
pub unsafe fn uninitialized<T>() -> T {
intrinsics::panic_if_uninhabited::<T>();
intrinsics::uninit()
@ -874,11 +866,5 @@ impl<T> fmt::Debug for Discriminant<T> {
/// ```
#[stable(feature = "discriminant_value", since = "1.21.0")]
pub fn discriminant<T>(v: &T) -> Discriminant<T> {
#[cfg(bootstrap)]
// SAFETY: going away soon
unsafe {
Discriminant(intrinsics::discriminant_value(v), PhantomData)
}
#[cfg(not(bootstrap))]
Discriminant(intrinsics::discriminant_value(v), PhantomData)
}

View File

@ -7,7 +7,6 @@
#![stable(feature = "rust1", since = "1.0.0")]
#[cfg(not(bootstrap))]
use crate::convert::FloatToInt;
#[cfg(not(test))]
use crate::intrinsics;
@ -423,7 +422,6 @@ impl f32 {
/// * Not be `NaN`
/// * Not be infinite
/// * Be representable in the return type `Int`, after truncating off its fractional part
#[cfg(not(bootstrap))]
#[unstable(feature = "float_approx_unchecked_to", issue = "67058")]
#[inline]
pub unsafe fn approx_unchecked_to<Int>(self) -> Int where Self: FloatToInt<Int> {

View File

@ -7,7 +7,6 @@
#![stable(feature = "rust1", since = "1.0.0")]
#[cfg(not(bootstrap))]
use crate::convert::FloatToInt;
#[cfg(not(test))]
use crate::intrinsics;
@ -436,7 +435,6 @@ impl f64 {
/// * Not be `NaN`
/// * Not be infinite
/// * Be representable in the return type `Int`, after truncating off its fractional part
#[cfg(not(bootstrap))]
#[unstable(feature = "float_approx_unchecked_to", issue = "67058")]
#[inline]
pub unsafe fn approx_unchecked_to<Int>(self) -> Int

View File

@ -61,10 +61,7 @@ assert_eq!(size_of::<Option<core::num::", stringify!($Ty), ">>(), size_of::<", s
///
/// The value must not be zero.
#[$stability]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "nonzero", since = "1.34.0"),
)]
#[rustc_const_stable(feature = "nonzero", since = "1.34.0")]
#[inline]
pub const unsafe fn new_unchecked(n: $Int) -> Self {
Self(n)
@ -85,10 +82,7 @@ assert_eq!(size_of::<Option<core::num::", stringify!($Ty), ">>(), size_of::<", s
/// Returns the value as a primitive type.
#[$stability]
#[inline]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "nonzero", since = "1.34.0"),
)]
#[rustc_const_stable(feature = "nonzero", since = "1.34.0")]
pub const fn get(self) -> $Int {
self.0
}
@ -264,10 +258,7 @@ $EndFeature, "
#[stable(feature = "rust1", since = "1.0.0")]
#[inline(always)]
#[rustc_promotable]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_min_value", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_min_value", since = "1.32.0")]
pub const fn min_value() -> Self {
!0 ^ ((!0 as $UnsignedT) >> 1) as Self
}
@ -287,10 +278,7 @@ $EndFeature, "
#[stable(feature = "rust1", since = "1.0.0")]
#[inline(always)]
#[rustc_promotable]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_max_value", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_max_value", since = "1.32.0")]
pub const fn max_value() -> Self {
!Self::min_value()
}
@ -340,10 +328,7 @@ $EndFeature, "
```
"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[inline]
pub const fn count_ones(self) -> u32 { (self as $UnsignedT).count_ones() }
}
@ -359,10 +344,7 @@ Basic usage:
", $Feature, "assert_eq!(", stringify!($SelfT), "::max_value().count_zeros(), 1);", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[inline]
pub const fn count_zeros(self) -> u32 {
(!self).count_ones()
@ -383,10 +365,7 @@ assert_eq!(n.leading_zeros(), 0);",
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[inline]
pub const fn leading_zeros(self) -> u32 {
(self as $UnsignedT).leading_zeros()
@ -407,10 +386,7 @@ assert_eq!(n.trailing_zeros(), 2);",
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[inline]
pub const fn trailing_zeros(self) -> u32 {
(self as $UnsignedT).trailing_zeros()
@ -434,10 +410,7 @@ let m = ", $rot_result, ";
assert_eq!(n.rotate_left(", $rot, "), m);
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -464,10 +437,7 @@ let m = ", $rot_op, ";
assert_eq!(n.rotate_right(", $rot, "), m);
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -491,10 +461,7 @@ let m = n.swap_bytes();
assert_eq!(m, ", $swapped, ");
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[inline]
pub const fn swap_bytes(self) -> Self {
(self as $UnsignedT).swap_bytes() as Self
@ -515,10 +482,7 @@ let m = n.reverse_bits();
assert_eq!(m, ", $reversed, ");
```"),
#[stable(feature = "reverse_bits", since = "1.37.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[inline]
#[must_use]
pub const fn reverse_bits(self) -> Self {
@ -546,10 +510,7 @@ if cfg!(target_endian = \"big\") {
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_conversions", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_conversions", since = "1.32.0")]
#[inline]
pub const fn from_be(x: Self) -> Self {
#[cfg(target_endian = "big")]
@ -583,10 +544,7 @@ if cfg!(target_endian = \"little\") {
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_conversions", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_conversions", since = "1.32.0")]
#[inline]
pub const fn from_le(x: Self) -> Self {
#[cfg(target_endian = "little")]
@ -620,10 +578,7 @@ if cfg!(target_endian = \"big\") {
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_conversions", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_conversions", since = "1.32.0")]
#[inline]
pub const fn to_be(self) -> Self { // or not to be?
#[cfg(target_endian = "big")]
@ -657,10 +612,7 @@ if cfg!(target_endian = \"little\") {
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_conversions", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_conversions", since = "1.32.0")]
#[inline]
pub const fn to_le(self) -> Self {
#[cfg(target_endian = "little")]
@ -1013,11 +965,7 @@ $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_saturating_int_methods"))]
#[cfg_attr(
not(bootstrap),
rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718"),
)]
#[rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -1043,11 +991,7 @@ assert_eq!(", stringify!($SelfT), "::max_value().saturating_sub(-1), ", stringif
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_saturating_int_methods"))]
#[cfg_attr(
not(bootstrap),
rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718"),
)]
#[rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -1187,10 +1131,7 @@ assert_eq!(", stringify!($SelfT), "::max_value().wrapping_add(2), ", stringify!(
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -1214,10 +1155,7 @@ stringify!($SelfT), "::max_value());",
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -1240,10 +1178,7 @@ assert_eq!(11i8.wrapping_mul(12), -124);",
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -1388,10 +1323,7 @@ assert_eq!(", stringify!($SelfT), "::min_value().wrapping_neg(), ", stringify!($
$EndFeature, "
```"),
#[stable(feature = "num_wrapping", since = "1.2.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[inline]
pub const fn wrapping_neg(self) -> Self {
self.overflowing_neg().0
@ -1417,10 +1349,7 @@ assert_eq!((-1", stringify!($SelfT), ").wrapping_shl(128), -1);",
$EndFeature, "
```"),
#[stable(feature = "num_wrapping", since = "1.2.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -1452,10 +1381,7 @@ assert_eq!((-128i16).wrapping_shr(64), -128);",
$EndFeature, "
```"),
#[stable(feature = "num_wrapping", since = "1.2.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -1489,10 +1415,7 @@ assert_eq!((-128i8).wrapping_abs() as u8, 128);",
$EndFeature, "
```"),
#[stable(feature = "no_panic_abs", since = "1.13.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[inline]
pub const fn wrapping_abs(self) -> Self {
// sign is -1 (all ones) for negative numbers, 0 otherwise.
@ -1567,10 +1490,7 @@ assert_eq!(", stringify!($SelfT), "::MAX.overflowing_add(1), (", stringify!($Sel
"::MIN, true));", $EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -1598,10 +1518,7 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_sub(1), (", stringify!($Sel
"::MAX, true));", $EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -1627,10 +1544,7 @@ assert_eq!(1_000_000_000i32.overflowing_mul(10), (1410065408, true));",
$EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -1798,10 +1712,7 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_neg(), (", stringify!($Self
```"),
#[inline]
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
pub const fn overflowing_neg(self) -> (Self, bool) {
((!self).wrapping_add(1), self == Self::min_value())
}
@ -1824,10 +1735,7 @@ assert_eq!(0x1i32.overflowing_shl(36), (0x10, true));",
$EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -1853,10 +1761,7 @@ assert_eq!(0x10i32.overflowing_shr(36), (0x1, true));",
$EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -1885,10 +1790,7 @@ assert_eq!((", stringify!($SelfT), "::min_value()).overflowing_abs(), (", string
$EndFeature, "
```"),
#[stable(feature = "no_panic_abs", since = "1.13.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[inline]
pub const fn overflowing_abs(self) -> (Self, bool) {
(self.wrapping_abs(), self == Self::min_value())
@ -2093,10 +1995,7 @@ assert_eq!((-10", stringify!($SelfT), ").abs(), 10);",
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[inline]
#[rustc_inherit_overflow_checks]
pub const fn abs(self) -> Self {
@ -2139,11 +2038,7 @@ assert_eq!((-10", stringify!($SelfT), ").signum(), -1);",
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_sign"))]
#[cfg_attr(
not(bootstrap),
rustc_const_unstable(feature = "const_int_sign", issue = "53718"),
)]
#[rustc_const_unstable(feature = "const_int_sign", issue = "53718")]
#[inline]
pub const fn signum(self) -> Self {
(self > 0) as Self - (self < 0) as Self
@ -2164,10 +2059,7 @@ assert!(!(-10", stringify!($SelfT), ").is_positive());",
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[inline]
pub const fn is_positive(self) -> bool { self > 0 }
}
@ -2186,10 +2078,7 @@ assert!(!10", stringify!($SelfT), ".is_negative());",
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[inline]
pub const fn is_negative(self) -> bool { self < 0 }
}
@ -2207,11 +2096,7 @@ let bytes = ", $swap_op, stringify!($SelfT), ".to_be_bytes();
assert_eq!(bytes, ", $be_bytes, ");
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
#[cfg_attr(
not(bootstrap),
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
)]
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
#[inline]
pub const fn to_be_bytes(self) -> [u8; mem::size_of::<Self>()] {
self.to_be().to_ne_bytes()
@ -2231,11 +2116,7 @@ let bytes = ", $swap_op, stringify!($SelfT), ".to_le_bytes();
assert_eq!(bytes, ", $le_bytes, ");
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
#[cfg_attr(
not(bootstrap),
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
)]
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
#[inline]
pub const fn to_le_bytes(self) -> [u8; mem::size_of::<Self>()] {
self.to_le().to_ne_bytes()
@ -2270,11 +2151,7 @@ assert_eq!(
);
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
#[cfg_attr(
not(bootstrap),
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
)]
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
#[inline]
pub const fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] {
// SAFETY: integers are plain old datatypes so we can always transmute them to
@ -2308,11 +2185,7 @@ fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT),
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
#[cfg_attr(
not(bootstrap),
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
)]
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
#[inline]
pub const fn from_be_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
Self::from_be(Self::from_ne_bytes(bytes))
@ -2345,11 +2218,7 @@ fn read_le_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT),
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
#[cfg_attr(
not(bootstrap),
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
)]
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
#[inline]
pub const fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
Self::from_le(Self::from_ne_bytes(bytes))
@ -2392,11 +2261,7 @@ fn read_ne_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT),
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
#[cfg_attr(
not(bootstrap),
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
)]
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
#[inline]
pub const fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
// SAFETY: integers are plain old datatypes so we can always transmute to them
@ -2490,10 +2355,7 @@ Basic usage:
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
#[inline(always)]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_min_value", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_min_value", since = "1.32.0")]
pub const fn min_value() -> Self { 0 }
}
@ -2511,10 +2373,7 @@ stringify!($MaxV), ");", $EndFeature, "
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
#[inline(always)]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_max_value", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_max_value", since = "1.32.0")]
pub const fn max_value() -> Self { !0 }
}
@ -2561,10 +2420,7 @@ Basic usage:
assert_eq!(n.count_ones(), 3);", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
#[inline]
pub const fn count_ones(self) -> u32 {
intrinsics::ctpop(self as $ActualT) as u32
@ -2582,10 +2438,7 @@ Basic usage:
", $Feature, "assert_eq!(", stringify!($SelfT), "::max_value().count_zeros(), 0);", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
#[inline]
pub const fn count_zeros(self) -> u32 {
(!self).count_ones()
@ -2605,10 +2458,7 @@ Basic usage:
assert_eq!(n.leading_zeros(), 2);", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
#[inline]
pub const fn leading_zeros(self) -> u32 {
intrinsics::ctlz(self as $ActualT) as u32
@ -2629,10 +2479,7 @@ Basic usage:
assert_eq!(n.trailing_zeros(), 3);", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
#[inline]
pub const fn trailing_zeros(self) -> u32 {
intrinsics::cttz(self) as u32
@ -2656,10 +2503,7 @@ let m = ", $rot_result, ";
assert_eq!(n.rotate_left(", $rot, "), m);
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -2686,10 +2530,7 @@ let m = ", $rot_op, ";
assert_eq!(n.rotate_right(", $rot, "), m);
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -2713,10 +2554,7 @@ let m = n.swap_bytes();
assert_eq!(m, ", $swapped, ");
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
#[inline]
pub const fn swap_bytes(self) -> Self {
intrinsics::bswap(self as $ActualT) as Self
@ -2737,10 +2575,7 @@ let m = n.reverse_bits();
assert_eq!(m, ", $reversed, ");
```"),
#[stable(feature = "reverse_bits", since = "1.37.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
#[inline]
#[must_use]
pub const fn reverse_bits(self) -> Self {
@ -2768,10 +2603,7 @@ if cfg!(target_endian = \"big\") {
}", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
#[inline]
pub const fn from_be(x: Self) -> Self {
#[cfg(target_endian = "big")]
@ -2805,10 +2637,7 @@ if cfg!(target_endian = \"little\") {
}", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
#[inline]
pub const fn from_le(x: Self) -> Self {
#[cfg(target_endian = "little")]
@ -2842,10 +2671,7 @@ if cfg!(target_endian = \"big\") {
}", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
#[inline]
pub const fn to_be(self) -> Self { // or not to be?
#[cfg(target_endian = "big")]
@ -2879,10 +2705,7 @@ if cfg!(target_endian = \"little\") {
}", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
#[inline]
pub const fn to_le(self) -> Self {
#[cfg(target_endian = "little")]
@ -3188,11 +3011,7 @@ assert_eq!(200u8.saturating_add(127), 255);", $EndFeature, "
#[stable(feature = "rust1", since = "1.0.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_saturating_int_methods"))]
#[cfg_attr(
not(bootstrap),
rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718"),
)]
#[rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718")]
#[inline]
pub const fn saturating_add(self, rhs: Self) -> Self {
intrinsics::saturating_add(self, rhs)
@ -3214,11 +3033,7 @@ assert_eq!(13", stringify!($SelfT), ".saturating_sub(127), 0);", $EndFeature, "
#[stable(feature = "rust1", since = "1.0.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_saturating_int_methods"))]
#[cfg_attr(
not(bootstrap),
rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718"),
)]
#[rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718")]
#[inline]
pub const fn saturating_sub(self, rhs: Self) -> Self {
intrinsics::saturating_sub(self, rhs)
@ -3290,10 +3105,7 @@ assert_eq!(200", stringify!($SelfT), ".wrapping_add(", stringify!($SelfT), "::ma
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -3316,10 +3128,7 @@ assert_eq!(100", stringify!($SelfT), ".wrapping_sub(", stringify!($SelfT), "::ma
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -3343,10 +3152,7 @@ $EndFeature, "
/// assert_eq!(25u8.wrapping_mul(12), 44);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -3476,10 +3282,7 @@ assert_eq!(100", stringify!($SelfT), ".wrapping_rem_euclid(10), 0);
/// assert_eq!((-128i8).wrapping_neg(), -128);
/// ```
#[stable(feature = "num_wrapping", since = "1.2.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
#[inline]
pub const fn wrapping_neg(self) -> Self {
self.overflowing_neg().0
@ -3506,10 +3309,7 @@ Basic usage:
assert_eq!(1", stringify!($SelfT), ".wrapping_shl(128), 1);", $EndFeature, "
```"),
#[stable(feature = "num_wrapping", since = "1.2.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -3543,10 +3343,7 @@ Basic usage:
assert_eq!(128", stringify!($SelfT), ".wrapping_shr(128), 128);", $EndFeature, "
```"),
#[stable(feature = "num_wrapping", since = "1.2.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -3616,10 +3413,7 @@ assert_eq!(5", stringify!($SelfT), ".overflowing_add(2), (7, false));
assert_eq!(", stringify!($SelfT), "::MAX.overflowing_add(1), (0, true));", $EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -3648,10 +3442,7 @@ assert_eq!(0", stringify!($SelfT), ".overflowing_sub(1), (", stringify!($SelfT),
$EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -3679,10 +3470,7 @@ $EndFeature, "
/// assert_eq!(1_000_000_000u32.overflowing_mul(10), (1410065408, true));
/// ```
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -3828,10 +3616,7 @@ assert_eq!(2", stringify!($SelfT), ".overflowing_neg(), (-2i32 as ", stringify!(
```"),
#[inline]
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
pub const fn overflowing_neg(self) -> (Self, bool) {
((!self).wrapping_add(1), self != 0)
}
@ -3855,10 +3640,7 @@ Basic usage
assert_eq!(0x1", stringify!($SelfT), ".overflowing_shl(132), (0x10, true));", $EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -3885,10 +3667,7 @@ Basic usage
assert_eq!(0x10", stringify!($SelfT), ".overflowing_shr(132), (0x1, true));", $EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@ -4054,10 +3833,7 @@ Basic usage:
assert!(!10", stringify!($SelfT), ".is_power_of_two());", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_is_power_of_two", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_is_power_of_two", since = "1.32.0")]
#[inline]
pub const fn is_power_of_two(self) -> bool {
self.count_ones() == 1
@ -4169,11 +3945,7 @@ let bytes = ", $swap_op, stringify!($SelfT), ".to_be_bytes();
assert_eq!(bytes, ", $be_bytes, ");
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
#[cfg_attr(
not(bootstrap),
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
)]
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
#[inline]
pub const fn to_be_bytes(self) -> [u8; mem::size_of::<Self>()] {
self.to_be().to_ne_bytes()
@ -4193,11 +3965,7 @@ let bytes = ", $swap_op, stringify!($SelfT), ".to_le_bytes();
assert_eq!(bytes, ", $le_bytes, ");
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
#[cfg_attr(
not(bootstrap),
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
)]
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
#[inline]
pub const fn to_le_bytes(self) -> [u8; mem::size_of::<Self>()] {
self.to_le().to_ne_bytes()
@ -4232,11 +4000,7 @@ assert_eq!(
);
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
#[cfg_attr(
not(bootstrap),
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
)]
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
#[inline]
pub const fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] {
// SAFETY: integers are plain old datatypes so we can always transmute them to
@ -4270,11 +4034,7 @@ fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT),
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
#[cfg_attr(
not(bootstrap),
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
)]
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
#[inline]
pub const fn from_be_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
Self::from_be(Self::from_ne_bytes(bytes))
@ -4307,11 +4067,7 @@ fn read_le_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT),
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
#[cfg_attr(
not(bootstrap),
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
)]
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
#[inline]
pub const fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
Self::from_le(Self::from_ne_bytes(bytes))
@ -4354,11 +4110,7 @@ fn read_ne_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT),
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
#[cfg_attr(
not(bootstrap),
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
)]
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
#[inline]
pub const fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
// SAFETY: integers are plain old datatypes so we can always transmute to them

View File

@ -530,10 +530,7 @@ assert_eq!(n.trailing_zeros(), 3);
/// assert_eq!(m, Wrapping(-22016));
/// ```
#[stable(feature = "reverse_bits", since = "1.37.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_reverse_bits", since = "1.37.0"),
)]
#[rustc_const_stable(feature = "const_reverse_bits", since = "1.37.0")]
#[inline]
#[must_use]
pub const fn reverse_bits(self) -> Self {

View File

@ -398,7 +398,7 @@ impl<Idx> RangeInclusive<Idx> {
#[stable(feature = "inclusive_range_methods", since = "1.27.0")]
#[inline]
#[rustc_promotable]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_range_new", since = "1.32.0"))]
#[rustc_const_stable(feature = "const_range_new", since = "1.32.0")]
pub const fn new(start: Idx, end: Idx) -> Self {
Self { start, end, is_empty: None }
}
@ -422,10 +422,7 @@ impl<Idx> RangeInclusive<Idx> {
/// assert_eq!((3..=5).start(), &3);
/// ```
#[stable(feature = "inclusive_range_methods", since = "1.27.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_inclusive_range_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_inclusive_range_methods", since = "1.32.0")]
#[inline]
pub const fn start(&self) -> &Idx {
&self.start
@ -450,10 +447,7 @@ impl<Idx> RangeInclusive<Idx> {
/// assert_eq!((3..=5).end(), &5);
/// ```
#[stable(feature = "inclusive_range_methods", since = "1.27.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_inclusive_range_methods", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_inclusive_range_methods", since = "1.32.0")]
#[inline]
pub const fn end(&self) -> &Idx {
&self.end

View File

@ -5,26 +5,23 @@
/// extracting those success or failure values from an existing instance and
/// creating a new instance from a success or failure value.
#[unstable(feature = "try_trait", issue = "42327")]
#[cfg_attr(
not(bootstrap),
rustc_on_unimplemented(
on(
all(
any(from_method = "from_error", from_method = "from_ok"),
from_desugaring = "QuestionMark"
),
message = "the `?` operator can only be used in {ItemContext} \
that returns `Result` or `Option` \
(or another type that implements `{Try}`)",
label = "cannot use the `?` operator in {ItemContext} that returns `{Self}`",
enclosing_scope = "this function should return `Result` or `Option` to accept `?`"
#[rustc_on_unimplemented(
on(
all(
any(from_method = "from_error", from_method = "from_ok"),
from_desugaring = "QuestionMark"
),
on(
all(from_method = "into_result", from_desugaring = "QuestionMark"),
message = "the `?` operator can only be applied to values \
that implement `{Try}`",
label = "the `?` operator cannot be applied to type `{Self}`"
)
message = "the `?` operator can only be used in {ItemContext} \
that returns `Result` or `Option` \
(or another type that implements `{Try}`)",
label = "cannot use the `?` operator in {ItemContext} that returns `{Self}`",
enclosing_scope = "this function should return `Result` or `Option` to accept `?`"
),
on(
all(from_method = "into_result", from_desugaring = "QuestionMark"),
message = "the `?` operator can only be applied to values \
that implement `{Try}`",
label = "the `?` operator cannot be applied to type `{Self}`"
)
)]
#[doc(alias = "?")]

View File

@ -222,7 +222,6 @@ impl<'a> Location<'a> {
/// assert_ne!(this_location.line(), another_location.line());
/// assert_ne!(this_location.column(), another_location.column());
/// ```
#[cfg(not(bootstrap))]
#[unstable(feature = "track_caller",
reason = "uses #[track_caller] which is not yet stable",
issue = "47809")]

View File

@ -198,7 +198,7 @@ unsafe fn real_drop_in_place<T: ?Sized>(to_drop: &mut T) {
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_ptr_null", since = "1.32.0"))]
#[rustc_const_stable(feature = "const_ptr_null", since = "1.32.0")]
pub const fn null<T>() -> *const T {
0 as *const T
}
@ -216,7 +216,7 @@ pub const fn null<T>() -> *const T {
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_ptr_null", since = "1.32.0"))]
#[rustc_const_stable(feature = "const_ptr_null", since = "1.32.0")]
pub const fn null_mut<T>() -> *mut T {
0 as *mut T
}
@ -1062,7 +1062,7 @@ impl<T: ?Sized> *const T {
/// Casts to a pointer of another type.
#[stable(feature = "ptr_cast", since = "1.38.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_ptr_cast", since = "1.38.0"))]
#[rustc_const_stable(feature = "const_ptr_cast", since = "1.38.0")]
#[inline]
pub const fn cast<U>(self) -> *const U {
self as _
@ -1310,11 +1310,7 @@ impl<T: ?Sized> *const T {
/// }
/// ```
#[unstable(feature = "ptr_offset_from", issue = "41079")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_ptr_offset_from"))]
#[cfg_attr(
not(bootstrap),
rustc_const_unstable(feature = "const_ptr_offset_from", issue = "41079"),
)]
#[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "41079")]
#[inline]
pub const unsafe fn offset_from(self, origin: *const T) -> isize
where
@ -1770,7 +1766,7 @@ impl<T: ?Sized> *mut T {
/// Casts to a pointer of another type.
#[stable(feature = "ptr_cast", since = "1.38.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_ptr_cast", since = "1.38.0"))]
#[rustc_const_stable(feature = "const_ptr_cast", since = "1.38.0")]
#[inline]
pub const fn cast<U>(self) -> *mut U {
self as _
@ -2057,11 +2053,7 @@ impl<T: ?Sized> *mut T {
/// }
/// ```
#[unstable(feature = "ptr_offset_from", issue = "41079")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_ptr_offset_from"))]
#[cfg_attr(
not(bootstrap),
rustc_const_unstable(feature = "const_ptr_offset_from", issue = "41079"),
)]
#[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "41079")]
#[inline]
pub const unsafe fn offset_from(self, origin: *const T) -> isize
where

View File

@ -66,10 +66,7 @@ impl<T: Sized> NonNull<T> {
/// sentinel value. Types that lazily allocate must track initialization by
/// some other means.
#[stable(feature = "nonnull", since = "1.25.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_nonnull_dangling", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_nonnull_dangling", since = "1.32.0")]
#[inline]
pub const fn dangling() -> Self {
unsafe {
@ -86,10 +83,7 @@ impl<T: ?Sized> NonNull<T> {
///
/// `ptr` must be non-null.
#[stable(feature = "nonnull", since = "1.25.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_nonnull_new_unchecked", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_nonnull_new_unchecked", since = "1.32.0")]
#[inline]
pub const unsafe fn new_unchecked(ptr: *mut T) -> Self {
NonNull { pointer: ptr as _ }
@ -104,10 +98,7 @@ impl<T: ?Sized> NonNull<T> {
/// Acquires the underlying `*mut` pointer.
#[stable(feature = "nonnull", since = "1.25.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_nonnull_as_ptr", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_nonnull_as_ptr", since = "1.32.0")]
#[inline]
pub const fn as_ptr(self) -> *mut T {
self.pointer as *mut T
@ -137,10 +128,7 @@ impl<T: ?Sized> NonNull<T> {
/// Casts to a pointer of another type.
#[stable(feature = "nonnull_cast", since = "1.27.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_nonnull_cast", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_nonnull_cast", since = "1.32.0")]
#[inline]
pub const fn cast<U>(self) -> NonNull<U> {
unsafe { NonNull::new_unchecked(self.as_ptr() as *mut U) }

View File

@ -62,7 +62,7 @@ impl<T> [T] {
/// assert_eq!(a.len(), 3);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_slice_len", since = "1.32.0"))]
#[rustc_const_stable(feature = "const_slice_len", since = "1.32.0")]
#[inline]
// SAFETY: const sound because we transmute out the length field as a usize (which it must be)
#[allow(unused_attributes)]
@ -82,10 +82,7 @@ impl<T> [T] {
/// assert!(!a.is_empty());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_slice_is_empty", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_slice_is_empty", since = "1.32.0")]
#[inline]
pub const fn is_empty(&self) -> bool {
self.len() == 0
@ -381,10 +378,7 @@ impl<T> [T] {
///
/// [`as_mut_ptr`]: #method.as_mut_ptr
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_slice_as_ptr", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_slice_as_ptr", since = "1.32.0")]
#[inline]
pub const fn as_ptr(&self) -> *const T {
self as *const [T] as *const T

View File

@ -2090,7 +2090,7 @@ impl str {
/// assert_eq!("ƒoo".chars().count(), 3);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_str_len", since = "1.32.0"))]
#[rustc_const_stable(feature = "const_str_len", since = "1.32.0")]
#[inline]
pub const fn len(&self) -> usize {
self.as_bytes().len()
@ -2111,10 +2111,7 @@ impl str {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
rustc_const_stable(feature = "const_str_is_empty", since = "1.32.0"),
)]
#[rustc_const_stable(feature = "const_str_is_empty", since = "1.32.0")]
pub const fn is_empty(&self) -> bool {
self.len() == 0
}
@ -2171,7 +2168,7 @@ impl str {
/// assert_eq!(b"bors", bytes);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "str_as_bytes", since = "1.32.0"))]
#[rustc_const_stable(feature = "str_as_bytes", since = "1.32.0")]
#[inline(always)]
// SAFETY: const sound because we transmute two types with the same layout
#[allow(unused_attributes)]
@ -2245,7 +2242,7 @@ impl str {
/// let ptr = s.as_ptr();
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "rustc_str_as_ptr", since = "1.32.0"))]
#[rustc_const_stable(feature = "rustc_str_as_ptr", since = "1.32.0")]
#[inline]
pub const fn as_ptr(&self) -> *const u8 {
self as *const str as *const u8

View File

@ -331,7 +331,7 @@ impl AtomicBool {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_atomic_new", since = "1.32.0"))]
#[rustc_const_stable(feature = "const_atomic_new", since = "1.32.0")]
pub const fn new(v: bool) -> AtomicBool {
AtomicBool { v: UnsafeCell::new(v as u8) }
}
@ -856,7 +856,7 @@ impl<T> AtomicPtr<T> {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_atomic_new", since = "1.32.0"))]
#[rustc_const_stable(feature = "const_atomic_new", since = "1.32.0")]
pub const fn new(p: *mut T) -> AtomicPtr<T> {
AtomicPtr { p: UnsafeCell::new(p) }
}
@ -1261,7 +1261,7 @@ let atomic_forty_two = ", stringify!($atomic_type), "::new(42);
```"),
#[inline]
#[$stable]
#[cfg_attr(not(bootstrap), $const_stable)]
#[$const_stable]
pub const fn new(v: $int_type) -> Self {
Self {v: UnsafeCell::new(v)}
}

View File

@ -39,7 +39,7 @@ impl RawWaker {
/// function in the `vtable` of the underlying `RawWaker` will be called.
#[rustc_promotable]
#[stable(feature = "futures_api", since = "1.36.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "futures_api", since = "1.36.0"))]
#[rustc_const_stable(feature = "futures_api", since = "1.36.0")]
pub const fn new(data: *const (), vtable: &'static RawWakerVTable) -> RawWaker {
RawWaker { data, vtable }
}
@ -152,7 +152,7 @@ impl RawWakerVTable {
// FIXME: remove whenever we have a stable way to accept fn pointers from const fn
// (see https://github.com/rust-rfcs/const-eval/issues/19#issuecomment-472799062)
#[rustc_allow_const_fn_ptr]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "futures_api", since = "1.36.0"))]
#[rustc_const_stable(feature = "futures_api", since = "1.36.0")]
pub const fn new(
clone: unsafe fn(*const ()) -> RawWaker,
wake: unsafe fn(*const ()),

View File

@ -130,7 +130,7 @@ impl Duration {
/// ```
#[stable(feature = "duration", since = "1.3.0")]
#[inline]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration_consts", since = "1.32.0"))]
#[rustc_const_stable(feature = "duration_consts", since = "1.32.0")]
pub fn new(secs: u64, nanos: u32) -> Duration {
let secs =
secs.checked_add((nanos / NANOS_PER_SEC) as u64).expect("overflow in Duration::new");
@ -153,7 +153,7 @@ impl Duration {
#[stable(feature = "duration", since = "1.3.0")]
#[inline]
#[rustc_promotable]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration_consts", since = "1.32.0"))]
#[rustc_const_stable(feature = "duration_consts", since = "1.32.0")]
pub const fn from_secs(secs: u64) -> Duration {
Duration { secs, nanos: 0 }
}
@ -173,7 +173,7 @@ impl Duration {
#[stable(feature = "duration", since = "1.3.0")]
#[inline]
#[rustc_promotable]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration_consts", since = "1.32.0"))]
#[rustc_const_stable(feature = "duration_consts", since = "1.32.0")]
pub const fn from_millis(millis: u64) -> Duration {
Duration {
secs: millis / MILLIS_PER_SEC,
@ -196,7 +196,7 @@ impl Duration {
#[stable(feature = "duration_from_micros", since = "1.27.0")]
#[inline]
#[rustc_promotable]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration_consts", since = "1.32.0"))]
#[rustc_const_stable(feature = "duration_consts", since = "1.32.0")]
pub const fn from_micros(micros: u64) -> Duration {
Duration {
secs: micros / MICROS_PER_SEC,
@ -219,7 +219,7 @@ impl Duration {
#[stable(feature = "duration_extras", since = "1.27.0")]
#[inline]
#[rustc_promotable]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration_consts", since = "1.32.0"))]
#[rustc_const_stable(feature = "duration_consts", since = "1.32.0")]
pub const fn from_nanos(nanos: u64) -> Duration {
Duration {
secs: nanos / (NANOS_PER_SEC as u64),
@ -256,7 +256,7 @@ impl Duration {
///
/// [`subsec_nanos`]: #method.subsec_nanos
#[stable(feature = "duration", since = "1.3.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration", since = "1.32.0"))]
#[rustc_const_stable(feature = "duration", since = "1.32.0")]
#[inline]
pub const fn as_secs(&self) -> u64 {
self.secs
@ -278,7 +278,7 @@ impl Duration {
/// assert_eq!(duration.subsec_millis(), 432);
/// ```
#[stable(feature = "duration_extras", since = "1.27.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration_extras", since = "1.32.0"))]
#[rustc_const_stable(feature = "duration_extras", since = "1.32.0")]
#[inline]
pub const fn subsec_millis(&self) -> u32 {
self.nanos / NANOS_PER_MILLI
@ -300,7 +300,7 @@ impl Duration {
/// assert_eq!(duration.subsec_micros(), 234_567);
/// ```
#[stable(feature = "duration_extras", since = "1.27.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration_extras", since = "1.32.0"))]
#[rustc_const_stable(feature = "duration_extras", since = "1.32.0")]
#[inline]
pub const fn subsec_micros(&self) -> u32 {
self.nanos / NANOS_PER_MICRO
@ -322,7 +322,7 @@ impl Duration {
/// assert_eq!(duration.subsec_nanos(), 10_000_000);
/// ```
#[stable(feature = "duration", since = "1.3.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration", since = "1.32.0"))]
#[rustc_const_stable(feature = "duration", since = "1.32.0")]
#[inline]
pub const fn subsec_nanos(&self) -> u32 {
self.nanos
@ -339,7 +339,7 @@ impl Duration {
/// assert_eq!(duration.as_millis(), 5730);
/// ```
#[stable(feature = "duration_as_u128", since = "1.33.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration_as_u128", since = "1.33.0"))]
#[rustc_const_stable(feature = "duration_as_u128", since = "1.33.0")]
#[inline]
pub const fn as_millis(&self) -> u128 {
self.secs as u128 * MILLIS_PER_SEC as u128 + (self.nanos / NANOS_PER_MILLI) as u128
@ -356,7 +356,7 @@ impl Duration {
/// assert_eq!(duration.as_micros(), 5730023);
/// ```
#[stable(feature = "duration_as_u128", since = "1.33.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration_as_u128", since = "1.33.0"))]
#[rustc_const_stable(feature = "duration_as_u128", since = "1.33.0")]
#[inline]
pub const fn as_micros(&self) -> u128 {
self.secs as u128 * MICROS_PER_SEC as u128 + (self.nanos / NANOS_PER_MICRO) as u128
@ -373,7 +373,7 @@ impl Duration {
/// assert_eq!(duration.as_nanos(), 5730023852);
/// ```
#[stable(feature = "duration_as_u128", since = "1.33.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration_as_u128", since = "1.33.0"))]
#[rustc_const_stable(feature = "duration_as_u128", since = "1.33.0")]
#[inline]
pub const fn as_nanos(&self) -> u128 {
self.secs as u128 * NANOS_PER_SEC as u128 + self.nanos as u128

View File

@ -76,9 +76,6 @@ pub fn encode_with_shorthand<E, T, M>(encoder: &mut E,
// The shorthand encoding uses the same usize as the
// discriminant, with an offset so they can't conflict.
#[cfg(bootstrap)]
let discriminant = unsafe { intrinsics::discriminant_value(variant) };
#[cfg(not(bootstrap))]
let discriminant = intrinsics::discriminant_value(variant);
assert!(discriminant < SHORTHAND_OFFSET as u64);
let shorthand = start + SHORTHAND_OFFSET;

View File

@ -1065,8 +1065,7 @@ impl CStr {
/// ```
#[inline]
#[stable(feature = "cstr_from_bytes", since = "1.10.0")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_cstr_unchecked"))]
#[cfg_attr(not(bootstrap), rustc_const_unstable(feature = "const_cstr_unchecked", issue = "0"))]
#[rustc_const_unstable(feature = "const_cstr_unchecked", issue = "0")]
pub const unsafe fn from_bytes_with_nul_unchecked(bytes: &[u8]) -> &CStr {
&*(bytes as *const [u8] as *const CStr)
}
@ -1120,7 +1119,7 @@ impl CStr {
/// [`CString`]: struct.CString.html
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_str_as_ptr", since = "1.32.0"))]
#[rustc_const_stable(feature = "const_str_as_ptr", since = "1.32.0")]
pub const fn as_ptr(&self) -> *const c_char {
self.inner.as_ptr()
}

View File

@ -283,7 +283,6 @@
#![feature(needs_panic_runtime)]
#![feature(never_type)]
#![feature(nll)]
#![cfg_attr(bootstrap, feature(on_unimplemented))]
#![feature(optin_builtin_traits)]
#![feature(panic_info_message)]
#![feature(panic_internals)]
@ -293,7 +292,6 @@
#![feature(raw)]
#![feature(renamed_spin_loop)]
#![feature(rustc_attrs)]
#![cfg_attr(bootstrap, feature(rustc_const_unstable))]
#![feature(rustc_private)]
#![feature(shrink_to)]
#![feature(slice_concat_ext)]

View File

@ -319,7 +319,7 @@ impl Ipv4Addr {
/// let addr = Ipv4Addr::new(127, 0, 0, 1);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_ipv4", since = "1.32.0"))]
#[rustc_const_stable(feature = "const_ipv4", since = "1.32.0")]
pub const fn new(a: u8, b: u8, c: u8, d: u8) -> Ipv4Addr {
// FIXME: should just be u32::from_be_bytes([a, b, c, d]),
// once that method is no longer rustc_const_unstable
@ -407,7 +407,7 @@ impl Ipv4Addr {
/// assert_eq!(Ipv4Addr::new(45, 22, 13, 197).is_unspecified(), false);
/// ```
#[stable(feature = "ip_shared", since = "1.12.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_ipv4", since = "1.32.0"))]
#[rustc_const_stable(feature = "const_ipv4", since = "1.32.0")]
pub const fn is_unspecified(&self) -> bool {
self.inner.s_addr == 0
}
@ -1017,7 +1017,7 @@ impl Ipv6Addr {
/// let addr = Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_ipv6", since = "1.32.0"))]
#[rustc_const_stable(feature = "const_ipv6", since = "1.32.0")]
pub const fn new(a: u16, b: u16, c: u16, d: u16, e: u16, f: u16,
g: u16, h: u16) -> Ipv6Addr {
Ipv6Addr {
@ -1483,7 +1483,7 @@ impl Ipv6Addr {
/// [255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
/// ```
#[stable(feature = "ipv6_to_octets", since = "1.12.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_ipv6", since = "1.32.0"))]
#[rustc_const_stable(feature = "const_ipv6", since = "1.32.0")]
pub const fn octets(&self) -> [u8; 16] {
self.inner.s6_addr
}

View File

@ -188,7 +188,7 @@ struct WaiterQueue<'a> {
impl Once {
/// Creates a new `Once` value.
#[stable(feature = "once_new", since = "1.2.0")]
#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_once_new", since = "1.32.0"))]
#[rustc_const_stable(feature = "const_once_new", since = "1.32.0")]
pub const fn new() -> Once {
Once { state_and_queue: AtomicUsize::new(INCOMPLETE), _marker: marker::PhantomData }
}

View File

@ -85,7 +85,6 @@ macro_rules! ast_fragments {
$($(AstFragment::$Kind(ast) => ast.extend(placeholders.iter().flat_map(|id| {
// We are repeating through arguments with `many`, to do that we have to
// mention some macro variable from those arguments even if it's not used.
#[cfg_attr(bootstrap, allow(unused_macros))]
macro _repeating($flat_map_ast_elt) {}
placeholder(AstFragmentKind::$Kind, *id, None).$make_ast()
})),)?)*

View File

@ -12,7 +12,7 @@
# source tarball for a stable release you'll likely see `1.x.0` for rustc and
# `0.x.0` for Cargo where they were released on `date`.
date: 2019-11-06
date: 2019-12-18
rustc: beta
cargo: beta

View File

@ -569,6 +569,7 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
list: false,
options: test::Options::new(),
time_options: None,
force_run_in_process: false,
}
}