/// let list: LinkedList<u32> = LinkedList::new();
/// ```
#[inline]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_linked_list_new", since = "1.32.0"),
+ )]
#[stable(feature = "rust1", since = "1.0.0")]
pub const fn new() -> Self {
LinkedList {
/// let s = String::new();
/// ```
#[inline]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_string_new", since = "1.32.0"),
+ )]
#[stable(feature = "rust1", since = "1.0.0")]
pub const fn new() -> String {
String { vec: Vec::new() }
/// let mut vec: Vec<i32> = Vec::new();
/// ```
#[inline]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_vec_new", since = "1.32.0"),
+ )]
#[stable(feature = "rust1", since = "1.0.0")]
pub const fn new() -> Vec<T> {
Vec {
/// This function is unsafe as it does not verify the preconditions from
/// [`Layout::from_size_align`](#method.from_size_align).
#[stable(feature = "alloc_layout", since = "1.28.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "alloc_layout", since = "1.28.0"))]
#[inline]
pub const unsafe fn from_size_align_unchecked(size: usize, align: usize) -> Self {
Layout { size_: size, align_: NonZeroUsize::new_unchecked(align) }
/// assert_eq!(is_string(&"cookie monster".to_string()), true);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature="const_type_id")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature="const_type_id"))]
+ #[cfg_attr(not(bootstrap), rustc_const_unstable(feature="const_type_id", issue = "41875"))]
pub const fn of<T: ?Sized + 'static>() -> TypeId {
TypeId {
#[cfg(bootstrap)]
/// );
/// ```
#[stable(feature = "type_name", since = "1.38.0")]
-#[rustc_const_unstable(feature = "const_type_name")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_type_name"))]
+#[cfg_attr(not(bootstrap), rustc_const_unstable(feature = "const_type_name", issue = "63084"))]
pub const fn type_name<T: ?Sized>() -> &'static str {
intrinsics::type_name::<T>()
}
/// println!("{}", type_name_of_val(&y));
/// ```
#[unstable(feature = "type_name_of_val", issue = "66359")]
-#[rustc_const_unstable(feature = "const_type_name")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_type_name"))]
+#[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 {
let _ = val;
type_name::<T>()
/// let c = Cell::new(5);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_cell_new", since = "1.32.0"))]
#[inline]
pub const fn new(value: T) -> Cell<T> {
Cell {
/// ```
#[inline]
#[stable(feature = "cell_as_ptr", since = "1.12.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_cell_as_ptr", since = "1.32.0"))]
pub const fn as_ptr(&self) -> *mut T {
self.value.get()
}
/// let c = RefCell::new(5);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_refcell_new", since = "1.32.0"))]
#[inline]
pub const fn new(value: T) -> RefCell<T> {
RefCell {
/// let uc = UnsafeCell::new(5);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_unsafe_cell_new", since = "1.32.0"),
+ )]
#[inline]
pub const fn new(value: T) -> UnsafeCell<T> {
UnsafeCell { value }
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_unsafecell_get", since = "1.32.0"),
+ )]
pub const fn get(&self) -> *mut T {
// We can just cast the pointer from `UnsafeCell<T>` to `T` because of
// #[repr(transparent)]. This exploits libstd's special status, there is
/// assert!(!non_ascii.is_ascii());
/// ```
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_ascii_methods_on_intrinsics", since = "1.32.0"),
+ )]
#[inline]
pub const fn is_ascii(&self) -> bool {
*self as u32 <= 0x7F
/// assert_eq!(vec![1, 3], filtered);
/// ```
#[stable(feature = "convert_id", since = "1.33.0")]
+#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_identity", since = "1.33.0"))]
#[inline]
pub const fn identity<T>(x: T) -> T {
x
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_transmute")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_transmute"))]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_unstable(feature = "const_transmute", issue = "53605"),
+ )]
pub fn transmute<T, U>(e: T) -> U;
/// Returns `true` if the actual type given as `T` requires drop
/// assert_eq!(None, nope.next());
/// ```
#[stable(feature = "iter_empty", since = "1.2.0")]
+#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_iter_empty", since = "1.32.0"))]
pub const fn empty<T>() -> Empty<T> {
Empty(marker::PhantomData)
}
/// ManuallyDrop::new(Box::new(()));
/// ```
#[stable(feature = "manually_drop", since = "1.20.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_manually_drop", since = "1.36.0"),
+ )]
#[inline(always)]
pub const fn new(value: T) -> ManuallyDrop<T> {
ManuallyDrop { value }
/// let _: Box<()> = ManuallyDrop::into_inner(x); // This drops the `Box`.
/// ```
#[stable(feature = "manually_drop", since = "1.20.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_manually_drop", since = "1.36.0"),
+ )]
#[inline(always)]
pub const fn into_inner(slot: ManuallyDrop<T>) -> T {
slot.value
///
/// [`assume_init`]: #method.assume_init
#[stable(feature = "maybe_uninit", since = "1.36.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_maybe_uninit", since = "1.36.0"),
+ )]
#[inline(always)]
pub const fn new(val: T) -> MaybeUninit<T> {
MaybeUninit { value: ManuallyDrop::new(val) }
///
/// [type]: union.MaybeUninit.html
#[stable(feature = "maybe_uninit", since = "1.36.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_maybe_uninit", since = "1.36.0"),
+ )]
#[inline(always)]
#[cfg_attr(all(not(bootstrap)), rustc_diagnostic_item = "maybe_uninit_uninit")]
pub const fn uninit() -> MaybeUninit<T> {
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
+#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_size_of", since = "1.32.0"))]
pub const fn size_of<T>() -> usize {
intrinsics::size_of::<T>()
}
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
+#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_align_of", since = "1.32.0"))]
pub const fn align_of<T>() -> usize {
intrinsics::min_align_of::<T>()
}
/// ```
#[inline]
#[stable(feature = "needs_drop", since = "1.21.0")]
+#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_needs_drop", since = "1.36.0"))]
pub const fn needs_drop<T>() -> bool {
intrinsics::needs_drop::<T>()
}
///
/// The value must not be zero.
#[$stability]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "nonzero", since = "1.34.0"),
+ )]
#[inline]
pub const unsafe fn new_unchecked(n: $Int) -> Self {
$Ty(n)
/// Returns the value as a primitive type.
#[$stability]
#[inline]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "nonzero", since = "1.34.0"),
+ )]
pub const fn get(self) -> $Int {
self.0
}
#[stable(feature = "rust1", since = "1.0.0")]
#[inline(always)]
#[rustc_promotable]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_min_value", since = "1.32.0"),
+ )]
pub const fn min_value() -> Self {
!0 ^ ((!0 as $UnsignedT) >> 1) as Self
}
#[stable(feature = "rust1", since = "1.0.0")]
#[inline(always)]
#[rustc_promotable]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_max_value", since = "1.32.0"),
+ )]
pub const fn max_value() -> Self {
!Self::min_value()
}
```
"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[inline]
pub const fn count_ones(self) -> u32 { (self as $UnsignedT).count_ones() }
}
", $Feature, "assert_eq!(", stringify!($SelfT), "::max_value().count_zeros(), 1);", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[inline]
pub const fn count_zeros(self) -> u32 {
(!self).count_ones()
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[inline]
pub const fn leading_zeros(self) -> u32 {
(self as $UnsignedT).leading_zeros()
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[inline]
pub const fn trailing_zeros(self) -> u32 {
(self as $UnsignedT).trailing_zeros()
assert_eq!(n.rotate_left(", $rot, "), m);
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
assert_eq!(n.rotate_right(", $rot, "), m);
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
assert_eq!(m, ", $swapped, ");
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[inline]
pub const fn swap_bytes(self) -> Self {
(self as $UnsignedT).swap_bytes() as Self
assert_eq!(m, ", $reversed, ");
```"),
#[stable(feature = "reverse_bits", since = "1.37.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[inline]
#[must_use]
pub const fn reverse_bits(self) -> Self {
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_conversions", since = "1.32.0"),
+ )]
#[inline]
pub const fn from_be(x: Self) -> Self {
#[cfg(target_endian = "big")]
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_conversions", since = "1.32.0"),
+ )]
#[inline]
pub const fn from_le(x: Self) -> Self {
#[cfg(target_endian = "little")]
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_conversions", since = "1.32.0"),
+ )]
#[inline]
pub const fn to_be(self) -> Self { // or not to be?
#[cfg(target_endian = "big")]
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_conversions", since = "1.32.0"),
+ )]
#[inline]
pub const fn to_le(self) -> Self {
#[cfg(target_endian = "little")]
```"),
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_saturating_int_methods")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_saturating_int_methods"))]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_saturating_int_methods")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_saturating_int_methods"))]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
$EndFeature, "
```"),
#[stable(feature = "num_wrapping", since = "1.2.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[inline]
pub const fn wrapping_neg(self) -> Self {
self.overflowing_neg().0
$EndFeature, "
```"),
#[stable(feature = "num_wrapping", since = "1.2.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
$EndFeature, "
```"),
#[stable(feature = "num_wrapping", since = "1.2.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
$EndFeature, "
```"),
#[stable(feature = "no_panic_abs", since = "1.13.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[inline]
pub const fn wrapping_abs(self) -> Self {
// sign is -1 (all ones) for negative numbers, 0 otherwise.
"::MIN, true));", $EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
"::MAX, true));", $EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
$EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
```"),
#[inline]
#[stable(feature = "wrapping", since = "1.7.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
pub const fn overflowing_neg(self) -> (Self, bool) {
((!self).wrapping_add(1), self == Self::min_value())
}
$EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
$EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
$EndFeature, "
```"),
#[stable(feature = "no_panic_abs", since = "1.13.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[inline]
pub const fn overflowing_abs(self) -> (Self, bool) {
(self.wrapping_abs(), self == Self::min_value())
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[inline]
#[rustc_inherit_overflow_checks]
pub const fn abs(self) -> Self {
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_int_sign")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_sign"))]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_unstable(feature = "const_int_sign", issue = "53718"),
+ )]
#[inline]
pub const fn signum(self) -> Self {
(self > 0) as Self - (self < 0) as Self
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[inline]
pub const fn is_positive(self) -> bool { self > 0 }
}
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_int_methods", since = "1.32.0"),
+ )]
#[inline]
pub const fn is_negative(self) -> bool { self < 0 }
}
assert_eq!(bytes, ", $be_bytes, ");
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
- #[rustc_const_unstable(feature = "const_int_conversion")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
+ )]
#[inline]
pub const fn to_be_bytes(self) -> [u8; mem::size_of::<Self>()] {
self.to_be().to_ne_bytes()
assert_eq!(bytes, ", $le_bytes, ");
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
- #[rustc_const_unstable(feature = "const_int_conversion")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
+ )]
#[inline]
pub const fn to_le_bytes(self) -> [u8; mem::size_of::<Self>()] {
self.to_le().to_ne_bytes()
);
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
- #[rustc_const_unstable(feature = "const_int_conversion")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
+ )]
#[inline]
pub const fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] {
// SAFETY: integers are plain old datatypes so we can always transmute them to
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
- #[rustc_const_unstable(feature = "const_int_conversion")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
+ )]
#[inline]
pub const fn from_be_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
Self::from_be(Self::from_ne_bytes(bytes))
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
- #[rustc_const_unstable(feature = "const_int_conversion")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
+ )]
#[inline]
pub const fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
Self::from_le(Self::from_ne_bytes(bytes))
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
- #[rustc_const_unstable(feature = "const_int_conversion")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
+ )]
#[inline]
pub const fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
// SAFETY: integers are plain old datatypes so we can always transmute to them
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
#[inline(always)]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_min_value", since = "1.32.0"),
+ )]
pub const fn min_value() -> Self { 0 }
}
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
#[inline(always)]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_max_value", since = "1.32.0"),
+ )]
pub const fn max_value() -> Self { !0 }
}
assert_eq!(n.count_ones(), 3);", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_math", since = "1.32.0"),
+ )]
#[inline]
pub const fn count_ones(self) -> u32 {
intrinsics::ctpop(self as $ActualT) as u32
", $Feature, "assert_eq!(", stringify!($SelfT), "::max_value().count_zeros(), 0);", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_math", since = "1.32.0"),
+ )]
#[inline]
pub const fn count_zeros(self) -> u32 {
(!self).count_ones()
assert_eq!(n.leading_zeros(), 2);", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_math", since = "1.32.0"),
+ )]
#[inline]
pub const fn leading_zeros(self) -> u32 {
intrinsics::ctlz(self as $ActualT) as u32
assert_eq!(n.trailing_zeros(), 3);", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_math", since = "1.32.0"),
+ )]
#[inline]
pub const fn trailing_zeros(self) -> u32 {
intrinsics::cttz(self) as u32
assert_eq!(n.rotate_left(", $rot, "), m);
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_math", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
assert_eq!(n.rotate_right(", $rot, "), m);
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_math", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
assert_eq!(m, ", $swapped, ");
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_math", since = "1.32.0"),
+ )]
#[inline]
pub const fn swap_bytes(self) -> Self {
intrinsics::bswap(self as $ActualT) as Self
assert_eq!(m, ", $reversed, ");
```"),
#[stable(feature = "reverse_bits", since = "1.37.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_math", since = "1.32.0"),
+ )]
#[inline]
#[must_use]
pub const fn reverse_bits(self) -> Self {
}", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_math", since = "1.32.0"),
+ )]
#[inline]
pub const fn from_be(x: Self) -> Self {
#[cfg(target_endian = "big")]
}", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_math", since = "1.32.0"),
+ )]
#[inline]
pub const fn from_le(x: Self) -> Self {
#[cfg(target_endian = "little")]
}", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_math", since = "1.32.0"),
+ )]
#[inline]
pub const fn to_be(self) -> Self { // or not to be?
#[cfg(target_endian = "big")]
}", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_math", since = "1.32.0"),
+ )]
#[inline]
pub const fn to_le(self) -> Self {
#[cfg(target_endian = "little")]
#[stable(feature = "rust1", since = "1.0.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
- #[rustc_const_unstable(feature = "const_saturating_int_methods")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_saturating_int_methods"))]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718"),
+ )]
#[inline]
pub const fn saturating_add(self, rhs: Self) -> Self {
intrinsics::saturating_add(self, rhs)
#[stable(feature = "rust1", since = "1.0.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
- #[rustc_const_unstable(feature = "const_saturating_int_methods")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_saturating_int_methods"))]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718"),
+ )]
#[inline]
pub const fn saturating_sub(self, rhs: Self) -> Self {
intrinsics::saturating_sub(self, rhs)
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
/// assert_eq!(25u8.wrapping_mul(12), 44);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
/// assert_eq!((-128i8).wrapping_neg(), -128);
/// ```
#[stable(feature = "num_wrapping", since = "1.2.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
+ )]
#[inline]
pub const fn wrapping_neg(self) -> Self {
self.overflowing_neg().0
assert_eq!(1", stringify!($SelfT), ".wrapping_shl(128), 1);", $EndFeature, "
```"),
#[stable(feature = "num_wrapping", since = "1.2.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
assert_eq!(128", stringify!($SelfT), ".wrapping_shr(128), 128);", $EndFeature, "
```"),
#[stable(feature = "num_wrapping", since = "1.2.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
assert_eq!(", stringify!($SelfT), "::MAX.overflowing_add(1), (0, true));", $EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
$EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
/// assert_eq!(1_000_000_000u32.overflowing_mul(10), (1410065408, true));
/// ```
#[stable(feature = "wrapping", since = "1.7.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
```"),
#[inline]
#[stable(feature = "wrapping", since = "1.7.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
+ )]
pub const fn overflowing_neg(self) -> (Self, bool) {
((!self).wrapping_add(1), self != 0)
}
assert_eq!(0x1", stringify!($SelfT), ".overflowing_shl(132), (0x10, true));", $EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
assert_eq!(0x10", stringify!($SelfT), ".overflowing_shr(132), (0x1, true));", $EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0"),
+ )]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
assert!(!10", stringify!($SelfT), ".is_power_of_two());", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_is_power_of_two", since = "1.32.0"),
+ )]
#[inline]
pub const fn is_power_of_two(self) -> bool {
self.count_ones() == 1
assert_eq!(bytes, ", $be_bytes, ");
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
- #[rustc_const_unstable(feature = "const_int_conversion")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
+ )]
#[inline]
pub const fn to_be_bytes(self) -> [u8; mem::size_of::<Self>()] {
self.to_be().to_ne_bytes()
assert_eq!(bytes, ", $le_bytes, ");
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
- #[rustc_const_unstable(feature = "const_int_conversion")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
+ )]
#[inline]
pub const fn to_le_bytes(self) -> [u8; mem::size_of::<Self>()] {
self.to_le().to_ne_bytes()
);
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
- #[rustc_const_unstable(feature = "const_int_conversion")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
+ )]
#[inline]
pub const fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] {
// SAFETY: integers are plain old datatypes so we can always transmute them to
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
- #[rustc_const_unstable(feature = "const_int_conversion")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
+ )]
#[inline]
pub const fn from_be_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
Self::from_be(Self::from_ne_bytes(bytes))
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
- #[rustc_const_unstable(feature = "const_int_conversion")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
+ )]
#[inline]
pub const fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
Self::from_le(Self::from_ne_bytes(bytes))
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
- #[rustc_const_unstable(feature = "const_int_conversion")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_int_conversion"))]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_unstable(feature = "const_int_conversion", issue = "53718"),
+ )]
#[inline]
pub const fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
// SAFETY: integers are plain old datatypes so we can always transmute to them
/// assert_eq!(m, Wrapping(-22016));
/// ```
#[stable(feature = "reverse_bits", since = "1.37.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_reverse_bits", since = "1.37.0"),
+ )]
#[inline]
#[must_use]
pub const fn reverse_bits(self) -> Self {
#[stable(feature = "inclusive_range_methods", since = "1.27.0")]
#[inline]
#[rustc_promotable]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_range_new", since = "1.32.0"))]
pub const fn new(start: Idx, end: Idx) -> Self {
Self { start, end, is_empty: None }
}
/// assert_eq!((3..=5).start(), &3);
/// ```
#[stable(feature = "inclusive_range_methods", since = "1.27.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_inclusive_range_methods", since = "1.32.0"),
+ )]
#[inline]
pub const fn start(&self) -> &Idx {
&self.start
/// assert_eq!((3..=5).end(), &5);
/// ```
#[stable(feature = "inclusive_range_methods", since = "1.27.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_inclusive_range_methods", since = "1.32.0"),
+ )]
#[inline]
pub const fn end(&self) -> &Idx {
&self.end
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
+#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_ptr_null", since = "1.32.0"))]
pub const fn null<T>() -> *const T {
0 as *const T
}
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
+#[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_ptr_null", since = "1.32.0"))]
pub const fn null_mut<T>() -> *mut T {
0 as *mut T
}
/// Casts to a pointer of another type.
#[stable(feature = "ptr_cast", since = "1.38.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_ptr_cast", since = "1.38.0"))]
#[inline]
pub const fn cast<U>(self) -> *const U {
self as _
/// }
/// ```
#[unstable(feature = "ptr_offset_from", issue = "41079")]
- #[rustc_const_unstable(feature = "const_ptr_offset_from")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_ptr_offset_from"))]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_unstable(feature = "const_ptr_offset_from", issue = "41079"),
+ )]
#[inline]
pub const unsafe fn offset_from(self, origin: *const T) -> isize
where
/// Casts to a pointer of another type.
#[stable(feature = "ptr_cast", since = "1.38.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_ptr_cast", since = "1.38.0"))]
#[inline]
pub const fn cast<U>(self) -> *mut U {
self as _
/// }
/// ```
#[unstable(feature = "ptr_offset_from", issue = "41079")]
- #[rustc_const_unstable(feature = "const_ptr_offset_from")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_ptr_offset_from"))]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_unstable(feature = "const_ptr_offset_from", issue = "41079"),
+ )]
#[inline]
pub const unsafe fn offset_from(self, origin: *const T) -> isize
where
/// sentinel value. Types that lazily allocate must track initialization by
/// some other means.
#[stable(feature = "nonnull", since = "1.25.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_nonnull_dangling", since = "1.32.0"),
+ )]
#[inline]
pub const fn dangling() -> Self {
unsafe {
///
/// `ptr` must be non-null.
#[stable(feature = "nonnull", since = "1.25.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_nonnull_new_unchecked", since = "1.32.0"),
+ )]
#[inline]
pub const unsafe fn new_unchecked(ptr: *mut T) -> Self {
NonNull { pointer: ptr as _ }
/// Acquires the underlying `*mut` pointer.
#[stable(feature = "nonnull", since = "1.25.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_nonnull_as_ptr", since = "1.32.0"),
+ )]
#[inline]
pub const fn as_ptr(self) -> *mut T {
self.pointer as *mut T
/// Casts to a pointer of another type.
#[stable(feature = "nonnull_cast", since = "1.27.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_nonnull_cast", since = "1.32.0"),
+ )]
#[inline]
pub const fn cast<U>(self) -> NonNull<U> {
unsafe { NonNull::new_unchecked(self.as_ptr() as *mut U) }
/// assert_eq!(a.len(), 3);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_slice_len", since = "1.32.0"))]
#[inline]
// SAFETY: const sound because we transmute out the length field as a usize (which it must be)
#[allow(unused_attributes)]
/// assert!(!a.is_empty());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_slice_is_empty", since = "1.32.0"),
+ )]
#[inline]
pub const fn is_empty(&self) -> bool {
self.len() == 0
///
/// [`as_mut_ptr`]: #method.as_mut_ptr
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_slice_as_ptr", since = "1.32.0"),
+ )]
#[inline]
pub const fn as_ptr(&self) -> *const T {
self as *const [T] as *const T
/// assert_eq!("Æ’oo".chars().count(), 3);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_str_len", since = "1.32.0"))]
#[inline]
pub const fn len(&self) -> usize {
self.as_bytes().len()
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(
+ not(bootstrap),
+ rustc_const_stable(feature = "const_str_is_empty", since = "1.32.0"),
+ )]
pub const fn is_empty(&self) -> bool {
self.len() == 0
}
/// assert_eq!(b"bors", bytes);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "str_as_bytes", since = "1.32.0"))]
#[inline(always)]
// SAFETY: const sound because we transmute two types with the same layout
#[allow(unused_attributes)]
/// let ptr = s.as_ptr();
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "rustc_str_as_ptr", since = "1.32.0"))]
#[inline]
pub const fn as_ptr(&self) -> *const u8 {
self as *const str as *const u8
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_atomic_new", since = "1.32.0"))]
pub const fn new(v: bool) -> AtomicBool {
AtomicBool { v: UnsafeCell::new(v as u8) }
}
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_atomic_new", since = "1.32.0"))]
pub const fn new(p: *mut T) -> AtomicPtr<T> {
AtomicPtr { p: UnsafeCell::new(p) }
}
$stable_access:meta,
$stable_from:meta,
$stable_nand:meta,
+ $const_stable:meta,
+ $const_stable_cxchg:meta,
+ $const_stable_debug:meta,
+ $const_stable_access:meta,
+ $const_stable_from:meta,
+ $const_stable_nand:meta,
$stable_init_const:meta,
$s_int_type:expr, $int_ref:expr,
$extra_feature:expr,
```"),
#[inline]
#[$stable]
+ #[cfg_attr(not(bootstrap), $const_stable)]
pub const fn new(v: $int_type) -> Self {
$atomic_type {v: UnsafeCell::new(v)}
}
stable(feature = "integer_atomics_stable", since = "1.34.0"),
stable(feature = "integer_atomics_stable", since = "1.34.0"),
stable(feature = "integer_atomics_stable", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
unstable(feature = "integer_atomics", issue = "32976"),
"i8", "../../../std/primitive.i8.html",
"",
stable(feature = "integer_atomics_stable", since = "1.34.0"),
stable(feature = "integer_atomics_stable", since = "1.34.0"),
stable(feature = "integer_atomics_stable", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
unstable(feature = "integer_atomics", issue = "32976"),
"u8", "../../../std/primitive.u8.html",
"",
stable(feature = "integer_atomics_stable", since = "1.34.0"),
stable(feature = "integer_atomics_stable", since = "1.34.0"),
stable(feature = "integer_atomics_stable", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
unstable(feature = "integer_atomics", issue = "32976"),
"i16", "../../../std/primitive.i16.html",
"",
stable(feature = "integer_atomics_stable", since = "1.34.0"),
stable(feature = "integer_atomics_stable", since = "1.34.0"),
stable(feature = "integer_atomics_stable", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
unstable(feature = "integer_atomics", issue = "32976"),
"u16", "../../../std/primitive.u16.html",
"",
stable(feature = "integer_atomics_stable", since = "1.34.0"),
stable(feature = "integer_atomics_stable", since = "1.34.0"),
stable(feature = "integer_atomics_stable", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
unstable(feature = "integer_atomics", issue = "32976"),
"i32", "../../../std/primitive.i32.html",
"",
stable(feature = "integer_atomics_stable", since = "1.34.0"),
stable(feature = "integer_atomics_stable", since = "1.34.0"),
stable(feature = "integer_atomics_stable", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
unstable(feature = "integer_atomics", issue = "32976"),
"u32", "../../../std/primitive.u32.html",
"",
stable(feature = "integer_atomics_stable", since = "1.34.0"),
stable(feature = "integer_atomics_stable", since = "1.34.0"),
stable(feature = "integer_atomics_stable", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
unstable(feature = "integer_atomics", issue = "32976"),
"i64", "../../../std/primitive.i64.html",
"",
stable(feature = "integer_atomics_stable", since = "1.34.0"),
stable(feature = "integer_atomics_stable", since = "1.34.0"),
stable(feature = "integer_atomics_stable", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
unstable(feature = "integer_atomics", issue = "32976"),
"u64", "../../../std/primitive.u64.html",
"",
unstable(feature = "integer_atomics", issue = "32976"),
unstable(feature = "integer_atomics", issue = "32976"),
unstable(feature = "integer_atomics", issue = "32976"),
+ rustc_const_unstable(feature = "const_integer_atomics", issue = "32976"),
+ rustc_const_unstable(feature = "const_integer_atomics", issue = "32976"),
+ rustc_const_unstable(feature = "const_integer_atomics", issue = "32976"),
+ rustc_const_unstable(feature = "const_integer_atomics", issue = "32976"),
+ rustc_const_unstable(feature = "const_integer_atomics", issue = "32976"),
+ rustc_const_unstable(feature = "const_integer_atomics", issue = "32976"),
unstable(feature = "integer_atomics", issue = "32976"),
"i128", "../../../std/primitive.i128.html",
"#![feature(integer_atomics)]\n\n",
unstable(feature = "integer_atomics", issue = "32976"),
unstable(feature = "integer_atomics", issue = "32976"),
unstable(feature = "integer_atomics", issue = "32976"),
+ rustc_const_unstable(feature = "const_integer_atomics", issue = "32976"),
+ rustc_const_unstable(feature = "const_integer_atomics", issue = "32976"),
+ rustc_const_unstable(feature = "const_integer_atomics", issue = "32976"),
+ rustc_const_unstable(feature = "const_integer_atomics", issue = "32976"),
+ rustc_const_unstable(feature = "const_integer_atomics", issue = "32976"),
+ rustc_const_unstable(feature = "const_integer_atomics", issue = "32976"),
unstable(feature = "integer_atomics", issue = "32976"),
"u128", "../../../std/primitive.u128.html",
"#![feature(integer_atomics)]\n\n",
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.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
stable(feature = "rust1", since = "1.0.0"),
"isize", "../../../std/primitive.isize.html",
"",
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.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
+ rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
stable(feature = "rust1", since = "1.0.0"),
"usize", "../../../std/primitive.usize.html",
"",
/// function in the `vtable` of the underlying `RawWaker` will be called.
#[rustc_promotable]
#[stable(feature = "futures_api", since = "1.36.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "futures_api", since = "1.36.0"))]
pub const fn new(data: *const (), vtable: &'static RawWakerVTable) -> RawWaker {
RawWaker { data, vtable }
}
// FIXME: remove whenever we have a stable way to accept fn pointers from const fn
// (see https://github.com/rust-rfcs/const-eval/issues/19#issuecomment-472799062)
#[rustc_allow_const_fn_ptr]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "futures_api", since = "1.36.0"))]
pub const fn new(
clone: unsafe fn(*const ()) -> RawWaker,
wake: unsafe fn(*const ()),
/// ```
#[stable(feature = "duration", since = "1.3.0")]
#[inline]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration_consts", since = "1.32.0"))]
pub fn new(secs: u64, nanos: u32) -> Duration {
let secs =
secs.checked_add((nanos / NANOS_PER_SEC) as u64).expect("overflow in Duration::new");
#[stable(feature = "duration", since = "1.3.0")]
#[inline]
#[rustc_promotable]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration_consts", since = "1.32.0"))]
pub const fn from_secs(secs: u64) -> Duration {
Duration { secs, nanos: 0 }
}
#[stable(feature = "duration", since = "1.3.0")]
#[inline]
#[rustc_promotable]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration_consts", since = "1.32.0"))]
pub const fn from_millis(millis: u64) -> Duration {
Duration {
secs: millis / MILLIS_PER_SEC,
#[stable(feature = "duration_from_micros", since = "1.27.0")]
#[inline]
#[rustc_promotable]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration_consts", since = "1.32.0"))]
pub const fn from_micros(micros: u64) -> Duration {
Duration {
secs: micros / MICROS_PER_SEC,
#[stable(feature = "duration_extras", since = "1.27.0")]
#[inline]
#[rustc_promotable]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration_consts", since = "1.32.0"))]
pub const fn from_nanos(nanos: u64) -> Duration {
Duration {
secs: nanos / (NANOS_PER_SEC as u64),
///
/// [`subsec_nanos`]: #method.subsec_nanos
#[stable(feature = "duration", since = "1.3.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration", since = "1.32.0"))]
#[inline]
pub const fn as_secs(&self) -> u64 {
self.secs
/// assert_eq!(duration.subsec_millis(), 432);
/// ```
#[stable(feature = "duration_extras", since = "1.27.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration_extras", since = "1.32.0"))]
#[inline]
pub const fn subsec_millis(&self) -> u32 {
self.nanos / NANOS_PER_MILLI
/// assert_eq!(duration.subsec_micros(), 234_567);
/// ```
#[stable(feature = "duration_extras", since = "1.27.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration_extras", since = "1.32.0"))]
#[inline]
pub const fn subsec_micros(&self) -> u32 {
self.nanos / NANOS_PER_MICRO
/// assert_eq!(duration.subsec_nanos(), 10_000_000);
/// ```
#[stable(feature = "duration", since = "1.3.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration", since = "1.32.0"))]
#[inline]
pub const fn subsec_nanos(&self) -> u32 {
self.nanos
/// assert_eq!(duration.as_millis(), 5730);
/// ```
#[stable(feature = "duration_as_u128", since = "1.33.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration_as_u128", since = "1.33.0"))]
#[inline]
pub const fn as_millis(&self) -> u128 {
self.secs as u128 * MILLIS_PER_SEC as u128 + (self.nanos / NANOS_PER_MILLI) as u128
/// assert_eq!(duration.as_micros(), 5730023);
/// ```
#[stable(feature = "duration_as_u128", since = "1.33.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration_as_u128", since = "1.33.0"))]
#[inline]
pub const fn as_micros(&self) -> u128 {
self.secs as u128 * MICROS_PER_SEC as u128 + (self.nanos / NANOS_PER_MICRO) as u128
/// assert_eq!(duration.as_nanos(), 5730023852);
/// ```
#[stable(feature = "duration_as_u128", since = "1.33.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "duration_as_u128", since = "1.33.0"))]
#[inline]
pub const fn as_nanos(&self) -> u128 {
self.secs as u128 * NANOS_PER_SEC as u128 + self.nanos as u128
use syntax::ast::{Attribute, CRATE_NODE_ID};
use syntax::errors::Applicability;
use syntax::feature_gate::{feature_err, feature_err_issue};
-use syntax::attr::{self, Stability, Deprecation, RustcDeprecation};
+use syntax::attr::{self, Stability, Deprecation, RustcDeprecation, ConstStability};
use crate::ty::{self, TyCtxt};
use crate::util::nodemap::{FxHashSet, FxHashMap};
/// This is mostly a cache, except the stabilities of local items
/// are filled by the annotator.
stab_map: FxHashMap<HirId, &'tcx Stability>,
+ const_stab_map: FxHashMap<HirId, &'tcx ConstStability>,
depr_map: FxHashMap<HirId, DeprecationEntry>,
/// Maps for each crate whether it is part of the staged API.
self.tcx.sess.span_err(item_sp, "`#[deprecated]` cannot be used in staged API; \
use `#[rustc_deprecated]` instead");
}
- if let Some(mut stab) = attr::find_stability(&self.tcx.sess.parse_sess,
- attrs, item_sp) {
+ let (stab, const_stab) = attr::find_stability(
+ &self.tcx.sess.parse_sess, attrs, item_sp,
+ );
+ if let Some(const_stab) = const_stab {
+ let const_stab = self.tcx.intern_const_stability(const_stab);
+ self.index.const_stab_map.insert(hir_id, const_stab);
+ }
+ if let Some(mut stab) = stab {
// Error if prohibited, or can't inherit anything from a container.
if kind == AnnotationKind::Prohibited ||
(kind == AnnotationKind::Container &&
sym::unstable, sym::stable,
sym::rustc_deprecated,
sym::rustc_const_unstable,
+ sym::rustc_const_stable,
];
for attr in attrs {
let name = attr.name_or_empty();
let mut index = Index {
staged_api,
stab_map: Default::default(),
+ const_stab_map: Default::default(),
depr_map: Default::default(),
active_features: Default::default(),
};
},
feature: sym::rustc_private,
rustc_depr: None,
- const_stability: None,
- promotable: false,
- allow_const_fn_ptr: false,
});
annotator.parent_stab = Some(stability);
}
self.stab_map.get(&id).cloned()
}
+ pub fn local_const_stability(&self, id: HirId) -> Option<&'tcx ConstStability> {
+ self.const_stab_map.get(&id).cloned()
+ }
+
pub fn local_deprecation_entry(&self, id: HirId) -> Option<DeprecationEntry> {
self.depr_map.get(&id).cloned()
}
eval_always
}
query lookup_stability(_: DefId) -> Option<&'tcx attr::Stability> {}
+ query lookup_const_stability(_: DefId) -> Option<&'tcx attr::ConstStability> {}
query lookup_deprecation_entry(_: DefId) -> Option<DeprecationEntry> {}
query item_attrs(_: DefId) -> Lrc<[ast::Attribute]> {}
}
/// Whether the `def_id` is an unstable const fn and what feature gate is necessary to enable it
pub fn is_unstable_const_fn(self, def_id: DefId) -> Option<Symbol> {
if self.is_const_fn_raw(def_id) {
- self.lookup_stability(def_id)?.const_stability
+ let const_stab = self.lookup_const_stability(def_id)?;
+ if const_stab.level.is_unstable() {
+ Some(const_stab.feature)
+ } else {
+ None
+ }
} else {
None
}
}
if self.features().staged_api {
- // in order for a libstd function to be considered min_const_fn
- // it needs to be stable and have no `rustc_const_unstable` attribute
- match self.lookup_stability(def_id) {
- // stable functions with unstable const fn aren't `min_const_fn`
- Some(&attr::Stability { const_stability: Some(_), .. }) => false,
- // unstable functions don't need to conform
- Some(&attr::Stability { ref level, .. }) if level.is_unstable() => false,
- // everything else needs to conform, because it would be callable from
- // other `min_const_fn` functions
+ // In order for a libstd function to be considered min_const_fn
+ // it needs to be stable and have no `rustc_const_unstable` attribute.
+ match self.lookup_const_stability(def_id) {
+ // `rustc_const_unstable` functions don't need to conform.
+ Some(&attr::ConstStability { ref level, .. }) if level.is_unstable() => false,
+ None => if let Some(stab) = self.lookup_stability(def_id) {
+ if stab.level.is_stable() {
+ self.sess.span_err(
+ self.def_span(def_id),
+ "stable const functions must have either `rustc_const_stable` or \
+ `rustc_const_unstable` attribute",
+ );
+ // While we errored above, because we don't know if we need to conform, we
+ // err on the "safe" side and require min_const_fn.
+ true
+ } else {
+ // Unstable functions need not conform to min const fn.
+ false
+ }
+ } else {
+ // Unstable functions or internal functions need not conform to min const fn.
+ false
+ },
+ // Everything else needs to conform, because it would be callable from
+ // other `min_const_fn` functions.
_ => true,
}
} else {
}
fn is_promotable_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
- tcx.is_const_fn(def_id) && match tcx.lookup_stability(def_id) {
+ tcx.is_const_fn(def_id) && match tcx.lookup_const_stability(def_id) {
Some(stab) => {
if cfg!(debug_assertions) && stab.promotable {
let sig = tcx.fn_sig(def_id);
fn const_fn_is_allowed_fn_ptr(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
tcx.is_const_fn(def_id) &&
- tcx.lookup_stability(def_id)
+ tcx.lookup_const_stability(def_id)
.map(|stab| stab.allow_const_fn_ptr).unwrap_or(false)
}
/// Data layout specification for the current target.
pub data_layout: TargetDataLayout,
+ /// `#[stable]` and `#[unstable]` attributes
stability_interner: ShardedHashMap<&'tcx attr::Stability, ()>,
+ /// `#[rustc_const_stable]` and `#[rustc_const_unstable]` attributes
+ const_stability_interner: ShardedHashMap<&'tcx attr::ConstStability, ()>,
+
/// Stores the value of constants (and deduplicates the actual memory)
allocation_interner: ShardedHashMap<&'tcx Allocation, ()>,
})
}
+ pub fn intern_const_stability(self, stab: attr::ConstStability) -> &'tcx attr::ConstStability {
+ self.const_stability_interner.intern(stab, |stab| {
+ self.arena.alloc(stab)
+ })
+ }
+
pub fn intern_layout(self, layout: LayoutDetails) -> &'tcx LayoutDetails {
self.layout_interner.intern(layout, |layout| {
self.arena.alloc(layout)
data_layout,
layout_interner: Default::default(),
stability_interner: Default::default(),
+ const_stability_interner: Default::default(),
allocation_interner: Default::default(),
alloc_map: Lock::new(interpret::AllocMap::new()),
output_filenames: Arc::new(output_filenames.clone()),
println!("InternalSubsts interner: #{}", self.interners.substs.len());
println!("Region interner: #{}", self.interners.region.len());
println!("Stability interner: #{}", self.stability_interner.len());
+ println!("Const Stability interner: #{}", self.const_stability_interner.len());
println!("Allocation interner: #{}", self.allocation_interner.len());
println!("Layout interner: #{}", self.layout_interner.len());
}
let id = tcx.hir().definitions().def_index_to_hir_id(id.index);
tcx.stability().local_stability(id)
};
+ providers.lookup_const_stability = |tcx, id| {
+ assert_eq!(id.krate, LOCAL_CRATE);
+ let id = tcx.hir().definitions().def_index_to_hir_id(id.index);
+ tcx.stability().local_const_stability(id)
+ };
providers.lookup_deprecation_entry = |tcx, id| {
assert_eq!(id.krate, LOCAL_CRATE);
let id = tcx.hir().definitions().def_index_to_hir_id(id.index);
),
// FIXME(#14407)
ungated!(rustc_const_unstable, Whitelisted, template!(List: r#"feature = "name""#)),
+ // FIXME(#14407)
+ ungated!(rustc_const_stable, Whitelisted, template!(List: r#"feature = "name""#)),
gated!(
allow_internal_unstable, Normal, template!(Word, List: "feat1, feat2, ..."),
"allow_internal_unstable side-steps feature gating and stability checks",
}
}
+ fn get_const_stability(&self, id: DefIndex) -> Option<attr::ConstStability> {
+ self.root.per_def.const_stability.get(self, id).map(|stab| stab.decode(self))
+ }
+
fn get_deprecation(&self, id: DefIndex) -> Option<attr::Deprecation> {
self.root.per_def.deprecation.get(self, id)
.filter(|_| !self.is_proc_macro(id))
lookup_stability => {
cdata.get_stability(def_id.index).map(|s| tcx.intern_stability(s))
}
+ lookup_const_stability => {
+ cdata.get_const_stability(def_id.index).map(|s| tcx.intern_const_stability(s))
+ }
lookup_deprecation_entry => {
cdata.get_deprecation(def_id.index).map(DeprecationEntry::external)
}
record!(self.per_def.span[def_id] <- ast_item.span);
record!(self.per_def.attributes[def_id] <- &ast_item.attrs);
self.encode_stability(def_id);
+ self.encode_const_stability(def_id);
self.encode_deprecation(def_id);
match trait_item.kind {
ty::AssocKind::Const |
record!(self.per_def.span[def_id] <- ast_item.span);
record!(self.per_def.attributes[def_id] <- &ast_item.attrs);
self.encode_stability(def_id);
+ self.encode_const_stability(def_id);
self.encode_deprecation(def_id);
self.encode_item_type(def_id);
if impl_item.kind == ty::AssocKind::Method {
}
}
+ fn encode_const_stability(&mut self, def_id: DefId) {
+ debug!("EncodeContext::encode_const_stability({:?})", def_id);
+ if let Some(stab) = self.tcx.lookup_const_stability(def_id) {
+ record!(self.per_def.const_stability[def_id] <- stab)
+ }
+ }
+
fn encode_deprecation(&mut self, def_id: DefId) {
debug!("EncodeContext::encode_deprecation({:?})", def_id);
if let Some(depr) = self.tcx.lookup_deprecation(def_id) {
_ => {}
}
self.encode_stability(def_id);
+ self.encode_const_stability(def_id);
self.encode_deprecation(def_id);
match item.kind {
hir::ItemKind::Static(..) |
record!(self.per_def.span[def_id] <- nitem.span);
record!(self.per_def.attributes[def_id] <- &nitem.attrs);
self.encode_stability(def_id);
+ self.encode_const_stability(def_id);
self.encode_deprecation(def_id);
self.encode_item_type(def_id);
if let hir::ForeignItemKind::Fn(..) = nitem.kind {
attributes: Table<DefIndex, Lazy<[ast::Attribute]>>,
children: Table<DefIndex, Lazy<[DefIndex]>>,
stability: Table<DefIndex, Lazy<attr::Stability>>,
+ const_stability: Table<DefIndex, Lazy<attr::ConstStability>>,
deprecation: Table<DefIndex, Lazy<attr::Deprecation>>,
ty: Table<DefIndex, Lazy!(Ty<'tcx>)>,
fn_sig: Table<DefIndex, Lazy!(ty::PolyFnSig<'tcx>)>,
/// ```
#[inline]
#[stable(feature = "cstr_from_bytes", since = "1.10.0")]
- #[rustc_const_unstable(feature = "const_cstr_unchecked")]
+ #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_cstr_unchecked"))]
+ #[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 {
&*(bytes as *const [u8] as *const CStr)
}
/// [`CString`]: struct.CString.html
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_str_as_ptr", since = "1.32.0"))]
pub const fn as_ptr(&self) -> *const c_char {
self.inner.as_ptr()
}
/// let addr = Ipv4Addr::new(127, 0, 0, 1);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_ipv4", since = "1.32.0"))]
pub const fn new(a: u8, b: u8, c: u8, d: u8) -> Ipv4Addr {
// FIXME: should just be u32::from_be_bytes([a, b, c, d]),
// once that method is no longer rustc_const_unstable
/// assert_eq!(Ipv4Addr::new(45, 22, 13, 197).is_unspecified(), false);
/// ```
#[stable(feature = "ip_shared", since = "1.12.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_ipv4", since = "1.32.0"))]
pub const fn is_unspecified(&self) -> bool {
self.inner.s_addr == 0
}
/// let addr = Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_ipv6", since = "1.32.0"))]
pub const fn new(a: u16, b: u16, c: u16, d: u16, e: u16, f: u16,
g: u16, h: u16) -> Ipv6Addr {
Ipv6Addr {
/// [255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
/// ```
#[stable(feature = "ipv6_to_octets", since = "1.12.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_ipv6", since = "1.32.0"))]
pub const fn octets(&self) -> [u8; 16] {
self.inner.s6_addr
}
impl Once {
/// Creates a new `Once` value.
#[stable(feature = "once_new", since = "1.2.0")]
+ #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_once_new", since = "1.32.0"))]
pub const fn new() -> Once {
Once { state_and_queue: AtomicUsize::new(INCOMPLETE), _marker: marker::PhantomData }
}
})
}
-/// Represents the #[stable], #[unstable], #[rustc_{deprecated,const_unstable}] attributes.
+/// Represents the #[stable], #[unstable], #[rustc_deprecated] attributes.
#[derive(RustcEncodable, RustcDecodable, Copy, Clone, Debug,
PartialEq, Eq, Hash, HashStable_Generic)]
pub struct Stability {
pub level: StabilityLevel,
pub feature: Symbol,
pub rustc_depr: Option<RustcDeprecation>,
- /// `None` means the function is stable but needs to be a stable const fn, too
- /// `Some` contains the feature gate required to be able to use the function
- /// as const fn
- pub const_stability: Option<Symbol>,
+}
+
+/// Represents the #[rustc_const_unstable] and #[rustc_const_stable] attributes.
+#[derive(RustcEncodable, RustcDecodable, Copy, Clone, Debug,
+ PartialEq, Eq, Hash, HashStable_Generic)]
+pub struct ConstStability {
+ pub level: StabilityLevel,
+ pub feature: Symbol,
/// whether the function has a `#[rustc_promotable]` attribute
pub promotable: bool,
/// whether the function has a `#[rustc_allow_const_fn_ptr]` attribute
/// Collects stability info from all stability attributes in `attrs`.
/// Returns `None` if no stability attributes are found.
pub fn find_stability(sess: &ParseSess, attrs: &[Attribute],
- item_sp: Span) -> Option<Stability> {
+ item_sp: Span) -> (Option<Stability>, Option<ConstStability>) {
find_stability_generic(sess, attrs.iter(), item_sp)
}
fn find_stability_generic<'a, I>(sess: &ParseSess,
attrs_iter: I,
item_sp: Span)
- -> Option<Stability>
+ -> (Option<Stability>, Option<ConstStability>)
where I: Iterator<Item = &'a Attribute>
{
use StabilityLevel::*;
let mut stab: Option<Stability> = None;
let mut rustc_depr: Option<RustcDeprecation> = None;
- let mut rustc_const_unstable: Option<Symbol> = None;
+ let mut const_stab: Option<ConstStability> = None;
let mut promotable = false;
let mut allow_const_fn_ptr = false;
let diagnostic = &sess.span_diagnostic;
if ![
sym::rustc_deprecated,
sym::rustc_const_unstable,
+ sym::rustc_const_stable,
sym::unstable,
sym::stable,
sym::rustc_promotable,
}
}
- match meta.name_or_empty() {
+ let meta_name = meta.name_or_empty();
+ match meta_name {
sym::rustc_deprecated => {
if rustc_depr.is_some() {
span_err!(diagnostic, item_sp, E0540,
}
}
}
- sym::rustc_const_unstable => {
- if rustc_const_unstable.is_some() {
- span_err!(diagnostic, item_sp, E0553,
- "multiple rustc_const_unstable attributes");
- continue 'outer
- }
-
- get_meta!(feature);
- if let Some(feature) = feature {
- rustc_const_unstable = Some(feature);
- } else {
- span_err!(diagnostic, attr.span, E0629, "missing 'feature'");
- continue
- }
- }
+ sym::rustc_const_unstable |
sym::unstable => {
- if stab.is_some() {
+ if meta_name == sym::unstable && stab.is_some() {
+ handle_errors(sess, attr.span, AttrError::MultipleStabilityLevels);
+ break
+ } else if meta_name == sym::rustc_const_unstable && const_stab.is_some() {
handle_errors(sess, attr.span, AttrError::MultipleStabilityLevels);
break
}
}
}
};
- stab = Some(Stability {
- level: Unstable {
- reason,
- issue,
- is_soft,
- },
- feature,
- rustc_depr: None,
- const_stability: None,
- promotable: false,
- allow_const_fn_ptr: false,
- })
+ let level = Unstable {
+ reason,
+ issue,
+ is_soft,
+ };
+ if sym::unstable == meta_name {
+ stab = Some(Stability {
+ level,
+ feature,
+ rustc_depr: None,
+ });
+ } else {
+ const_stab = Some(ConstStability {
+ level,
+ feature,
+ promotable: false,
+ allow_const_fn_ptr: false,
+ });
+ }
}
(None, _, _) => {
handle_errors(sess, attr.span, AttrError::MissingFeature);
}
}
}
+ sym::rustc_const_stable |
sym::stable => {
- if stab.is_some() {
+ if meta_name == sym::stable && stab.is_some() {
+ handle_errors(sess, attr.span, AttrError::MultipleStabilityLevels);
+ break
+ } else if meta_name == sym::rustc_const_stable &&const_stab.is_some() {
handle_errors(sess, attr.span, AttrError::MultipleStabilityLevels);
break
}
match (feature, since) {
(Some(feature), Some(since)) => {
- stab = Some(Stability {
- level: Stable {
- since,
- },
- feature,
- rustc_depr: None,
- const_stability: None,
- promotable: false,
- allow_const_fn_ptr: false,
- })
+ let level = Stable { since };
+ if sym::stable == meta_name {
+ stab = Some(Stability {
+ level,
+ feature,
+ rustc_depr: None,
+ });
+ } else {
+ const_stab = Some(ConstStability {
+ level,
+ feature,
+ promotable: false,
+ allow_const_fn_ptr: false,
+ });
+ }
}
(None, _) => {
handle_errors(sess, attr.span, AttrError::MissingFeature);
}
}
- // Merge the const-unstable info into the stability info
- if let Some(feature) = rustc_const_unstable {
- if let Some(ref mut stab) = stab {
- stab.const_stability = Some(feature);
- } else {
- span_err!(diagnostic, item_sp, E0630,
- "rustc_const_unstable attribute must be paired with \
- either stable or unstable attribute");
- }
- }
-
// Merge the const-unstable info into the stability info
if promotable || allow_const_fn_ptr {
- if let Some(ref mut stab) = stab {
+ if let Some(ref mut stab) = const_stab {
stab.promotable = promotable;
stab.allow_const_fn_ptr = allow_const_fn_ptr;
} else {
span_err!(diagnostic, item_sp, E0717,
"rustc_promotable and rustc_allow_const_fn_ptr attributes \
- must be paired with either stable or unstable attribute");
+ must be paired with either a rustc_const_unstable or a rustc_const_stable \
+ attribute");
}
}
- stab
+ (stab, const_stab)
}
pub fn find_crate_name(attrs: &[Attribute]) -> Option<Symbol> {
}
let is_builtin = attr::contains_name(attrs, sym::rustc_builtin_macro);
+ let (stability, const_stability) = attr::find_stability(&sess, attrs, span);
+ if const_stability.is_some() {
+ sess.span_diagnostic.span_err(span, "macros can't have const stability attributes");
+ }
SyntaxExtension {
kind,
allow_internal_unstable,
allow_internal_unsafe: attr::contains_name(attrs, sym::allow_internal_unsafe),
local_inner_macros,
- stability: attr::find_stability(&sess, attrs, span),
+ stability,
deprecation: attr::find_deprecation(&sess, attrs, span),
helper_attrs,
edition,
rustc_builtin_macro,
rustc_clean,
rustc_const_unstable,
+ rustc_const_stable,
rustc_conversion_suggestion,
rustc_def_path,
rustc_deprecated,
#[rustc_promotable]
#[stable(since="1.0.0", feature = "mep")]
+#[rustc_const_stable(since="1.0.0", feature = "mep")]
#[inline]
pub const fn foo() -> usize { 22 }
impl Foo {
#[stable(since="1.0.0", feature = "mep")]
+ #[rustc_const_stable(feature = "mep", since = "1.0.0")]
#[inline]
#[rustc_promotable]
pub const fn foo() -> usize { 22 }
#![feature(staged_api)]
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature="foo")]
+#[rustc_const_unstable(feature="foo", issue = "0")]
pub const fn foo() -> u32 { 42 }
#![feature(staged_api)]
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature="foo")]
+#[rustc_const_unstable(feature="foo", issue = "0")]
const fn foo() -> u32 { 42 }
fn meh() -> u32 { 42 }
#![feature(rustc_attrs, staged_api)]
#[stable(feature = "rust1", since = "1.0.0")]
+#[rustc_const_stable(since="1.0.0", feature = "mep")]
const fn error(_: fn()) {} //~ ERROR function pointers in const fn are unstable
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_allow_const_fn_ptr]
+#[rustc_const_stable(since="1.0.0", feature = "mep")]
const fn compiles(_: fn()) {}
fn main() {}
error[E0723]: function pointers in const fn are unstable
- --> $DIR/allow_const_fn_ptr.rs:4:16
+ --> $DIR/allow_const_fn_ptr.rs:5:16
|
LL | const fn error(_: fn()) {}
| ^
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_allow_const_fn_ptr]
+#[rustc_const_stable(since="1.0.0", feature = "mep")]
const fn takes_fn_ptr(_: fn()) {}
const FN: fn() = || ();
#![feature(staged_api)]
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature="foo")]
+#[rustc_const_unstable(feature="foo", issue = "0")]
const fn foo() -> u32 { 42 }
#[stable(feature = "rust1", since = "1.0.0")]
+#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
// can't call non-min_const_fn
const fn bar() -> u32 { foo() } //~ ERROR can only call other `const fn`
const fn foo2() -> u32 { 42 }
#[stable(feature = "rust1", since = "1.0.0")]
+#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
// can't call non-min_const_fn
const fn bar2() -> u32 { foo2() } //~ ERROR can only call other `const fn`
#[stable(feature = "rust1", since = "1.0.0")]
+#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
// conformity is required, even with `const_fn` feature gate
const fn bar3() -> u32 { (5f32 + 6f32) as u32 } //~ ERROR only int, `bool` and `char` operations
const fn foo2_gated() -> u32 { 42 }
#[stable(feature = "rust1", since = "1.0.0")]
+#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
// can't call non-min_const_fn
const fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR can only call other `const fn`
error[E0723]: can only call other `const fn` within a `const fn`, but `const foo` is not stable as `const fn`
- --> $DIR/min_const_fn_libstd_stability.rs:15:25
+ --> $DIR/min_const_fn_libstd_stability.rs:16:25
|
LL | const fn bar() -> u32 { foo() }
| ^^^^^
= help: add `#![feature(const_fn)]` to the crate attributes to enable
error[E0723]: can only call other `const fn` within a `const fn`, but `const foo2` is not stable as `const fn`
- --> $DIR/min_const_fn_libstd_stability.rs:22:26
+ --> $DIR/min_const_fn_libstd_stability.rs:24:26
|
LL | const fn bar2() -> u32 { foo2() }
| ^^^^^^
= help: add `#![feature(const_fn)]` to the crate attributes to enable
error[E0723]: only int, `bool` and `char` operations are stable in const fn
- --> $DIR/min_const_fn_libstd_stability.rs:26:26
+ --> $DIR/min_const_fn_libstd_stability.rs:29:26
|
LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 }
| ^^^^^^^^^^^^^
= help: add `#![feature(const_fn)]` to the crate attributes to enable
error[E0723]: can only call other `const fn` within a `const fn`, but `const foo2_gated` is not stable as `const fn`
- --> $DIR/min_const_fn_libstd_stability.rs:34:32
+ --> $DIR/min_const_fn_libstd_stability.rs:38:32
|
LL | const fn bar2_gated() -> u32 { foo2_gated() }
| ^^^^^^^^^^^^
#![feature(staged_api)]
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature="foo")]
+#[rustc_const_unstable(feature="foo", issue = "0")]
const unsafe fn foo() -> u32 { 42 }
#[stable(feature = "rust1", since = "1.0.0")]
+#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
// can't call non-min_const_fn
const unsafe fn bar() -> u32 { unsafe { foo() } } //~ ERROR can only call other `const fn`
const unsafe fn foo2() -> u32 { 42 }
#[stable(feature = "rust1", since = "1.0.0")]
+#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
// can't call non-min_const_fn
const unsafe fn bar2() -> u32 { unsafe { foo2() } } //~ ERROR can only call other `const fn`
#[stable(feature = "rust1", since = "1.0.0")]
+#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
// conformity is required, even with `const_fn` feature gate
const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 } //~ ERROR only int, `bool` and `char` op
const unsafe fn foo2_gated() -> u32 { 42 }
#[stable(feature = "rust1", since = "1.0.0")]
+#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
// can't call non-min_const_fn
const unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() } }
//~^ ERROR can only call other `const fn`
error[E0723]: can only call other `const fn` within a `const fn`, but `const foo` is not stable as `const fn`
- --> $DIR/min_const_unsafe_fn_libstd_stability.rs:15:41
+ --> $DIR/min_const_unsafe_fn_libstd_stability.rs:16:41
|
LL | const unsafe fn bar() -> u32 { unsafe { foo() } }
| ^^^^^
= help: add `#![feature(const_fn)]` to the crate attributes to enable
error[E0723]: can only call other `const fn` within a `const fn`, but `const foo2` is not stable as `const fn`
- --> $DIR/min_const_unsafe_fn_libstd_stability.rs:22:42
+ --> $DIR/min_const_unsafe_fn_libstd_stability.rs:24:42
|
LL | const unsafe fn bar2() -> u32 { unsafe { foo2() } }
| ^^^^^^
= help: add `#![feature(const_fn)]` to the crate attributes to enable
error[E0723]: only int, `bool` and `char` operations are stable in const fn
- --> $DIR/min_const_unsafe_fn_libstd_stability.rs:26:33
+ --> $DIR/min_const_unsafe_fn_libstd_stability.rs:29:33
|
LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 }
| ^^^^^^^^^^^^^
= help: add `#![feature(const_fn)]` to the crate attributes to enable
error[E0723]: can only call other `const fn` within a `const fn`, but `const foo2_gated` is not stable as `const fn`
- --> $DIR/min_const_unsafe_fn_libstd_stability.rs:34:48
+ --> $DIR/min_const_unsafe_fn_libstd_stability.rs:38:48
|
LL | const unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() } }
| ^^^^^^^^^^^^
#![feature(staged_api)]
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature="foo")]
+#[rustc_const_unstable(feature="foo", issue = "0")]
const fn foo() -> u32 { 42 }
#[stable(feature = "rust1", since = "1.0.0")]
+#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
// can't call non-min_const_fn
const unsafe fn bar() -> u32 { foo() } //~ ERROR can only call other `const fn`
const fn foo2() -> u32 { 42 }
#[stable(feature = "rust1", since = "1.0.0")]
+#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
// can't call non-min_const_fn
const unsafe fn bar2() -> u32 { foo2() } //~ ERROR can only call other `const fn`
const fn foo2_gated() -> u32 { 42 }
#[stable(feature = "rust1", since = "1.0.0")]
+#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
// can't call non-min_const_fn
const unsafe fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR can only call other `const fn`
error[E0723]: can only call other `const fn` within a `const fn`, but `const foo` is not stable as `const fn`
- --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:15:32
+ --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:16:32
|
LL | const unsafe fn bar() -> u32 { foo() }
| ^^^^^
= help: add `#![feature(const_fn)]` to the crate attributes to enable
error[E0723]: can only call other `const fn` within a `const fn`, but `const foo2` is not stable as `const fn`
- --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:22:33
+ --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:24:33
|
LL | const unsafe fn bar2() -> u32 { foo2() }
| ^^^^^^
= help: add `#![feature(const_fn)]` to the crate attributes to enable
error[E0723]: can only call other `const fn` within a `const fn`, but `const foo2_gated` is not stable as `const fn`
- --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:30:39
+ --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:33:39
|
LL | const unsafe fn bar2_gated() -> u32 { foo2_gated() }
| ^^^^^^^^^^^^
}
impl<T> Opt<T> {
- #[rustc_const_unstable(feature = "foo")]
+ #[rustc_const_unstable(feature = "foo", issue = "0")]
#[stable(feature = "rust1", since = "1.0.0")]
const fn unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T {
//~^ ERROR destructors cannot be evaluated at compile-time
-error[E0725]: the feature `rustc_const_unstable` is not in the list of allowed features
- --> $DIR/allow-features-empty.rs:4:12
- |
-LL | #![feature(rustc_const_unstable)]
- | ^^^^^^^^^^^^^^^^^^^^
-
error[E0725]: the feature `lang_items` is not in the list of allowed features
- --> $DIR/allow-features-empty.rs:6:12
+ --> $DIR/allow-features-empty.rs:4:12
|
LL | #![feature(lang_items)]
| ^^^^^^^^^^
error[E0725]: the feature `unknown_stdlib_feature` is not in the list of allowed features
- --> $DIR/allow-features-empty.rs:8:12
+ --> $DIR/allow-features-empty.rs:6:12
|
LL | #![feature(unknown_stdlib_feature)]
| ^^^^^^^^^^^^^^^^^^^^^^
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0725`.
-error[E0725]: the feature `rustc_const_unstable` is not in the list of allowed features
- --> $DIR/allow-features.rs:4:12
- |
-LL | #![feature(rustc_const_unstable)]
- | ^^^^^^^^^^^^^^^^^^^^
-
error[E0725]: the feature `unknown_stdlib_feature` is not in the list of allowed features
- --> $DIR/allow-features.rs:8:12
+ --> $DIR/allow-features.rs:6:12
|
LL | #![feature(unknown_stdlib_feature)]
| ^^^^^^^^^^^^^^^^^^^^^^
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0725`.
-error[E0658]: the `#[rustc_const_unstable]` attribute is an internal feature
- --> $DIR/feature-gate-rustc_const_unstable.rs:8:1
+error[E0734]: stability attributes may not be used outside of the standard library
+ --> $DIR/feature-gate-rustc_const_unstable.rs:5:1
|
LL | #[rustc_const_unstable(feature="fzzzzzt")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = help: add `#![feature(rustc_const_unstable)]` to the crate attributes to enable
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0658`.
+For more information about this error, try `rustc --explain E0734`.
// of the const fn kicks in, causing a different code path in the
// compiler to be executed (see PR #66294).
#[stable(feature = "rustc", since = "1.0.0")]
+#[rustc_const_stable(feature = "rustc", since = "1.0.0")]
#[rustc_promotable]
const fn bar(_: bool) -> usize { 0 - 1 }
#[stable(feature = "a", since = "b")]
#[rustc_deprecated(since = "b", reason = "text")]
#[rustc_deprecated(since = "b", reason = "text")]
-#[rustc_const_unstable(feature = "c")]
-#[rustc_const_unstable(feature = "d")]
+#[rustc_const_unstable(feature = "c", issue = "0")]
+#[rustc_const_unstable(feature = "d", issue = "0")] //~ ERROR multiple stability levels
pub const fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540]
//~^ ERROR Invalid stability or deprecation version found
-//~| ERROR multiple rustc_const_unstable attributes
#[rustc_deprecated(since = "a", reason = "text")]
fn deprecated_without_unstable_or_stable() { }
LL | pub const fn multiple4() { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0553]: multiple rustc_const_unstable attributes
- --> $DIR/stability-attribute-sanity.rs:65:1
+error[E0544]: multiple stability levels
+ --> $DIR/stability-attribute-sanity.rs:64:1
|
-LL | pub const fn multiple4() { }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[rustc_const_unstable(feature = "d", issue = "0")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: Invalid stability or deprecation version found
--> $DIR/stability-attribute-sanity.rs:65:1
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0549]: rustc_deprecated attribute must be paired with either stable or unstable attribute
- --> $DIR/stability-attribute-sanity.rs:70:1
+ --> $DIR/stability-attribute-sanity.rs:69:1
|
LL | fn deprecated_without_unstable_or_stable() { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"E0523",
"E0554",
"E0570",
- "E0629",
- "E0630",
"E0640",
"E0717",
"E0727",