1
Fork 0

Fix const stability since versions.

This commit is contained in:
Oli Scherer 2021-03-12 13:45:13 +00:00
parent 0cc64a34e9
commit 6f3635d87b
9 changed files with 20 additions and 20 deletions

View file

@ -360,7 +360,7 @@ impl String {
/// let s = String::new(); /// let s = String::new();
/// ``` /// ```
#[inline] #[inline]
#[rustc_const_stable(feature = "const_string_new", since = "1.32.0")] #[rustc_const_stable(feature = "const_string_new", since = "1.39.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() }

View file

@ -93,7 +93,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`]. /// [`Layout::from_size_align`].
#[stable(feature = "alloc_layout", since = "1.28.0")] #[stable(feature = "alloc_layout", since = "1.28.0")]
#[rustc_const_stable(feature = "alloc_layout", since = "1.28.0")] #[rustc_const_stable(feature = "alloc_layout", since = "1.36.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 {
// SAFETY: the caller must ensure that `align` is greater than zero. // SAFETY: the caller must ensure that `align` is greater than zero.

View file

@ -325,7 +325,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")]
#[rustc_const_stable(feature = "const_cell_new", since = "1.32.0")] #[rustc_const_stable(feature = "const_cell_new", since = "1.24.0")]
#[inline] #[inline]
pub const fn new(value: T) -> Cell<T> { pub const fn new(value: T) -> Cell<T> {
Cell { value: UnsafeCell::new(value) } Cell { value: UnsafeCell::new(value) }
@ -655,7 +655,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")]
#[rustc_const_stable(feature = "const_refcell_new", since = "1.32.0")] #[rustc_const_stable(feature = "const_refcell_new", since = "1.24.0")]
#[inline] #[inline]
pub const fn new(value: T) -> RefCell<T> { pub const fn new(value: T) -> RefCell<T> {
RefCell { value: UnsafeCell::new(value), borrow: Cell::new(UNUSED) } RefCell { value: UnsafeCell::new(value), borrow: Cell::new(UNUSED) }

View file

@ -297,7 +297,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]
#[rustc_const_stable(feature = "const_size_of", since = "1.32.0")] #[rustc_const_stable(feature = "const_size_of", since = "1.24.0")]
pub const fn size_of<T>() -> usize { pub const fn size_of<T>() -> usize {
intrinsics::size_of::<T>() intrinsics::size_of::<T>()
} }
@ -440,7 +440,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]
#[rustc_const_stable(feature = "const_align_of", since = "1.32.0")] #[rustc_const_stable(feature = "const_align_of", since = "1.24.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>()
} }

View file

@ -205,7 +205,7 @@ pub unsafe fn 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]
#[rustc_const_stable(feature = "const_ptr_null", since = "1.32.0")] #[rustc_const_stable(feature = "const_ptr_null", since = "1.24.0")]
pub const fn null<T>() -> *const T { pub const fn null<T>() -> *const T {
0 as *const T 0 as *const T
} }
@ -223,7 +223,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]
#[rustc_const_stable(feature = "const_ptr_null", since = "1.32.0")] #[rustc_const_stable(feature = "const_ptr_null", since = "1.24.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
} }

View file

@ -72,7 +72,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")]
#[rustc_const_stable(feature = "const_nonnull_dangling", since = "1.32.0")] #[rustc_const_stable(feature = "const_nonnull_dangling", since = "1.36.0")]
#[inline] #[inline]
pub const fn dangling() -> Self { pub const fn dangling() -> Self {
// SAFETY: mem::align_of() returns a non-zero usize which is then casted // SAFETY: mem::align_of() returns a non-zero usize which is then casted
@ -156,7 +156,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")]
#[rustc_const_stable(feature = "const_nonnull_new_unchecked", since = "1.32.0")] #[rustc_const_stable(feature = "const_nonnull_new_unchecked", since = "1.25.0")]
#[inline] #[inline]
pub const unsafe fn new_unchecked(ptr: *mut T) -> Self { pub const unsafe fn new_unchecked(ptr: *mut T) -> Self {
// SAFETY: the caller must guarantee that `ptr` is non-null. // SAFETY: the caller must guarantee that `ptr` is non-null.
@ -288,7 +288,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")]
#[rustc_const_stable(feature = "const_nonnull_cast", since = "1.32.0")] #[rustc_const_stable(feature = "const_nonnull_cast", since = "1.36.0")]
#[inline] #[inline]
pub const fn cast<U>(self) -> NonNull<U> { pub const fn cast<U>(self) -> NonNull<U> {
// SAFETY: `self` is a `NonNull` pointer which is necessarily non-null // SAFETY: `self` is a `NonNull` pointer which is necessarily non-null

View file

@ -94,7 +94,7 @@ impl<T> [T] {
/// ``` /// ```
#[doc(alias = "length")] #[doc(alias = "length")]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_slice_len", since = "1.32.0")] #[rustc_const_stable(feature = "const_slice_len", since = "1.39.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)
#[rustc_allow_const_fn_unstable(const_fn_union)] #[rustc_allow_const_fn_unstable(const_fn_union)]
@ -127,7 +127,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")]
#[rustc_const_stable(feature = "const_slice_is_empty", since = "1.32.0")] #[rustc_const_stable(feature = "const_slice_is_empty", since = "1.39.0")]
#[inline] #[inline]
pub const fn is_empty(&self) -> bool { pub const fn is_empty(&self) -> bool {
self.len() == 0 self.len() == 0

View file

@ -140,7 +140,7 @@ impl str {
/// ``` /// ```
#[doc(alias = "length")] #[doc(alias = "length")]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_str_len", since = "1.32.0")] #[rustc_const_stable(feature = "const_str_len", since = "1.39.0")]
#[inline] #[inline]
pub const fn len(&self) -> usize { pub const fn len(&self) -> usize {
self.as_bytes().len() self.as_bytes().len()
@ -161,7 +161,7 @@ impl str {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_str_is_empty", since = "1.32.0")] #[rustc_const_stable(feature = "const_str_is_empty", since = "1.39.0")]
pub const fn is_empty(&self) -> bool { pub const fn is_empty(&self) -> bool {
self.len() == 0 self.len() == 0
} }
@ -217,7 +217,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")]
#[rustc_const_stable(feature = "str_as_bytes", since = "1.32.0")] #[rustc_const_stable(feature = "str_as_bytes", since = "1.39.0")]
#[inline(always)] #[inline(always)]
#[allow(unused_attributes)] #[allow(unused_attributes)]
#[rustc_allow_const_fn_unstable(const_fn_transmute)] #[rustc_allow_const_fn_unstable(const_fn_transmute)]

View file

@ -283,7 +283,7 @@ impl AtomicBool {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_atomic_new", since = "1.32.0")] #[rustc_const_stable(feature = "const_atomic_new", since = "1.24.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) }
} }
@ -883,7 +883,7 @@ impl<T> AtomicPtr<T> {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_atomic_new", since = "1.32.0")] #[rustc_const_stable(feature = "const_atomic_new", since = "1.24.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) }
} }
@ -2276,7 +2276,7 @@ macro_rules! atomic_int_ptr_sized {
stable(feature = "atomic_access", since = "1.15.0"), stable(feature = "atomic_access", since = "1.15.0"),
stable(feature = "atomic_from", since = "1.23.0"), stable(feature = "atomic_from", since = "1.23.0"),
stable(feature = "atomic_nand", since = "1.27.0"), stable(feature = "atomic_nand", since = "1.27.0"),
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"), rustc_const_stable(feature = "const_integer_atomics", since = "1.24.0"),
stable(feature = "rust1", since = "1.0.0"), stable(feature = "rust1", since = "1.0.0"),
"isize", "isize",
"", "",
@ -2296,7 +2296,7 @@ macro_rules! atomic_int_ptr_sized {
stable(feature = "atomic_access", since = "1.15.0"), stable(feature = "atomic_access", since = "1.15.0"),
stable(feature = "atomic_from", since = "1.23.0"), stable(feature = "atomic_from", since = "1.23.0"),
stable(feature = "atomic_nand", since = "1.27.0"), stable(feature = "atomic_nand", since = "1.27.0"),
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"), rustc_const_stable(feature = "const_integer_atomics", since = "1.24.0"),
stable(feature = "rust1", since = "1.0.0"), stable(feature = "rust1", since = "1.0.0"),
"usize", "usize",
"", "",