Propagate cfg bootstrap
This commit is contained in:
parent
6a400ee149
commit
82184440ec
37 changed files with 169 additions and 541 deletions
|
@ -275,10 +275,7 @@ impl<T> LinkedList<T> {
|
||||||
/// let list: LinkedList<u32> = LinkedList::new();
|
/// let list: LinkedList<u32> = LinkedList::new();
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_linked_list_new", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_linked_list_new", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub const fn new() -> Self {
|
pub const fn new() -> Self {
|
||||||
LinkedList {
|
LinkedList {
|
||||||
|
|
|
@ -116,8 +116,6 @@
|
||||||
#![feature(unsize)]
|
#![feature(unsize)]
|
||||||
#![feature(unsized_locals)]
|
#![feature(unsized_locals)]
|
||||||
#![feature(allocator_internals)]
|
#![feature(allocator_internals)]
|
||||||
#![cfg_attr(bootstrap, feature(on_unimplemented))]
|
|
||||||
#![cfg_attr(bootstrap, feature(rustc_const_unstable))]
|
|
||||||
#![feature(slice_partition_dedup)]
|
#![feature(slice_partition_dedup)]
|
||||||
#![feature(maybe_uninit_extra, maybe_uninit_slice)]
|
#![feature(maybe_uninit_extra, maybe_uninit_slice)]
|
||||||
#![feature(alloc_layout_extra)]
|
#![feature(alloc_layout_extra)]
|
||||||
|
|
|
@ -367,10 +367,7 @@ impl String {
|
||||||
/// let s = String::new();
|
/// let s = String::new();
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_string_new", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_string_new", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub const fn new() -> String {
|
pub const fn new() -> String {
|
||||||
String { vec: Vec::new() }
|
String { vec: Vec::new() }
|
||||||
|
|
|
@ -315,10 +315,7 @@ impl<T> Vec<T> {
|
||||||
/// let mut vec: Vec<i32> = Vec::new();
|
/// let mut vec: Vec<i32> = Vec::new();
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_vec_new", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_vec_new", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub const fn new() -> Vec<T> {
|
pub const fn new() -> Vec<T> {
|
||||||
Vec {
|
Vec {
|
||||||
|
|
|
@ -100,7 +100,7 @@ impl Layout {
|
||||||
/// This function is unsafe as it does not verify the preconditions from
|
/// This function is unsafe as it does not verify the preconditions from
|
||||||
/// [`Layout::from_size_align`](#method.from_size_align).
|
/// [`Layout::from_size_align`](#method.from_size_align).
|
||||||
#[stable(feature = "alloc_layout", since = "1.28.0")]
|
#[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]
|
#[inline]
|
||||||
pub const unsafe fn from_size_align_unchecked(size: usize, align: usize) -> Self {
|
pub const unsafe fn from_size_align_unchecked(size: usize, align: usize) -> Self {
|
||||||
Layout { size_: size, align_: NonZeroUsize::new_unchecked(align) }
|
Layout { size_: size, align_: NonZeroUsize::new_unchecked(align) }
|
||||||
|
|
|
@ -423,14 +423,9 @@ impl TypeId {
|
||||||
/// assert_eq!(is_string(&"cookie monster".to_string()), true);
|
/// assert_eq!(is_string(&"cookie monster".to_string()), true);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature="const_type_id"))]
|
#[rustc_const_unstable(feature="const_type_id", issue = "41875")]
|
||||||
#[cfg_attr(not(bootstrap), rustc_const_unstable(feature="const_type_id", issue = "41875"))]
|
|
||||||
pub const fn of<T: ?Sized + 'static>() -> TypeId {
|
pub const fn of<T: ?Sized + 'static>() -> TypeId {
|
||||||
TypeId {
|
TypeId {
|
||||||
#[cfg(bootstrap)]
|
|
||||||
// SAFETY: going away soon
|
|
||||||
t: unsafe { intrinsics::type_id::<T>() },
|
|
||||||
#[cfg(not(bootstrap))]
|
|
||||||
t: intrinsics::type_id::<T>(),
|
t: intrinsics::type_id::<T>(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -462,8 +457,7 @@ impl TypeId {
|
||||||
/// );
|
/// );
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "type_name", since = "1.38.0")]
|
#[stable(feature = "type_name", since = "1.38.0")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_type_name"))]
|
#[rustc_const_unstable(feature = "const_type_name", issue = "63084")]
|
||||||
#[cfg_attr(not(bootstrap), rustc_const_unstable(feature = "const_type_name", issue = "63084"))]
|
|
||||||
pub const fn type_name<T: ?Sized>() -> &'static str {
|
pub const fn type_name<T: ?Sized>() -> &'static str {
|
||||||
intrinsics::type_name::<T>()
|
intrinsics::type_name::<T>()
|
||||||
}
|
}
|
||||||
|
@ -501,8 +495,7 @@ pub const fn type_name<T: ?Sized>() -> &'static str {
|
||||||
/// println!("{}", type_name_of_val(&y));
|
/// println!("{}", type_name_of_val(&y));
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "type_name_of_val", issue = "66359")]
|
#[unstable(feature = "type_name_of_val", issue = "66359")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_type_name"))]
|
#[rustc_const_unstable(feature = "const_type_name", issue = "63084")]
|
||||||
#[cfg_attr(not(bootstrap), rustc_const_unstable(feature = "const_type_name", issue = "63084"))]
|
|
||||||
pub const fn type_name_of_val<T: ?Sized>(val: &T) -> &'static str {
|
pub const fn type_name_of_val<T: ?Sized>(val: &T) -> &'static str {
|
||||||
let _ = val;
|
let _ = val;
|
||||||
type_name::<T>()
|
type_name::<T>()
|
||||||
|
|
|
@ -324,7 +324,7 @@ impl<T> Cell<T> {
|
||||||
/// let c = Cell::new(5);
|
/// let c = Cell::new(5);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[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]
|
#[inline]
|
||||||
pub const fn new(value: T) -> Cell<T> {
|
pub const fn new(value: T) -> Cell<T> {
|
||||||
Cell {
|
Cell {
|
||||||
|
@ -470,7 +470,7 @@ impl<T: ?Sized> Cell<T> {
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "cell_as_ptr", since = "1.12.0")]
|
#[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 {
|
pub const fn as_ptr(&self) -> *mut T {
|
||||||
self.value.get()
|
self.value.get()
|
||||||
}
|
}
|
||||||
|
@ -651,7 +651,7 @@ impl<T> RefCell<T> {
|
||||||
/// let c = RefCell::new(5);
|
/// let c = RefCell::new(5);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[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]
|
#[inline]
|
||||||
pub const fn new(value: T) -> RefCell<T> {
|
pub const fn new(value: T) -> RefCell<T> {
|
||||||
RefCell {
|
RefCell {
|
||||||
|
@ -1504,10 +1504,7 @@ impl<T> UnsafeCell<T> {
|
||||||
/// let uc = UnsafeCell::new(5);
|
/// let uc = UnsafeCell::new(5);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_unsafe_cell_new", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_unsafe_cell_new", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn new(value: T) -> UnsafeCell<T> {
|
pub const fn new(value: T) -> UnsafeCell<T> {
|
||||||
UnsafeCell { value }
|
UnsafeCell { value }
|
||||||
|
@ -1550,10 +1547,7 @@ impl<T: ?Sized> UnsafeCell<T> {
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_unsafecell_get", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_unsafecell_get", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
pub const fn get(&self) -> *mut T {
|
pub const fn get(&self) -> *mut T {
|
||||||
// We can just cast the pointer from `UnsafeCell<T>` to `T` because of
|
// We can just cast the pointer from `UnsafeCell<T>` to `T` because of
|
||||||
// #[repr(transparent)]. This exploits libstd's special status, there is
|
// #[repr(transparent)]. This exploits libstd's special status, there is
|
||||||
|
|
|
@ -911,10 +911,7 @@ impl char {
|
||||||
/// assert!(!non_ascii.is_ascii());
|
/// assert!(!non_ascii.is_ascii());
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
|
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_ascii_methods_on_intrinsics", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_ascii_methods_on_intrinsics", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn is_ascii(&self) -> bool {
|
pub const fn is_ascii(&self) -> bool {
|
||||||
*self as u32 <= 0x7F
|
*self as u32 <= 0x7F
|
||||||
|
|
|
@ -101,7 +101,7 @@ pub use num::FloatToInt;
|
||||||
/// assert_eq!(vec![1, 3], filtered);
|
/// assert_eq!(vec![1, 3], filtered);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "convert_id", since = "1.33.0")]
|
#[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]
|
#[inline]
|
||||||
pub const fn identity<T>(x: T) -> T {
|
pub const fn identity<T>(x: T) -> T {
|
||||||
x
|
x
|
||||||
|
|
|
@ -13,7 +13,6 @@ mod private {
|
||||||
/// Typically doesn’t need to be used directly.
|
/// Typically doesn’t need to be used directly.
|
||||||
#[unstable(feature = "convert_float_to_int", issue = "67057")]
|
#[unstable(feature = "convert_float_to_int", issue = "67057")]
|
||||||
pub trait FloatToInt<Int>: private::Sealed + Sized {
|
pub trait FloatToInt<Int>: private::Sealed + Sized {
|
||||||
#[cfg(not(bootstrap))]
|
|
||||||
#[unstable(feature = "float_approx_unchecked_to", issue = "67058")]
|
#[unstable(feature = "float_approx_unchecked_to", issue = "67058")]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
unsafe fn approx_unchecked(self) -> Int;
|
unsafe fn approx_unchecked(self) -> Int;
|
||||||
|
@ -26,7 +25,6 @@ macro_rules! impl_float_to_int {
|
||||||
$(
|
$(
|
||||||
#[unstable(feature = "convert_float_to_int", issue = "67057")]
|
#[unstable(feature = "convert_float_to_int", issue = "67057")]
|
||||||
impl FloatToInt<$Int> for $Float {
|
impl FloatToInt<$Int> for $Float {
|
||||||
#[cfg(not(bootstrap))]
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn approx_unchecked(self) -> $Int {
|
unsafe fn approx_unchecked(self) -> $Int {
|
||||||
|
|
|
@ -939,11 +939,7 @@ extern "rust-intrinsic" {
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_transmute"))]
|
#[rustc_const_unstable(feature = "const_transmute", issue = "53605")]
|
||||||
#[cfg_attr(
|
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_unstable(feature = "const_transmute", issue = "53605"),
|
|
||||||
)]
|
|
||||||
pub fn transmute<T, U>(e: T) -> U;
|
pub fn transmute<T, U>(e: T) -> U;
|
||||||
|
|
||||||
/// Returns `true` if the actual type given as `T` requires drop
|
/// Returns `true` if the actual type given as `T` requires drop
|
||||||
|
@ -1150,7 +1146,6 @@ extern "rust-intrinsic" {
|
||||||
|
|
||||||
/// Convert with LLVM’s fptoui/fptosi, which may return undef for values out of range
|
/// Convert with LLVM’s fptoui/fptosi, which may return undef for values out of range
|
||||||
/// https://github.com/rust-lang/rust/issues/10184
|
/// https://github.com/rust-lang/rust/issues/10184
|
||||||
#[cfg(not(bootstrap))]
|
|
||||||
pub fn float_to_int_approx_unchecked<Float, Int>(value: Float) -> Int;
|
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.
|
/// Compiles to a NOP during non-Miri codegen.
|
||||||
///
|
///
|
||||||
/// Perma-unstable: do not use
|
/// Perma-unstable: do not use
|
||||||
#[cfg(not(bootstrap))]
|
|
||||||
pub fn miri_start_panic(data: *mut (dyn crate::any::Any + crate::marker::Send)) -> ();
|
pub fn miri_start_panic(data: *mut (dyn crate::any::Any + crate::marker::Send)) -> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -517,14 +517,6 @@ impl<I> Iterator for StepBy<I> where I: Iterator {
|
||||||
// overflow handling
|
// overflow handling
|
||||||
loop {
|
loop {
|
||||||
let mul = n.checked_mul(step);
|
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()) {
|
if intrinsics::likely(mul.is_some()) {
|
||||||
return self.iter.nth(mul.unwrap() - 1);
|
return self.iter.nth(mul.unwrap() - 1);
|
||||||
|
|
|
@ -281,7 +281,7 @@ impl<T> Default for Empty<T> {
|
||||||
/// assert_eq!(None, nope.next());
|
/// assert_eq!(None, nope.next());
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "iter_empty", since = "1.2.0")]
|
#[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> {
|
pub const fn empty<T>() -> Empty<T> {
|
||||||
Empty(marker::PhantomData)
|
Empty(marker::PhantomData)
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,8 +74,8 @@
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn)]
|
||||||
#![feature(const_fn_union)]
|
#![feature(const_fn_union)]
|
||||||
#![feature(const_generics)]
|
#![feature(const_generics)]
|
||||||
#![cfg_attr(not(bootstrap), feature(const_ptr_offset_from))]
|
#![feature(const_ptr_offset_from)]
|
||||||
#![cfg_attr(not(bootstrap), feature(const_type_name))]
|
#![feature(const_type_name)]
|
||||||
#![feature(custom_inner_attributes)]
|
#![feature(custom_inner_attributes)]
|
||||||
#![feature(decl_macro)]
|
#![feature(decl_macro)]
|
||||||
#![feature(doc_cfg)]
|
#![feature(doc_cfg)]
|
||||||
|
@ -91,18 +91,16 @@
|
||||||
#![feature(nll)]
|
#![feature(nll)]
|
||||||
#![feature(exhaustive_patterns)]
|
#![feature(exhaustive_patterns)]
|
||||||
#![feature(no_core)]
|
#![feature(no_core)]
|
||||||
#![cfg_attr(bootstrap, feature(on_unimplemented))]
|
|
||||||
#![feature(optin_builtin_traits)]
|
#![feature(optin_builtin_traits)]
|
||||||
#![feature(prelude_import)]
|
#![feature(prelude_import)]
|
||||||
#![feature(repr_simd, platform_intrinsics)]
|
#![feature(repr_simd, platform_intrinsics)]
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
#![cfg_attr(bootstrap, feature(rustc_const_unstable))]
|
|
||||||
#![feature(simd_ffi)]
|
#![feature(simd_ffi)]
|
||||||
#![feature(specialization)]
|
#![feature(specialization)]
|
||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
#![feature(std_internals)]
|
#![feature(std_internals)]
|
||||||
#![feature(stmt_expr_attributes)]
|
#![feature(stmt_expr_attributes)]
|
||||||
#![cfg_attr(not(bootstrap), feature(track_caller))]
|
#![feature(track_caller)]
|
||||||
#![feature(transparent_unions)]
|
#![feature(transparent_unions)]
|
||||||
#![feature(unboxed_closures)]
|
#![feature(unboxed_closures)]
|
||||||
#![feature(unsized_locals)]
|
#![feature(unsized_locals)]
|
||||||
|
|
|
@ -63,10 +63,7 @@ impl<T> ManuallyDrop<T> {
|
||||||
/// ManuallyDrop::new(Box::new(()));
|
/// ManuallyDrop::new(Box::new(()));
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "manually_drop", since = "1.20.0")]
|
#[stable(feature = "manually_drop", since = "1.20.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_manually_drop", since = "1.36.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_manually_drop", since = "1.36.0"),
|
|
||||||
)]
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub const fn new(value: T) -> ManuallyDrop<T> {
|
pub const fn new(value: T) -> ManuallyDrop<T> {
|
||||||
ManuallyDrop { value }
|
ManuallyDrop { value }
|
||||||
|
@ -84,10 +81,7 @@ impl<T> ManuallyDrop<T> {
|
||||||
/// let _: Box<()> = ManuallyDrop::into_inner(x); // This drops the `Box`.
|
/// let _: Box<()> = ManuallyDrop::into_inner(x); // This drops the `Box`.
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "manually_drop", since = "1.20.0")]
|
#[stable(feature = "manually_drop", since = "1.20.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_manually_drop", since = "1.36.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_manually_drop", since = "1.36.0"),
|
|
||||||
)]
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub const fn into_inner(slot: ManuallyDrop<T>) -> T {
|
pub const fn into_inner(slot: ManuallyDrop<T>) -> T {
|
||||||
slot.value
|
slot.value
|
||||||
|
|
|
@ -250,10 +250,7 @@ impl<T> MaybeUninit<T> {
|
||||||
///
|
///
|
||||||
/// [`assume_init`]: #method.assume_init
|
/// [`assume_init`]: #method.assume_init
|
||||||
#[stable(feature = "maybe_uninit", since = "1.36.0")]
|
#[stable(feature = "maybe_uninit", since = "1.36.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_maybe_uninit", since = "1.36.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_maybe_uninit", since = "1.36.0"),
|
|
||||||
)]
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub const fn new(val: T) -> MaybeUninit<T> {
|
pub const fn new(val: T) -> MaybeUninit<T> {
|
||||||
MaybeUninit { value: ManuallyDrop::new(val) }
|
MaybeUninit { value: ManuallyDrop::new(val) }
|
||||||
|
@ -268,12 +265,9 @@ impl<T> MaybeUninit<T> {
|
||||||
///
|
///
|
||||||
/// [type]: union.MaybeUninit.html
|
/// [type]: union.MaybeUninit.html
|
||||||
#[stable(feature = "maybe_uninit", since = "1.36.0")]
|
#[stable(feature = "maybe_uninit", since = "1.36.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_maybe_uninit", since = "1.36.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_maybe_uninit", since = "1.36.0"),
|
|
||||||
)]
|
|
||||||
#[inline(always)]
|
#[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> {
|
pub const fn uninit() -> MaybeUninit<T> {
|
||||||
MaybeUninit { uninit: () }
|
MaybeUninit { uninit: () }
|
||||||
}
|
}
|
||||||
|
@ -357,7 +351,7 @@ impl<T> MaybeUninit<T> {
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "maybe_uninit", since = "1.36.0")]
|
#[stable(feature = "maybe_uninit", since = "1.36.0")]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[cfg_attr(all(not(bootstrap)), rustc_diagnostic_item = "maybe_uninit_zeroed")]
|
#[rustc_diagnostic_item = "maybe_uninit_zeroed"]
|
||||||
pub fn zeroed() -> MaybeUninit<T> {
|
pub fn zeroed() -> MaybeUninit<T> {
|
||||||
let mut u = MaybeUninit::<T>::uninit();
|
let mut u = MaybeUninit::<T>::uninit();
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -498,7 +492,7 @@ impl<T> MaybeUninit<T> {
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "maybe_uninit", since = "1.36.0")]
|
#[stable(feature = "maybe_uninit", since = "1.36.0")]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[cfg_attr(all(not(bootstrap)), rustc_diagnostic_item = "assume_init")]
|
#[rustc_diagnostic_item = "assume_init"]
|
||||||
pub unsafe fn assume_init(self) -> T {
|
pub unsafe fn assume_init(self) -> T {
|
||||||
intrinsics::panic_if_uninhabited::<T>();
|
intrinsics::panic_if_uninhabited::<T>();
|
||||||
ManuallyDrop::into_inner(self.value)
|
ManuallyDrop::into_inner(self.value)
|
||||||
|
|
|
@ -271,7 +271,7 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_promotable]
|
#[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 {
|
pub const fn size_of<T>() -> usize {
|
||||||
intrinsics::size_of::<T>()
|
intrinsics::size_of::<T>()
|
||||||
}
|
}
|
||||||
|
@ -299,10 +299,6 @@ pub const fn size_of<T>() -> usize {
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub fn size_of_val<T: ?Sized>(val: &T) -> usize {
|
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)
|
intrinsics::size_of_val(val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,10 +343,6 @@ pub fn min_align_of<T>() -> usize {
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_deprecated(reason = "use `align_of_val` instead", since = "1.2.0")]
|
#[rustc_deprecated(reason = "use `align_of_val` instead", since = "1.2.0")]
|
||||||
pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
|
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)
|
intrinsics::min_align_of_val(val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +364,7 @@ pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_promotable]
|
#[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 {
|
pub const fn align_of<T>() -> usize {
|
||||||
intrinsics::min_align_of::<T>()
|
intrinsics::min_align_of::<T>()
|
||||||
}
|
}
|
||||||
|
@ -455,7 +447,7 @@ pub fn align_of_val<T: ?Sized>(val: &T) -> usize {
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "needs_drop", since = "1.21.0")]
|
#[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 {
|
pub const fn needs_drop<T>() -> bool {
|
||||||
intrinsics::needs_drop::<T>()
|
intrinsics::needs_drop::<T>()
|
||||||
}
|
}
|
||||||
|
@ -501,7 +493,7 @@ pub const fn needs_drop<T>() -> bool {
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[allow(deprecated_in_future)]
|
#[allow(deprecated_in_future)]
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
#[cfg_attr(all(not(bootstrap)), rustc_diagnostic_item = "mem_zeroed")]
|
#[rustc_diagnostic_item = "mem_zeroed"]
|
||||||
pub unsafe fn zeroed<T>() -> T {
|
pub unsafe fn zeroed<T>() -> T {
|
||||||
intrinsics::panic_if_uninhabited::<T>();
|
intrinsics::panic_if_uninhabited::<T>();
|
||||||
intrinsics::init()
|
intrinsics::init()
|
||||||
|
@ -534,7 +526,7 @@ pub unsafe fn zeroed<T>() -> T {
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[allow(deprecated_in_future)]
|
#[allow(deprecated_in_future)]
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
#[cfg_attr(all(not(bootstrap)), rustc_diagnostic_item = "mem_uninitialized")]
|
#[rustc_diagnostic_item = "mem_uninitialized"]
|
||||||
pub unsafe fn uninitialized<T>() -> T {
|
pub unsafe fn uninitialized<T>() -> T {
|
||||||
intrinsics::panic_if_uninhabited::<T>();
|
intrinsics::panic_if_uninhabited::<T>();
|
||||||
intrinsics::uninit()
|
intrinsics::uninit()
|
||||||
|
@ -874,11 +866,5 @@ impl<T> fmt::Debug for Discriminant<T> {
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "discriminant_value", since = "1.21.0")]
|
#[stable(feature = "discriminant_value", since = "1.21.0")]
|
||||||
pub fn discriminant<T>(v: &T) -> Discriminant<T> {
|
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)
|
Discriminant(intrinsics::discriminant_value(v), PhantomData)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
#![stable(feature = "rust1", since = "1.0.0")]
|
#![stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
|
||||||
#[cfg(not(bootstrap))]
|
|
||||||
use crate::convert::FloatToInt;
|
use crate::convert::FloatToInt;
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
use crate::intrinsics;
|
use crate::intrinsics;
|
||||||
|
@ -423,7 +422,6 @@ impl f32 {
|
||||||
/// * Not be `NaN`
|
/// * Not be `NaN`
|
||||||
/// * Not be infinite
|
/// * Not be infinite
|
||||||
/// * Be representable in the return type `Int`, after truncating off its fractional part
|
/// * Be representable in the return type `Int`, after truncating off its fractional part
|
||||||
#[cfg(not(bootstrap))]
|
|
||||||
#[unstable(feature = "float_approx_unchecked_to", issue = "67058")]
|
#[unstable(feature = "float_approx_unchecked_to", issue = "67058")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn approx_unchecked_to<Int>(self) -> Int where Self: FloatToInt<Int> {
|
pub unsafe fn approx_unchecked_to<Int>(self) -> Int where Self: FloatToInt<Int> {
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
#![stable(feature = "rust1", since = "1.0.0")]
|
#![stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
|
||||||
#[cfg(not(bootstrap))]
|
|
||||||
use crate::convert::FloatToInt;
|
use crate::convert::FloatToInt;
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
use crate::intrinsics;
|
use crate::intrinsics;
|
||||||
|
@ -436,7 +435,6 @@ impl f64 {
|
||||||
/// * Not be `NaN`
|
/// * Not be `NaN`
|
||||||
/// * Not be infinite
|
/// * Not be infinite
|
||||||
/// * Be representable in the return type `Int`, after truncating off its fractional part
|
/// * Be representable in the return type `Int`, after truncating off its fractional part
|
||||||
#[cfg(not(bootstrap))]
|
|
||||||
#[unstable(feature = "float_approx_unchecked_to", issue = "67058")]
|
#[unstable(feature = "float_approx_unchecked_to", issue = "67058")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn approx_unchecked_to<Int>(self) -> Int
|
pub unsafe fn approx_unchecked_to<Int>(self) -> Int
|
||||||
|
|
|
@ -61,10 +61,7 @@ assert_eq!(size_of::<Option<core::num::", stringify!($Ty), ">>(), size_of::<", s
|
||||||
///
|
///
|
||||||
/// The value must not be zero.
|
/// The value must not be zero.
|
||||||
#[$stability]
|
#[$stability]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "nonzero", since = "1.34.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "nonzero", since = "1.34.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const unsafe fn new_unchecked(n: $Int) -> Self {
|
pub const unsafe fn new_unchecked(n: $Int) -> Self {
|
||||||
Self(n)
|
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.
|
/// Returns the value as a primitive type.
|
||||||
#[$stability]
|
#[$stability]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "nonzero", since = "1.34.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "nonzero", since = "1.34.0"),
|
|
||||||
)]
|
|
||||||
pub const fn get(self) -> $Int {
|
pub const fn get(self) -> $Int {
|
||||||
self.0
|
self.0
|
||||||
}
|
}
|
||||||
|
@ -264,10 +258,7 @@ $EndFeature, "
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[rustc_promotable]
|
#[rustc_promotable]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_min_value", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_min_value", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
pub const fn min_value() -> Self {
|
pub const fn min_value() -> Self {
|
||||||
!0 ^ ((!0 as $UnsignedT) >> 1) as Self
|
!0 ^ ((!0 as $UnsignedT) >> 1) as Self
|
||||||
}
|
}
|
||||||
|
@ -287,10 +278,7 @@ $EndFeature, "
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[rustc_promotable]
|
#[rustc_promotable]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_max_value", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_max_value", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
pub const fn max_value() -> Self {
|
pub const fn max_value() -> Self {
|
||||||
!Self::min_value()
|
!Self::min_value()
|
||||||
}
|
}
|
||||||
|
@ -340,10 +328,7 @@ $EndFeature, "
|
||||||
```
|
```
|
||||||
"),
|
"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn count_ones(self) -> u32 { (self as $UnsignedT).count_ones() }
|
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, "
|
", $Feature, "assert_eq!(", stringify!($SelfT), "::max_value().count_zeros(), 1);", $EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn count_zeros(self) -> u32 {
|
pub const fn count_zeros(self) -> u32 {
|
||||||
(!self).count_ones()
|
(!self).count_ones()
|
||||||
|
@ -383,10 +365,7 @@ assert_eq!(n.leading_zeros(), 0);",
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn leading_zeros(self) -> u32 {
|
pub const fn leading_zeros(self) -> u32 {
|
||||||
(self as $UnsignedT).leading_zeros()
|
(self as $UnsignedT).leading_zeros()
|
||||||
|
@ -407,10 +386,7 @@ assert_eq!(n.trailing_zeros(), 2);",
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn trailing_zeros(self) -> u32 {
|
pub const fn trailing_zeros(self) -> u32 {
|
||||||
(self as $UnsignedT).trailing_zeros()
|
(self as $UnsignedT).trailing_zeros()
|
||||||
|
@ -434,10 +410,7 @@ let m = ", $rot_result, ";
|
||||||
assert_eq!(n.rotate_left(", $rot, "), m);
|
assert_eq!(n.rotate_left(", $rot, "), m);
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -464,10 +437,7 @@ let m = ", $rot_op, ";
|
||||||
assert_eq!(n.rotate_right(", $rot, "), m);
|
assert_eq!(n.rotate_right(", $rot, "), m);
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -491,10 +461,7 @@ let m = n.swap_bytes();
|
||||||
assert_eq!(m, ", $swapped, ");
|
assert_eq!(m, ", $swapped, ");
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn swap_bytes(self) -> Self {
|
pub const fn swap_bytes(self) -> Self {
|
||||||
(self as $UnsignedT).swap_bytes() as Self
|
(self as $UnsignedT).swap_bytes() as Self
|
||||||
|
@ -515,10 +482,7 @@ let m = n.reverse_bits();
|
||||||
assert_eq!(m, ", $reversed, ");
|
assert_eq!(m, ", $reversed, ");
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "reverse_bits", since = "1.37.0")]
|
#[stable(feature = "reverse_bits", since = "1.37.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub const fn reverse_bits(self) -> Self {
|
pub const fn reverse_bits(self) -> Self {
|
||||||
|
@ -546,10 +510,7 @@ if cfg!(target_endian = \"big\") {
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_conversions", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_conversions", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn from_be(x: Self) -> Self {
|
pub const fn from_be(x: Self) -> Self {
|
||||||
#[cfg(target_endian = "big")]
|
#[cfg(target_endian = "big")]
|
||||||
|
@ -583,10 +544,7 @@ if cfg!(target_endian = \"little\") {
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_conversions", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_conversions", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn from_le(x: Self) -> Self {
|
pub const fn from_le(x: Self) -> Self {
|
||||||
#[cfg(target_endian = "little")]
|
#[cfg(target_endian = "little")]
|
||||||
|
@ -620,10 +578,7 @@ if cfg!(target_endian = \"big\") {
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_conversions", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_conversions", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn to_be(self) -> Self { // or not to be?
|
pub const fn to_be(self) -> Self { // or not to be?
|
||||||
#[cfg(target_endian = "big")]
|
#[cfg(target_endian = "big")]
|
||||||
|
@ -657,10 +612,7 @@ if cfg!(target_endian = \"little\") {
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_conversions", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_conversions", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn to_le(self) -> Self {
|
pub const fn to_le(self) -> Self {
|
||||||
#[cfg(target_endian = "little")]
|
#[cfg(target_endian = "little")]
|
||||||
|
@ -1013,11 +965,7 @@ $EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_saturating_int_methods"))]
|
#[rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718")]
|
||||||
#[cfg_attr(
|
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1043,11 +991,7 @@ assert_eq!(", stringify!($SelfT), "::max_value().saturating_sub(-1), ", stringif
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_saturating_int_methods"))]
|
#[rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718")]
|
||||||
#[cfg_attr(
|
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1187,10 +1131,7 @@ assert_eq!(", stringify!($SelfT), "::max_value().wrapping_add(2), ", stringify!(
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1214,10 +1155,7 @@ stringify!($SelfT), "::max_value());",
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1240,10 +1178,7 @@ assert_eq!(11i8.wrapping_mul(12), -124);",
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1388,10 +1323,7 @@ assert_eq!(", stringify!($SelfT), "::min_value().wrapping_neg(), ", stringify!($
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "num_wrapping", since = "1.2.0")]
|
#[stable(feature = "num_wrapping", since = "1.2.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn wrapping_neg(self) -> Self {
|
pub const fn wrapping_neg(self) -> Self {
|
||||||
self.overflowing_neg().0
|
self.overflowing_neg().0
|
||||||
|
@ -1417,10 +1349,7 @@ assert_eq!((-1", stringify!($SelfT), ").wrapping_shl(128), -1);",
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "num_wrapping", since = "1.2.0")]
|
#[stable(feature = "num_wrapping", since = "1.2.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1452,10 +1381,7 @@ assert_eq!((-128i16).wrapping_shr(64), -128);",
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "num_wrapping", since = "1.2.0")]
|
#[stable(feature = "num_wrapping", since = "1.2.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1489,10 +1415,7 @@ assert_eq!((-128i8).wrapping_abs() as u8, 128);",
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "no_panic_abs", since = "1.13.0")]
|
#[stable(feature = "no_panic_abs", since = "1.13.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn wrapping_abs(self) -> Self {
|
pub const fn wrapping_abs(self) -> Self {
|
||||||
// sign is -1 (all ones) for negative numbers, 0 otherwise.
|
// 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, "
|
"::MIN, true));", $EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1598,10 +1518,7 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_sub(1), (", stringify!($Sel
|
||||||
"::MAX, true));", $EndFeature, "
|
"::MAX, true));", $EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1627,10 +1544,7 @@ assert_eq!(1_000_000_000i32.overflowing_mul(10), (1410065408, true));",
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1798,10 +1712,7 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_neg(), (", stringify!($Self
|
||||||
```"),
|
```"),
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
pub const fn overflowing_neg(self) -> (Self, bool) {
|
pub const fn overflowing_neg(self) -> (Self, bool) {
|
||||||
((!self).wrapping_add(1), self == Self::min_value())
|
((!self).wrapping_add(1), self == Self::min_value())
|
||||||
}
|
}
|
||||||
|
@ -1824,10 +1735,7 @@ assert_eq!(0x1i32.overflowing_shl(36), (0x10, true));",
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1853,10 +1761,7 @@ assert_eq!(0x10i32.overflowing_shr(36), (0x1, true));",
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1885,10 +1790,7 @@ assert_eq!((", stringify!($SelfT), "::min_value()).overflowing_abs(), (", string
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "no_panic_abs", since = "1.13.0")]
|
#[stable(feature = "no_panic_abs", since = "1.13.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn overflowing_abs(self) -> (Self, bool) {
|
pub const fn overflowing_abs(self) -> (Self, bool) {
|
||||||
(self.wrapping_abs(), self == Self::min_value())
|
(self.wrapping_abs(), self == Self::min_value())
|
||||||
|
@ -2093,10 +1995,7 @@ assert_eq!((-10", stringify!($SelfT), ").abs(), 10);",
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[rustc_inherit_overflow_checks]
|
#[rustc_inherit_overflow_checks]
|
||||||
pub const fn abs(self) -> Self {
|
pub const fn abs(self) -> Self {
|
||||||
|
@ -2139,11 +2038,7 @@ assert_eq!((-10", stringify!($SelfT), ").signum(), -1);",
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_sign"))]
|
#[rustc_const_unstable(feature = "const_int_sign", issue = "53718")]
|
||||||
#[cfg_attr(
|
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_unstable(feature = "const_int_sign", issue = "53718"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn signum(self) -> Self {
|
pub const fn signum(self) -> Self {
|
||||||
(self > 0) as Self - (self < 0) as Self
|
(self > 0) as Self - (self < 0) as Self
|
||||||
|
@ -2164,10 +2059,7 @@ assert!(!(-10", stringify!($SelfT), ").is_positive());",
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn is_positive(self) -> bool { self > 0 }
|
pub const fn is_positive(self) -> bool { self > 0 }
|
||||||
}
|
}
|
||||||
|
@ -2186,10 +2078,7 @@ assert!(!10", stringify!($SelfT), ".is_negative());",
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn is_negative(self) -> bool { self < 0 }
|
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, ");
|
assert_eq!(bytes, ", $be_bytes, ");
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
|
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
|
||||||
#[cfg_attr(
|
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn to_be_bytes(self) -> [u8; mem::size_of::<Self>()] {
|
pub const fn to_be_bytes(self) -> [u8; mem::size_of::<Self>()] {
|
||||||
self.to_be().to_ne_bytes()
|
self.to_be().to_ne_bytes()
|
||||||
|
@ -2231,11 +2116,7 @@ let bytes = ", $swap_op, stringify!($SelfT), ".to_le_bytes();
|
||||||
assert_eq!(bytes, ", $le_bytes, ");
|
assert_eq!(bytes, ", $le_bytes, ");
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
|
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
|
||||||
#[cfg_attr(
|
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn to_le_bytes(self) -> [u8; mem::size_of::<Self>()] {
|
pub const fn to_le_bytes(self) -> [u8; mem::size_of::<Self>()] {
|
||||||
self.to_le().to_ne_bytes()
|
self.to_le().to_ne_bytes()
|
||||||
|
@ -2270,11 +2151,7 @@ assert_eq!(
|
||||||
);
|
);
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
|
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
|
||||||
#[cfg_attr(
|
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] {
|
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
|
// 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")]
|
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
|
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
|
||||||
#[cfg_attr(
|
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn from_be_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
|
pub const fn from_be_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
|
||||||
Self::from_be(Self::from_ne_bytes(bytes))
|
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")]
|
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
|
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
|
||||||
#[cfg_attr(
|
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
|
pub const fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
|
||||||
Self::from_le(Self::from_ne_bytes(bytes))
|
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")]
|
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
|
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
|
||||||
#[cfg_attr(
|
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
|
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
|
// 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")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_promotable]
|
#[rustc_promotable]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_min_value", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_min_value", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
pub const fn min_value() -> Self { 0 }
|
pub const fn min_value() -> Self { 0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2511,10 +2373,7 @@ stringify!($MaxV), ");", $EndFeature, "
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_promotable]
|
#[rustc_promotable]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_max_value", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_max_value", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
pub const fn max_value() -> Self { !0 }
|
pub const fn max_value() -> Self { !0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2561,10 +2420,7 @@ Basic usage:
|
||||||
assert_eq!(n.count_ones(), 3);", $EndFeature, "
|
assert_eq!(n.count_ones(), 3);", $EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn count_ones(self) -> u32 {
|
pub const fn count_ones(self) -> u32 {
|
||||||
intrinsics::ctpop(self as $ActualT) as 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, "
|
", $Feature, "assert_eq!(", stringify!($SelfT), "::max_value().count_zeros(), 0);", $EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn count_zeros(self) -> u32 {
|
pub const fn count_zeros(self) -> u32 {
|
||||||
(!self).count_ones()
|
(!self).count_ones()
|
||||||
|
@ -2605,10 +2458,7 @@ Basic usage:
|
||||||
assert_eq!(n.leading_zeros(), 2);", $EndFeature, "
|
assert_eq!(n.leading_zeros(), 2);", $EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn leading_zeros(self) -> u32 {
|
pub const fn leading_zeros(self) -> u32 {
|
||||||
intrinsics::ctlz(self as $ActualT) as u32
|
intrinsics::ctlz(self as $ActualT) as u32
|
||||||
|
@ -2629,10 +2479,7 @@ Basic usage:
|
||||||
assert_eq!(n.trailing_zeros(), 3);", $EndFeature, "
|
assert_eq!(n.trailing_zeros(), 3);", $EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn trailing_zeros(self) -> u32 {
|
pub const fn trailing_zeros(self) -> u32 {
|
||||||
intrinsics::cttz(self) as u32
|
intrinsics::cttz(self) as u32
|
||||||
|
@ -2656,10 +2503,7 @@ let m = ", $rot_result, ";
|
||||||
assert_eq!(n.rotate_left(", $rot, "), m);
|
assert_eq!(n.rotate_left(", $rot, "), m);
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -2686,10 +2530,7 @@ let m = ", $rot_op, ";
|
||||||
assert_eq!(n.rotate_right(", $rot, "), m);
|
assert_eq!(n.rotate_right(", $rot, "), m);
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -2713,10 +2554,7 @@ let m = n.swap_bytes();
|
||||||
assert_eq!(m, ", $swapped, ");
|
assert_eq!(m, ", $swapped, ");
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn swap_bytes(self) -> Self {
|
pub const fn swap_bytes(self) -> Self {
|
||||||
intrinsics::bswap(self as $ActualT) as Self
|
intrinsics::bswap(self as $ActualT) as Self
|
||||||
|
@ -2737,10 +2575,7 @@ let m = n.reverse_bits();
|
||||||
assert_eq!(m, ", $reversed, ");
|
assert_eq!(m, ", $reversed, ");
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "reverse_bits", since = "1.37.0")]
|
#[stable(feature = "reverse_bits", since = "1.37.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub const fn reverse_bits(self) -> Self {
|
pub const fn reverse_bits(self) -> Self {
|
||||||
|
@ -2768,10 +2603,7 @@ if cfg!(target_endian = \"big\") {
|
||||||
}", $EndFeature, "
|
}", $EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn from_be(x: Self) -> Self {
|
pub const fn from_be(x: Self) -> Self {
|
||||||
#[cfg(target_endian = "big")]
|
#[cfg(target_endian = "big")]
|
||||||
|
@ -2805,10 +2637,7 @@ if cfg!(target_endian = \"little\") {
|
||||||
}", $EndFeature, "
|
}", $EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn from_le(x: Self) -> Self {
|
pub const fn from_le(x: Self) -> Self {
|
||||||
#[cfg(target_endian = "little")]
|
#[cfg(target_endian = "little")]
|
||||||
|
@ -2842,10 +2671,7 @@ if cfg!(target_endian = \"big\") {
|
||||||
}", $EndFeature, "
|
}", $EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn to_be(self) -> Self { // or not to be?
|
pub const fn to_be(self) -> Self { // or not to be?
|
||||||
#[cfg(target_endian = "big")]
|
#[cfg(target_endian = "big")]
|
||||||
|
@ -2879,10 +2705,7 @@ if cfg!(target_endian = \"little\") {
|
||||||
}", $EndFeature, "
|
}", $EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn to_le(self) -> Self {
|
pub const fn to_le(self) -> Self {
|
||||||
#[cfg(target_endian = "little")]
|
#[cfg(target_endian = "little")]
|
||||||
|
@ -3188,11 +3011,7 @@ assert_eq!(200u8.saturating_add(127), 255);", $EndFeature, "
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_saturating_int_methods"))]
|
#[rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718")]
|
||||||
#[cfg_attr(
|
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn saturating_add(self, rhs: Self) -> Self {
|
pub const fn saturating_add(self, rhs: Self) -> Self {
|
||||||
intrinsics::saturating_add(self, rhs)
|
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")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_saturating_int_methods"))]
|
#[rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718")]
|
||||||
#[cfg_attr(
|
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn saturating_sub(self, rhs: Self) -> Self {
|
pub const fn saturating_sub(self, rhs: Self) -> Self {
|
||||||
intrinsics::saturating_sub(self, rhs)
|
intrinsics::saturating_sub(self, rhs)
|
||||||
|
@ -3290,10 +3105,7 @@ assert_eq!(200", stringify!($SelfT), ".wrapping_add(", stringify!($SelfT), "::ma
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -3316,10 +3128,7 @@ assert_eq!(100", stringify!($SelfT), ".wrapping_sub(", stringify!($SelfT), "::ma
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -3343,10 +3152,7 @@ $EndFeature, "
|
||||||
/// assert_eq!(25u8.wrapping_mul(12), 44);
|
/// assert_eq!(25u8.wrapping_mul(12), 44);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -3476,10 +3282,7 @@ assert_eq!(100", stringify!($SelfT), ".wrapping_rem_euclid(10), 0);
|
||||||
/// assert_eq!((-128i8).wrapping_neg(), -128);
|
/// assert_eq!((-128i8).wrapping_neg(), -128);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "num_wrapping", since = "1.2.0")]
|
#[stable(feature = "num_wrapping", since = "1.2.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn wrapping_neg(self) -> Self {
|
pub const fn wrapping_neg(self) -> Self {
|
||||||
self.overflowing_neg().0
|
self.overflowing_neg().0
|
||||||
|
@ -3506,10 +3309,7 @@ Basic usage:
|
||||||
assert_eq!(1", stringify!($SelfT), ".wrapping_shl(128), 1);", $EndFeature, "
|
assert_eq!(1", stringify!($SelfT), ".wrapping_shl(128), 1);", $EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "num_wrapping", since = "1.2.0")]
|
#[stable(feature = "num_wrapping", since = "1.2.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -3543,10 +3343,7 @@ Basic usage:
|
||||||
assert_eq!(128", stringify!($SelfT), ".wrapping_shr(128), 128);", $EndFeature, "
|
assert_eq!(128", stringify!($SelfT), ".wrapping_shr(128), 128);", $EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "num_wrapping", since = "1.2.0")]
|
#[stable(feature = "num_wrapping", since = "1.2.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[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, "
|
assert_eq!(", stringify!($SelfT), "::MAX.overflowing_add(1), (0, true));", $EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -3648,10 +3442,7 @@ assert_eq!(0", stringify!($SelfT), ".overflowing_sub(1), (", stringify!($SelfT),
|
||||||
$EndFeature, "
|
$EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -3679,10 +3470,7 @@ $EndFeature, "
|
||||||
/// assert_eq!(1_000_000_000u32.overflowing_mul(10), (1410065408, true));
|
/// assert_eq!(1_000_000_000u32.overflowing_mul(10), (1410065408, true));
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -3828,10 +3616,7 @@ assert_eq!(2", stringify!($SelfT), ".overflowing_neg(), (-2i32 as ", stringify!(
|
||||||
```"),
|
```"),
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
pub const fn overflowing_neg(self) -> (Self, bool) {
|
pub const fn overflowing_neg(self) -> (Self, bool) {
|
||||||
((!self).wrapping_add(1), self != 0)
|
((!self).wrapping_add(1), self != 0)
|
||||||
}
|
}
|
||||||
|
@ -3855,10 +3640,7 @@ Basic usage
|
||||||
assert_eq!(0x1", stringify!($SelfT), ".overflowing_shl(132), (0x10, true));", $EndFeature, "
|
assert_eq!(0x1", stringify!($SelfT), ".overflowing_shl(132), (0x10, true));", $EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -3885,10 +3667,7 @@ Basic usage
|
||||||
assert_eq!(0x10", stringify!($SelfT), ".overflowing_shr(132), (0x1, true));", $EndFeature, "
|
assert_eq!(0x10", stringify!($SelfT), ".overflowing_shr(132), (0x1, true));", $EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -4054,10 +3833,7 @@ Basic usage:
|
||||||
assert!(!10", stringify!($SelfT), ".is_power_of_two());", $EndFeature, "
|
assert!(!10", stringify!($SelfT), ".is_power_of_two());", $EndFeature, "
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_is_power_of_two", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_is_power_of_two", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn is_power_of_two(self) -> bool {
|
pub const fn is_power_of_two(self) -> bool {
|
||||||
self.count_ones() == 1
|
self.count_ones() == 1
|
||||||
|
@ -4169,11 +3945,7 @@ let bytes = ", $swap_op, stringify!($SelfT), ".to_be_bytes();
|
||||||
assert_eq!(bytes, ", $be_bytes, ");
|
assert_eq!(bytes, ", $be_bytes, ");
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
|
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
|
||||||
#[cfg_attr(
|
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn to_be_bytes(self) -> [u8; mem::size_of::<Self>()] {
|
pub const fn to_be_bytes(self) -> [u8; mem::size_of::<Self>()] {
|
||||||
self.to_be().to_ne_bytes()
|
self.to_be().to_ne_bytes()
|
||||||
|
@ -4193,11 +3965,7 @@ let bytes = ", $swap_op, stringify!($SelfT), ".to_le_bytes();
|
||||||
assert_eq!(bytes, ", $le_bytes, ");
|
assert_eq!(bytes, ", $le_bytes, ");
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
|
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
|
||||||
#[cfg_attr(
|
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn to_le_bytes(self) -> [u8; mem::size_of::<Self>()] {
|
pub const fn to_le_bytes(self) -> [u8; mem::size_of::<Self>()] {
|
||||||
self.to_le().to_ne_bytes()
|
self.to_le().to_ne_bytes()
|
||||||
|
@ -4232,11 +4000,7 @@ assert_eq!(
|
||||||
);
|
);
|
||||||
```"),
|
```"),
|
||||||
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
|
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
|
||||||
#[cfg_attr(
|
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] {
|
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
|
// 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")]
|
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
|
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
|
||||||
#[cfg_attr(
|
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn from_be_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
|
pub const fn from_be_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
|
||||||
Self::from_be(Self::from_ne_bytes(bytes))
|
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")]
|
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
|
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
|
||||||
#[cfg_attr(
|
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
|
pub const fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
|
||||||
Self::from_le(Self::from_ne_bytes(bytes))
|
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")]
|
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
|
#[rustc_const_unstable(feature = "const_int_conversion", issue = "53718")]
|
||||||
#[cfg_attr(
|
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
|
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
|
// SAFETY: integers are plain old datatypes so we can always transmute to them
|
||||||
|
|
|
@ -530,10 +530,7 @@ assert_eq!(n.trailing_zeros(), 3);
|
||||||
/// assert_eq!(m, Wrapping(-22016));
|
/// assert_eq!(m, Wrapping(-22016));
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "reverse_bits", since = "1.37.0")]
|
#[stable(feature = "reverse_bits", since = "1.37.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_reverse_bits", since = "1.37.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_reverse_bits", since = "1.37.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub const fn reverse_bits(self) -> Self {
|
pub const fn reverse_bits(self) -> Self {
|
||||||
|
|
|
@ -398,7 +398,7 @@ impl<Idx> RangeInclusive<Idx> {
|
||||||
#[stable(feature = "inclusive_range_methods", since = "1.27.0")]
|
#[stable(feature = "inclusive_range_methods", since = "1.27.0")]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[rustc_promotable]
|
#[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 {
|
pub const fn new(start: Idx, end: Idx) -> Self {
|
||||||
Self { start, end, is_empty: None }
|
Self { start, end, is_empty: None }
|
||||||
}
|
}
|
||||||
|
@ -422,10 +422,7 @@ impl<Idx> RangeInclusive<Idx> {
|
||||||
/// assert_eq!((3..=5).start(), &3);
|
/// assert_eq!((3..=5).start(), &3);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "inclusive_range_methods", since = "1.27.0")]
|
#[stable(feature = "inclusive_range_methods", since = "1.27.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_inclusive_range_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_inclusive_range_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn start(&self) -> &Idx {
|
pub const fn start(&self) -> &Idx {
|
||||||
&self.start
|
&self.start
|
||||||
|
@ -450,10 +447,7 @@ impl<Idx> RangeInclusive<Idx> {
|
||||||
/// assert_eq!((3..=5).end(), &5);
|
/// assert_eq!((3..=5).end(), &5);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "inclusive_range_methods", since = "1.27.0")]
|
#[stable(feature = "inclusive_range_methods", since = "1.27.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_inclusive_range_methods", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_inclusive_range_methods", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn end(&self) -> &Idx {
|
pub const fn end(&self) -> &Idx {
|
||||||
&self.end
|
&self.end
|
||||||
|
|
|
@ -5,26 +5,23 @@
|
||||||
/// extracting those success or failure values from an existing instance and
|
/// extracting those success or failure values from an existing instance and
|
||||||
/// creating a new instance from a success or failure value.
|
/// creating a new instance from a success or failure value.
|
||||||
#[unstable(feature = "try_trait", issue = "42327")]
|
#[unstable(feature = "try_trait", issue = "42327")]
|
||||||
#[cfg_attr(
|
#[rustc_on_unimplemented(
|
||||||
not(bootstrap),
|
on(
|
||||||
rustc_on_unimplemented(
|
all(
|
||||||
on(
|
any(from_method = "from_error", from_method = "from_ok"),
|
||||||
all(
|
from_desugaring = "QuestionMark"
|
||||||
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 `?`"
|
|
||||||
),
|
),
|
||||||
on(
|
message = "the `?` operator can only be used in {ItemContext} \
|
||||||
all(from_method = "into_result", from_desugaring = "QuestionMark"),
|
that returns `Result` or `Option` \
|
||||||
message = "the `?` operator can only be applied to values \
|
(or another type that implements `{Try}`)",
|
||||||
that implement `{Try}`",
|
label = "cannot use the `?` operator in {ItemContext} that returns `{Self}`",
|
||||||
label = "the `?` operator cannot be applied to type `{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 = "?")]
|
#[doc(alias = "?")]
|
||||||
|
|
|
@ -222,7 +222,6 @@ impl<'a> Location<'a> {
|
||||||
/// assert_ne!(this_location.line(), another_location.line());
|
/// assert_ne!(this_location.line(), another_location.line());
|
||||||
/// assert_ne!(this_location.column(), another_location.column());
|
/// assert_ne!(this_location.column(), another_location.column());
|
||||||
/// ```
|
/// ```
|
||||||
#[cfg(not(bootstrap))]
|
|
||||||
#[unstable(feature = "track_caller",
|
#[unstable(feature = "track_caller",
|
||||||
reason = "uses #[track_caller] which is not yet stable",
|
reason = "uses #[track_caller] which is not yet stable",
|
||||||
issue = "47809")]
|
issue = "47809")]
|
||||||
|
|
|
@ -198,7 +198,7 @@ unsafe fn real_drop_in_place<T: ?Sized>(to_drop: &mut T) {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_promotable]
|
#[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 {
|
pub const fn null<T>() -> *const T {
|
||||||
0 as *const T
|
0 as *const T
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ pub const fn null<T>() -> *const T {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_promotable]
|
#[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 {
|
pub const fn null_mut<T>() -> *mut T {
|
||||||
0 as *mut T
|
0 as *mut T
|
||||||
}
|
}
|
||||||
|
@ -1062,7 +1062,7 @@ impl<T: ?Sized> *const T {
|
||||||
|
|
||||||
/// Casts to a pointer of another type.
|
/// Casts to a pointer of another type.
|
||||||
#[stable(feature = "ptr_cast", since = "1.38.0")]
|
#[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]
|
#[inline]
|
||||||
pub const fn cast<U>(self) -> *const U {
|
pub const fn cast<U>(self) -> *const U {
|
||||||
self as _
|
self as _
|
||||||
|
@ -1310,11 +1310,7 @@ impl<T: ?Sized> *const T {
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "ptr_offset_from", issue = "41079")]
|
#[unstable(feature = "ptr_offset_from", issue = "41079")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_ptr_offset_from"))]
|
#[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "41079")]
|
||||||
#[cfg_attr(
|
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_unstable(feature = "const_ptr_offset_from", issue = "41079"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const unsafe fn offset_from(self, origin: *const T) -> isize
|
pub const unsafe fn offset_from(self, origin: *const T) -> isize
|
||||||
where
|
where
|
||||||
|
@ -1770,7 +1766,7 @@ impl<T: ?Sized> *mut T {
|
||||||
|
|
||||||
/// Casts to a pointer of another type.
|
/// Casts to a pointer of another type.
|
||||||
#[stable(feature = "ptr_cast", since = "1.38.0")]
|
#[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]
|
#[inline]
|
||||||
pub const fn cast<U>(self) -> *mut U {
|
pub const fn cast<U>(self) -> *mut U {
|
||||||
self as _
|
self as _
|
||||||
|
@ -2057,11 +2053,7 @@ impl<T: ?Sized> *mut T {
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "ptr_offset_from", issue = "41079")]
|
#[unstable(feature = "ptr_offset_from", issue = "41079")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_ptr_offset_from"))]
|
#[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "41079")]
|
||||||
#[cfg_attr(
|
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_unstable(feature = "const_ptr_offset_from", issue = "41079"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const unsafe fn offset_from(self, origin: *const T) -> isize
|
pub const unsafe fn offset_from(self, origin: *const T) -> isize
|
||||||
where
|
where
|
||||||
|
|
|
@ -66,10 +66,7 @@ impl<T: Sized> NonNull<T> {
|
||||||
/// sentinel value. Types that lazily allocate must track initialization by
|
/// sentinel value. Types that lazily allocate must track initialization by
|
||||||
/// some other means.
|
/// some other means.
|
||||||
#[stable(feature = "nonnull", since = "1.25.0")]
|
#[stable(feature = "nonnull", since = "1.25.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_nonnull_dangling", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_nonnull_dangling", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn dangling() -> Self {
|
pub const fn dangling() -> Self {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -86,10 +83,7 @@ impl<T: ?Sized> NonNull<T> {
|
||||||
///
|
///
|
||||||
/// `ptr` must be non-null.
|
/// `ptr` must be non-null.
|
||||||
#[stable(feature = "nonnull", since = "1.25.0")]
|
#[stable(feature = "nonnull", since = "1.25.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_nonnull_new_unchecked", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_nonnull_new_unchecked", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const unsafe fn new_unchecked(ptr: *mut T) -> Self {
|
pub const unsafe fn new_unchecked(ptr: *mut T) -> Self {
|
||||||
NonNull { pointer: ptr as _ }
|
NonNull { pointer: ptr as _ }
|
||||||
|
@ -104,10 +98,7 @@ impl<T: ?Sized> NonNull<T> {
|
||||||
|
|
||||||
/// Acquires the underlying `*mut` pointer.
|
/// Acquires the underlying `*mut` pointer.
|
||||||
#[stable(feature = "nonnull", since = "1.25.0")]
|
#[stable(feature = "nonnull", since = "1.25.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_nonnull_as_ptr", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_nonnull_as_ptr", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn as_ptr(self) -> *mut T {
|
pub const fn as_ptr(self) -> *mut T {
|
||||||
self.pointer as *mut T
|
self.pointer as *mut T
|
||||||
|
@ -137,10 +128,7 @@ impl<T: ?Sized> NonNull<T> {
|
||||||
|
|
||||||
/// Casts to a pointer of another type.
|
/// Casts to a pointer of another type.
|
||||||
#[stable(feature = "nonnull_cast", since = "1.27.0")]
|
#[stable(feature = "nonnull_cast", since = "1.27.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_nonnull_cast", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_nonnull_cast", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn cast<U>(self) -> NonNull<U> {
|
pub const fn cast<U>(self) -> NonNull<U> {
|
||||||
unsafe { NonNull::new_unchecked(self.as_ptr() as *mut U) }
|
unsafe { NonNull::new_unchecked(self.as_ptr() as *mut U) }
|
||||||
|
|
|
@ -62,7 +62,7 @@ impl<T> [T] {
|
||||||
/// assert_eq!(a.len(), 3);
|
/// assert_eq!(a.len(), 3);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[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]
|
#[inline]
|
||||||
// SAFETY: const sound because we transmute out the length field as a usize (which it must be)
|
// SAFETY: const sound because we transmute out the length field as a usize (which it must be)
|
||||||
#[allow(unused_attributes)]
|
#[allow(unused_attributes)]
|
||||||
|
@ -82,10 +82,7 @@ impl<T> [T] {
|
||||||
/// assert!(!a.is_empty());
|
/// assert!(!a.is_empty());
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_slice_is_empty", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_slice_is_empty", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn is_empty(&self) -> bool {
|
pub const fn is_empty(&self) -> bool {
|
||||||
self.len() == 0
|
self.len() == 0
|
||||||
|
@ -381,10 +378,7 @@ impl<T> [T] {
|
||||||
///
|
///
|
||||||
/// [`as_mut_ptr`]: #method.as_mut_ptr
|
/// [`as_mut_ptr`]: #method.as_mut_ptr
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_slice_as_ptr", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_slice_as_ptr", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn as_ptr(&self) -> *const T {
|
pub const fn as_ptr(&self) -> *const T {
|
||||||
self as *const [T] as *const T
|
self as *const [T] as *const T
|
||||||
|
|
|
@ -2090,7 +2090,7 @@ impl str {
|
||||||
/// assert_eq!("ƒoo".chars().count(), 3);
|
/// assert_eq!("ƒoo".chars().count(), 3);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[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]
|
#[inline]
|
||||||
pub const fn len(&self) -> usize {
|
pub const fn len(&self) -> usize {
|
||||||
self.as_bytes().len()
|
self.as_bytes().len()
|
||||||
|
@ -2111,10 +2111,7 @@ impl str {
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(
|
#[rustc_const_stable(feature = "const_str_is_empty", since = "1.32.0")]
|
||||||
not(bootstrap),
|
|
||||||
rustc_const_stable(feature = "const_str_is_empty", since = "1.32.0"),
|
|
||||||
)]
|
|
||||||
pub const fn is_empty(&self) -> bool {
|
pub const fn is_empty(&self) -> bool {
|
||||||
self.len() == 0
|
self.len() == 0
|
||||||
}
|
}
|
||||||
|
@ -2171,7 +2168,7 @@ impl str {
|
||||||
/// assert_eq!(b"bors", bytes);
|
/// assert_eq!(b"bors", bytes);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[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)]
|
#[inline(always)]
|
||||||
// SAFETY: const sound because we transmute two types with the same layout
|
// SAFETY: const sound because we transmute two types with the same layout
|
||||||
#[allow(unused_attributes)]
|
#[allow(unused_attributes)]
|
||||||
|
@ -2245,7 +2242,7 @@ impl str {
|
||||||
/// let ptr = s.as_ptr();
|
/// let ptr = s.as_ptr();
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[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]
|
#[inline]
|
||||||
pub const fn as_ptr(&self) -> *const u8 {
|
pub const fn as_ptr(&self) -> *const u8 {
|
||||||
self as *const str as *const u8
|
self as *const str as *const u8
|
||||||
|
|
|
@ -331,7 +331,7 @@ impl AtomicBool {
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[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 {
|
pub const fn new(v: bool) -> AtomicBool {
|
||||||
AtomicBool { v: UnsafeCell::new(v as u8) }
|
AtomicBool { v: UnsafeCell::new(v as u8) }
|
||||||
}
|
}
|
||||||
|
@ -856,7 +856,7 @@ impl<T> AtomicPtr<T> {
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[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> {
|
pub const fn new(p: *mut T) -> AtomicPtr<T> {
|
||||||
AtomicPtr { p: UnsafeCell::new(p) }
|
AtomicPtr { p: UnsafeCell::new(p) }
|
||||||
}
|
}
|
||||||
|
@ -1261,7 +1261,7 @@ let atomic_forty_two = ", stringify!($atomic_type), "::new(42);
|
||||||
```"),
|
```"),
|
||||||
#[inline]
|
#[inline]
|
||||||
#[$stable]
|
#[$stable]
|
||||||
#[cfg_attr(not(bootstrap), $const_stable)]
|
#[$const_stable]
|
||||||
pub const fn new(v: $int_type) -> Self {
|
pub const fn new(v: $int_type) -> Self {
|
||||||
Self {v: UnsafeCell::new(v)}
|
Self {v: UnsafeCell::new(v)}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ impl RawWaker {
|
||||||
/// function in the `vtable` of the underlying `RawWaker` will be called.
|
/// function in the `vtable` of the underlying `RawWaker` will be called.
|
||||||
#[rustc_promotable]
|
#[rustc_promotable]
|
||||||
#[stable(feature = "futures_api", since = "1.36.0")]
|
#[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 {
|
pub const fn new(data: *const (), vtable: &'static RawWakerVTable) -> RawWaker {
|
||||||
RawWaker { data, vtable }
|
RawWaker { data, vtable }
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ impl RawWakerVTable {
|
||||||
// FIXME: remove whenever we have a stable way to accept fn pointers from const fn
|
// 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)
|
// (see https://github.com/rust-rfcs/const-eval/issues/19#issuecomment-472799062)
|
||||||
#[rustc_allow_const_fn_ptr]
|
#[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(
|
pub const fn new(
|
||||||
clone: unsafe fn(*const ()) -> RawWaker,
|
clone: unsafe fn(*const ()) -> RawWaker,
|
||||||
wake: unsafe fn(*const ()),
|
wake: unsafe fn(*const ()),
|
||||||
|
|
|
@ -130,7 +130,7 @@ impl Duration {
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "duration", since = "1.3.0")]
|
#[stable(feature = "duration", since = "1.3.0")]
|
||||||
#[inline]
|
#[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 {
|
pub fn new(secs: u64, nanos: u32) -> Duration {
|
||||||
let secs =
|
let secs =
|
||||||
secs.checked_add((nanos / NANOS_PER_SEC) as u64).expect("overflow in Duration::new");
|
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")]
|
#[stable(feature = "duration", since = "1.3.0")]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[rustc_promotable]
|
#[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 {
|
pub const fn from_secs(secs: u64) -> Duration {
|
||||||
Duration { secs, nanos: 0 }
|
Duration { secs, nanos: 0 }
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ impl Duration {
|
||||||
#[stable(feature = "duration", since = "1.3.0")]
|
#[stable(feature = "duration", since = "1.3.0")]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[rustc_promotable]
|
#[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 {
|
pub const fn from_millis(millis: u64) -> Duration {
|
||||||
Duration {
|
Duration {
|
||||||
secs: millis / MILLIS_PER_SEC,
|
secs: millis / MILLIS_PER_SEC,
|
||||||
|
@ -196,7 +196,7 @@ impl Duration {
|
||||||
#[stable(feature = "duration_from_micros", since = "1.27.0")]
|
#[stable(feature = "duration_from_micros", since = "1.27.0")]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[rustc_promotable]
|
#[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 {
|
pub const fn from_micros(micros: u64) -> Duration {
|
||||||
Duration {
|
Duration {
|
||||||
secs: micros / MICROS_PER_SEC,
|
secs: micros / MICROS_PER_SEC,
|
||||||
|
@ -219,7 +219,7 @@ impl Duration {
|
||||||
#[stable(feature = "duration_extras", since = "1.27.0")]
|
#[stable(feature = "duration_extras", since = "1.27.0")]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[rustc_promotable]
|
#[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 {
|
pub const fn from_nanos(nanos: u64) -> Duration {
|
||||||
Duration {
|
Duration {
|
||||||
secs: nanos / (NANOS_PER_SEC as u64),
|
secs: nanos / (NANOS_PER_SEC as u64),
|
||||||
|
@ -256,7 +256,7 @@ impl Duration {
|
||||||
///
|
///
|
||||||
/// [`subsec_nanos`]: #method.subsec_nanos
|
/// [`subsec_nanos`]: #method.subsec_nanos
|
||||||
#[stable(feature = "duration", since = "1.3.0")]
|
#[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]
|
#[inline]
|
||||||
pub const fn as_secs(&self) -> u64 {
|
pub const fn as_secs(&self) -> u64 {
|
||||||
self.secs
|
self.secs
|
||||||
|
@ -278,7 +278,7 @@ impl Duration {
|
||||||
/// assert_eq!(duration.subsec_millis(), 432);
|
/// assert_eq!(duration.subsec_millis(), 432);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "duration_extras", since = "1.27.0")]
|
#[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]
|
#[inline]
|
||||||
pub const fn subsec_millis(&self) -> u32 {
|
pub const fn subsec_millis(&self) -> u32 {
|
||||||
self.nanos / NANOS_PER_MILLI
|
self.nanos / NANOS_PER_MILLI
|
||||||
|
@ -300,7 +300,7 @@ impl Duration {
|
||||||
/// assert_eq!(duration.subsec_micros(), 234_567);
|
/// assert_eq!(duration.subsec_micros(), 234_567);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "duration_extras", since = "1.27.0")]
|
#[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]
|
#[inline]
|
||||||
pub const fn subsec_micros(&self) -> u32 {
|
pub const fn subsec_micros(&self) -> u32 {
|
||||||
self.nanos / NANOS_PER_MICRO
|
self.nanos / NANOS_PER_MICRO
|
||||||
|
@ -322,7 +322,7 @@ impl Duration {
|
||||||
/// assert_eq!(duration.subsec_nanos(), 10_000_000);
|
/// assert_eq!(duration.subsec_nanos(), 10_000_000);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "duration", since = "1.3.0")]
|
#[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]
|
#[inline]
|
||||||
pub const fn subsec_nanos(&self) -> u32 {
|
pub const fn subsec_nanos(&self) -> u32 {
|
||||||
self.nanos
|
self.nanos
|
||||||
|
@ -339,7 +339,7 @@ impl Duration {
|
||||||
/// assert_eq!(duration.as_millis(), 5730);
|
/// assert_eq!(duration.as_millis(), 5730);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "duration_as_u128", since = "1.33.0")]
|
#[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]
|
#[inline]
|
||||||
pub const fn as_millis(&self) -> u128 {
|
pub const fn as_millis(&self) -> u128 {
|
||||||
self.secs as u128 * MILLIS_PER_SEC as u128 + (self.nanos / NANOS_PER_MILLI) as 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);
|
/// assert_eq!(duration.as_micros(), 5730023);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "duration_as_u128", since = "1.33.0")]
|
#[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]
|
#[inline]
|
||||||
pub const fn as_micros(&self) -> u128 {
|
pub const fn as_micros(&self) -> u128 {
|
||||||
self.secs as u128 * MICROS_PER_SEC as u128 + (self.nanos / NANOS_PER_MICRO) as 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);
|
/// assert_eq!(duration.as_nanos(), 5730023852);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "duration_as_u128", since = "1.33.0")]
|
#[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]
|
#[inline]
|
||||||
pub const fn as_nanos(&self) -> u128 {
|
pub const fn as_nanos(&self) -> u128 {
|
||||||
self.secs as u128 * NANOS_PER_SEC as u128 + self.nanos as u128
|
self.secs as u128 * NANOS_PER_SEC as u128 + self.nanos as u128
|
||||||
|
|
|
@ -76,9 +76,6 @@ pub fn encode_with_shorthand<E, T, M>(encoder: &mut E,
|
||||||
|
|
||||||
// The shorthand encoding uses the same usize as the
|
// The shorthand encoding uses the same usize as the
|
||||||
// discriminant, with an offset so they can't conflict.
|
// 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);
|
let discriminant = intrinsics::discriminant_value(variant);
|
||||||
assert!(discriminant < SHORTHAND_OFFSET as u64);
|
assert!(discriminant < SHORTHAND_OFFSET as u64);
|
||||||
let shorthand = start + SHORTHAND_OFFSET;
|
let shorthand = start + SHORTHAND_OFFSET;
|
||||||
|
|
|
@ -1065,8 +1065,7 @@ impl CStr {
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "cstr_from_bytes", since = "1.10.0")]
|
#[stable(feature = "cstr_from_bytes", since = "1.10.0")]
|
||||||
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_cstr_unchecked"))]
|
#[rustc_const_unstable(feature = "const_cstr_unchecked", issue = "0")]
|
||||||
#[cfg_attr(not(bootstrap), rustc_const_unstable(feature = "const_cstr_unchecked", issue = "0"))]
|
|
||||||
pub const unsafe fn from_bytes_with_nul_unchecked(bytes: &[u8]) -> &CStr {
|
pub const unsafe fn from_bytes_with_nul_unchecked(bytes: &[u8]) -> &CStr {
|
||||||
&*(bytes as *const [u8] as *const CStr)
|
&*(bytes as *const [u8] as *const CStr)
|
||||||
}
|
}
|
||||||
|
@ -1120,7 +1119,7 @@ impl CStr {
|
||||||
/// [`CString`]: struct.CString.html
|
/// [`CString`]: struct.CString.html
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[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 {
|
pub const fn as_ptr(&self) -> *const c_char {
|
||||||
self.inner.as_ptr()
|
self.inner.as_ptr()
|
||||||
}
|
}
|
||||||
|
|
|
@ -283,7 +283,6 @@
|
||||||
#![feature(needs_panic_runtime)]
|
#![feature(needs_panic_runtime)]
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
#![feature(nll)]
|
#![feature(nll)]
|
||||||
#![cfg_attr(bootstrap, feature(on_unimplemented))]
|
|
||||||
#![feature(optin_builtin_traits)]
|
#![feature(optin_builtin_traits)]
|
||||||
#![feature(panic_info_message)]
|
#![feature(panic_info_message)]
|
||||||
#![feature(panic_internals)]
|
#![feature(panic_internals)]
|
||||||
|
@ -293,7 +292,6 @@
|
||||||
#![feature(raw)]
|
#![feature(raw)]
|
||||||
#![feature(renamed_spin_loop)]
|
#![feature(renamed_spin_loop)]
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
#![cfg_attr(bootstrap, feature(rustc_const_unstable))]
|
|
||||||
#![feature(rustc_private)]
|
#![feature(rustc_private)]
|
||||||
#![feature(shrink_to)]
|
#![feature(shrink_to)]
|
||||||
#![feature(slice_concat_ext)]
|
#![feature(slice_concat_ext)]
|
||||||
|
|
|
@ -319,7 +319,7 @@ impl Ipv4Addr {
|
||||||
/// let addr = Ipv4Addr::new(127, 0, 0, 1);
|
/// let addr = Ipv4Addr::new(127, 0, 0, 1);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[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 {
|
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]),
|
// FIXME: should just be u32::from_be_bytes([a, b, c, d]),
|
||||||
// once that method is no longer rustc_const_unstable
|
// 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);
|
/// assert_eq!(Ipv4Addr::new(45, 22, 13, 197).is_unspecified(), false);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "ip_shared", since = "1.12.0")]
|
#[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 {
|
pub const fn is_unspecified(&self) -> bool {
|
||||||
self.inner.s_addr == 0
|
self.inner.s_addr == 0
|
||||||
}
|
}
|
||||||
|
@ -1017,7 +1017,7 @@ impl Ipv6Addr {
|
||||||
/// let addr = Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff);
|
/// let addr = Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[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,
|
pub const fn new(a: u16, b: u16, c: u16, d: u16, e: u16, f: u16,
|
||||||
g: u16, h: u16) -> Ipv6Addr {
|
g: u16, h: u16) -> Ipv6Addr {
|
||||||
Ipv6Addr {
|
Ipv6Addr {
|
||||||
|
@ -1483,7 +1483,7 @@ impl Ipv6Addr {
|
||||||
/// [255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
/// [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")]
|
#[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] {
|
pub const fn octets(&self) -> [u8; 16] {
|
||||||
self.inner.s6_addr
|
self.inner.s6_addr
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ struct WaiterQueue<'a> {
|
||||||
impl Once {
|
impl Once {
|
||||||
/// Creates a new `Once` value.
|
/// Creates a new `Once` value.
|
||||||
#[stable(feature = "once_new", since = "1.2.0")]
|
#[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 {
|
pub const fn new() -> Once {
|
||||||
Once { state_and_queue: AtomicUsize::new(INCOMPLETE), _marker: marker::PhantomData }
|
Once { state_and_queue: AtomicUsize::new(INCOMPLETE), _marker: marker::PhantomData }
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,6 @@ macro_rules! ast_fragments {
|
||||||
$($(AstFragment::$Kind(ast) => ast.extend(placeholders.iter().flat_map(|id| {
|
$($(AstFragment::$Kind(ast) => ast.extend(placeholders.iter().flat_map(|id| {
|
||||||
// We are repeating through arguments with `many`, to do that we have to
|
// 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.
|
// 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) {}
|
macro _repeating($flat_map_ast_elt) {}
|
||||||
placeholder(AstFragmentKind::$Kind, *id, None).$make_ast()
|
placeholder(AstFragmentKind::$Kind, *id, None).$make_ast()
|
||||||
})),)?)*
|
})),)?)*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue