Skip to content

Commit

Permalink
Fix const stability since versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Mar 15, 2021
1 parent 0cc64a3 commit 6f3635d
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion library/alloc/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ impl String {
/// let s = String::new();
/// ```
#[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")]
pub const fn new() -> String {
String { vec: Vec::new() }
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/alloc/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl Layout {
/// This function is unsafe as it does not verify the preconditions from
/// [`Layout::from_size_align`].
#[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]
pub const unsafe fn from_size_align_unchecked(size: usize, align: usize) -> Self {
// SAFETY: the caller must ensure that `align` is greater than zero.
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ impl<T> Cell<T> {
/// let c = Cell::new(5);
/// ```
#[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]
pub const fn new(value: T) -> Cell<T> {
Cell { value: UnsafeCell::new(value) }
Expand Down Expand Up @@ -655,7 +655,7 @@ impl<T> RefCell<T> {
/// let c = RefCell::new(5);
/// ```
#[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]
pub const fn new(value: T) -> RefCell<T> {
RefCell { value: UnsafeCell::new(value), borrow: Cell::new(UNUSED) }
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[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 {
intrinsics::size_of::<T>()
}
Expand Down Expand Up @@ -440,7 +440,7 @@ pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[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 {
intrinsics::min_align_of::<T>()
}
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[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 {
0 as *const T
}
Expand All @@ -223,7 +223,7 @@ pub const fn null<T>() -> *const T {
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[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 {
0 as *mut T
}
Expand Down
6 changes: 3 additions & 3 deletions library/core/src/ptr/non_null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl<T: Sized> NonNull<T> {
/// sentinel value. Types that lazily allocate must track initialization by
/// some other means.
#[stable(feature = "nonnull", since = "1.25.0")]
#[rustc_const_stable(feature = "const_nonnull_dangling", since = "1.32.0")]
#[rustc_const_stable(feature = "const_nonnull_dangling", since = "1.36.0")]
#[inline]
pub const fn dangling() -> Self {
// SAFETY: mem::align_of() returns a non-zero usize which is then casted
Expand Down Expand Up @@ -156,7 +156,7 @@ impl<T: ?Sized> NonNull<T> {
///
/// `ptr` must be non-null.
#[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]
pub const unsafe fn new_unchecked(ptr: *mut T) -> Self {
// SAFETY: the caller must guarantee that `ptr` is non-null.
Expand Down Expand Up @@ -288,7 +288,7 @@ impl<T: ?Sized> NonNull<T> {

/// Casts to a pointer of another type.
#[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]
pub const fn cast<U>(self) -> NonNull<U> {
// SAFETY: `self` is a `NonNull` pointer which is necessarily non-null
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl<T> [T] {
/// ```
#[doc(alias = "length")]
#[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]
// 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)]
Expand Down Expand Up @@ -127,7 +127,7 @@ impl<T> [T] {
/// assert!(!a.is_empty());
/// ```
#[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]
pub const fn is_empty(&self) -> bool {
self.len() == 0
Expand Down
6 changes: 3 additions & 3 deletions library/core/src/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl str {
/// ```
#[doc(alias = "length")]
#[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]
pub const fn len(&self) -> usize {
self.as_bytes().len()
Expand All @@ -161,7 +161,7 @@ impl str {
/// ```
#[inline]
#[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 {
self.len() == 0
}
Expand Down Expand Up @@ -217,7 +217,7 @@ impl str {
/// assert_eq!(b"bors", bytes);
/// ```
#[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)]
#[allow(unused_attributes)]
#[rustc_allow_const_fn_unstable(const_fn_transmute)]
Expand Down
8 changes: 4 additions & 4 deletions library/core/src/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ impl AtomicBool {
/// ```
#[inline]
#[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 {
AtomicBool { v: UnsafeCell::new(v as u8) }
}
Expand Down Expand Up @@ -883,7 +883,7 @@ impl<T> AtomicPtr<T> {
/// ```
#[inline]
#[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> {
AtomicPtr { p: UnsafeCell::new(p) }
}
Expand Down Expand Up @@ -2276,7 +2276,7 @@ macro_rules! atomic_int_ptr_sized {
stable(feature = "atomic_access", since = "1.15.0"),
stable(feature = "atomic_from", since = "1.23.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"),
"isize",
"",
Expand All @@ -2296,7 +2296,7 @@ macro_rules! atomic_int_ptr_sized {
stable(feature = "atomic_access", since = "1.15.0"),
stable(feature = "atomic_from", since = "1.23.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"),
"usize",
"",
Expand Down

0 comments on commit 6f3635d

Please sign in to comment.