This commit is contained in:
Boxy 2025-08-06 13:51:50 +01:00
parent 351e4bd106
commit 7bc34622f0
29 changed files with 173 additions and 183 deletions

View file

@ -378,7 +378,7 @@ impl<'a, T, const N: usize> IntoIterator for &'a mut [T; N] {
#[rustc_const_unstable(feature = "const_index", issue = "143775")]
impl<T, I, const N: usize> const Index<I> for [T; N]
where
[T]: ~const Index<I>,
[T]: [const] Index<I>,
{
type Output = <[T] as Index<I>>::Output;
@ -392,7 +392,7 @@ where
#[rustc_const_unstable(feature = "const_index", issue = "143775")]
impl<T, I, const N: usize> const IndexMut<I> for [T; N]
where
[T]: ~const IndexMut<I>,
[T]: [const] IndexMut<I>,
{
#[inline]
fn index_mut(&mut self, index: I) -> &mut Self::Output {

View file

@ -334,7 +334,7 @@ impl<T: Copy> Clone for Cell<T> {
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_default", issue = "143894")]
impl<T: ~const Default> const Default for Cell<T> {
impl<T: [const] Default> const Default for Cell<T> {
/// Creates a `Cell<T>`, with the `Default` value for T.
#[inline]
fn default() -> Cell<T> {
@ -1325,7 +1325,7 @@ impl<T: Clone> Clone for RefCell<T> {
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_default", issue = "143894")]
impl<T: ~const Default> const Default for RefCell<T> {
impl<T: [const] Default> const Default for RefCell<T> {
/// Creates a `RefCell<T>`, with the `Default` value for T.
#[inline]
fn default() -> RefCell<T> {
@ -2333,7 +2333,7 @@ impl<T: ?Sized> UnsafeCell<T> {
#[stable(feature = "unsafe_cell_default", since = "1.10.0")]
#[rustc_const_unstable(feature = "const_default", issue = "143894")]
impl<T: ~const Default> const Default for UnsafeCell<T> {
impl<T: [const] Default> const Default for UnsafeCell<T> {
/// Creates an `UnsafeCell`, with the `Default` value for T.
fn default() -> UnsafeCell<T> {
UnsafeCell::new(Default::default())
@ -2438,7 +2438,7 @@ impl<T: ?Sized> SyncUnsafeCell<T> {
#[unstable(feature = "sync_unsafe_cell", issue = "95439")]
#[rustc_const_unstable(feature = "const_default", issue = "143894")]
impl<T: ~const Default> const Default for SyncUnsafeCell<T> {
impl<T: [const] Default> const Default for SyncUnsafeCell<T> {
/// Creates an `SyncUnsafeCell`, with the `Default` value for T.
fn default() -> SyncUnsafeCell<T> {
SyncUnsafeCell::new(Default::default())

View file

@ -212,7 +212,7 @@ pub trait Clone: Sized {
#[stable(feature = "rust1", since = "1.0.0")]
fn clone_from(&mut self, source: &Self)
where
Self: ~const Destruct,
Self: [const] Destruct,
{
*self = source.clone()
}

View file

@ -2022,7 +2022,7 @@ mod impls {
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
impl<A: PointeeSized, B: PointeeSized> const PartialEq<&B> for &A
where
A: ~const PartialEq<B>,
A: [const] PartialEq<B>,
{
#[inline]
fn eq(&self, other: &&B) -> bool {
@ -2094,7 +2094,7 @@ mod impls {
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
impl<A: PointeeSized, B: PointeeSized> const PartialEq<&mut B> for &mut A
where
A: ~const PartialEq<B>,
A: [const] PartialEq<B>,
{
#[inline]
fn eq(&self, other: &&mut B) -> bool {
@ -2164,7 +2164,7 @@ mod impls {
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
impl<A: PointeeSized, B: PointeeSized> const PartialEq<&mut B> for &A
where
A: ~const PartialEq<B>,
A: [const] PartialEq<B>,
{
#[inline]
fn eq(&self, other: &&mut B) -> bool {
@ -2180,7 +2180,7 @@ mod impls {
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
impl<A: PointeeSized, B: PointeeSized> const PartialEq<&B> for &mut A
where
A: ~const PartialEq<B>,
A: [const] PartialEq<B>,
{
#[inline]
fn eq(&self, other: &&B) -> bool {

View file

@ -19,7 +19,7 @@ use crate::num::NonZero;
#[rustc_specialization_trait]
#[const_trait]
pub(crate) unsafe trait BytewiseEq<Rhs = Self>:
~const PartialEq<Rhs> + Sized
[const] PartialEq<Rhs> + Sized
{
}

View file

@ -717,7 +717,7 @@ pub trait TryFrom<T>: Sized {
#[rustc_const_unstable(feature = "const_try", issue = "74935")]
impl<T: PointeeSized, U: PointeeSized> const AsRef<U> for &T
where
T: ~const AsRef<U>,
T: [const] AsRef<U>,
{
#[inline]
fn as_ref(&self) -> &U {
@ -730,7 +730,7 @@ where
#[rustc_const_unstable(feature = "const_try", issue = "74935")]
impl<T: PointeeSized, U: PointeeSized> const AsRef<U> for &mut T
where
T: ~const AsRef<U>,
T: [const] AsRef<U>,
{
#[inline]
fn as_ref(&self) -> &U {
@ -751,7 +751,7 @@ where
#[rustc_const_unstable(feature = "const_try", issue = "74935")]
impl<T: PointeeSized, U: PointeeSized> const AsMut<U> for &mut T
where
T: ~const AsMut<U>,
T: [const] AsMut<U>,
{
#[inline]
fn as_mut(&mut self) -> &mut U {
@ -772,7 +772,7 @@ where
#[rustc_const_unstable(feature = "const_from", issue = "143773")]
impl<T, U> const Into<U> for T
where
U: ~const From<T>,
U: [const] From<T>,
{
/// Calls `U::from(self)`.
///
@ -816,7 +816,7 @@ impl<T> const From<!> for T {
#[rustc_const_unstable(feature = "const_from", issue = "143773")]
impl<T, U> const TryInto<U> for T
where
U: ~const TryFrom<T>,
U: [const] TryFrom<T>,
{
type Error = U::Error;
@ -832,7 +832,7 @@ where
#[rustc_const_unstable(feature = "const_from", issue = "143773")]
impl<T, U> const TryFrom<U> for T
where
U: ~const Into<T>,
U: [const] Into<T>,
{
type Error = Infallible;

View file

@ -1828,7 +1828,7 @@ pub const fn three_way_compare<T: Copy>(lhs: T, rhss: T) -> crate::cmp::Ordering
#[rustc_intrinsic]
#[track_caller]
#[miri::intrinsic_fallback_is_spec] // the fallbacks all `assume` to tell Miri
pub const unsafe fn disjoint_bitor<T: ~const fallback::DisjointBitOr>(a: T, b: T) -> T {
pub const unsafe fn disjoint_bitor<T: [const] fallback::DisjointBitOr>(a: T, b: T) -> T {
// SAFETY: same preconditions as this function.
unsafe { fallback::DisjointBitOr::disjoint_bitor(a, b) }
}
@ -1897,7 +1897,7 @@ pub const fn mul_with_overflow<T: Copy>(x: T, y: T) -> (T, bool);
#[rustc_nounwind]
#[rustc_intrinsic]
#[miri::intrinsic_fallback_is_spec]
pub const fn carrying_mul_add<T: ~const fallback::CarryingMulAdd<Unsigned = U>, U>(
pub const fn carrying_mul_add<T: [const] fallback::CarryingMulAdd<Unsigned = U>, U>(
multiplier: T,
multiplicand: T,
addend: T,

View file

@ -613,7 +613,7 @@ impl const From<SocketAddrV6> for SocketAddr {
#[stable(feature = "addr_from_into_ip", since = "1.17.0")]
#[rustc_const_unstable(feature = "const_try", issue = "74935")]
impl<I: ~const Into<IpAddr>> const From<(I, u16)> for SocketAddr {
impl<I: [const] Into<IpAddr>> const From<(I, u16)> for SocketAddr {
/// Converts a tuple struct (Into<[`IpAddr`]>, `u16`) into a [`SocketAddr`].
///
/// This conversion creates a [`SocketAddr::V4`] for an [`IpAddr::V4`]

View file

@ -203,7 +203,7 @@ impl<T> Copy for NonZero<T> where T: ZeroablePrimitive {}
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
impl<T> const PartialEq for NonZero<T>
where
T: ZeroablePrimitive + ~const PartialEq,
T: ZeroablePrimitive + [const] PartialEq,
{
#[inline]
fn eq(&self, other: &Self) -> bool {

View file

@ -269,7 +269,7 @@ impl<T: ?Sized> const Deref for &mut T {
#[stable(feature = "rust1", since = "1.0.0")]
#[const_trait]
#[rustc_const_unstable(feature = "const_deref", issue = "88955")]
pub trait DerefMut: ~const Deref + PointeeSized {
pub trait DerefMut: [const] Deref + PointeeSized {
/// Mutably dereferences the value.
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "deref_mut_method"]

View file

@ -260,7 +260,7 @@ mod impls {
#[rustc_const_unstable(feature = "const_trait_impl", issue = "143874")]
impl<A: Tuple, F: ?Sized> const Fn<A> for &F
where
F: ~const Fn<A>,
F: [const] Fn<A>,
{
extern "rust-call" fn call(&self, args: A) -> F::Output {
(**self).call(args)
@ -271,7 +271,7 @@ mod impls {
#[rustc_const_unstable(feature = "const_trait_impl", issue = "143874")]
impl<A: Tuple, F: ?Sized> const FnMut<A> for &F
where
F: ~const Fn<A>,
F: [const] Fn<A>,
{
extern "rust-call" fn call_mut(&mut self, args: A) -> F::Output {
(**self).call(args)
@ -282,7 +282,7 @@ mod impls {
#[rustc_const_unstable(feature = "const_trait_impl", issue = "143874")]
impl<A: Tuple, F: ?Sized> const FnOnce<A> for &F
where
F: ~const Fn<A>,
F: [const] Fn<A>,
{
type Output = F::Output;
@ -295,7 +295,7 @@ mod impls {
#[rustc_const_unstable(feature = "const_trait_impl", issue = "143874")]
impl<A: Tuple, F: ?Sized> const FnMut<A> for &mut F
where
F: ~const FnMut<A>,
F: [const] FnMut<A>,
{
extern "rust-call" fn call_mut(&mut self, args: A) -> F::Output {
(*self).call_mut(args)
@ -306,7 +306,7 @@ mod impls {
#[rustc_const_unstable(feature = "const_trait_impl", issue = "143874")]
impl<A: Tuple, F: ?Sized> const FnOnce<A> for &mut F
where
F: ~const FnMut<A>,
F: [const] FnMut<A>,
{
type Output = F::Output;
extern "rust-call" fn call_once(self, args: A) -> F::Output {

View file

@ -169,7 +169,7 @@ see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#ind
#[doc(alias = "[]")]
#[rustc_const_unstable(feature = "const_index", issue = "143775")]
#[const_trait]
pub trait IndexMut<Idx: ?Sized>: ~const Index<Idx> {
pub trait IndexMut<Idx: ?Sized>: [const] Index<Idx> {
/// Performs the mutable indexing (`container[index]`) operation.
///
/// # Panics

View file

@ -130,7 +130,7 @@ use crate::ops::ControlFlow;
#[lang = "Try"]
#[const_trait]
#[rustc_const_unstable(feature = "const_try", issue = "74935")]
pub trait Try: ~const FromResidual {
pub trait Try: [const] FromResidual {
/// The type of the value produced by `?` when *not* short-circuiting.
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
type Output;

View file

@ -651,7 +651,7 @@ impl<T> Option<T> {
#[inline]
#[stable(feature = "is_some_and", since = "1.70.0")]
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn is_some_and(self, f: impl ~const FnOnce(T) -> bool + ~const Destruct) -> bool {
pub const fn is_some_and(self, f: impl [const] FnOnce(T) -> bool + [const] Destruct) -> bool {
match self {
None => false,
Some(x) => f(x),
@ -700,7 +700,7 @@ impl<T> Option<T> {
#[inline]
#[stable(feature = "is_none_or", since = "1.82.0")]
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn is_none_or(self, f: impl ~const FnOnce(T) -> bool + ~const Destruct) -> bool {
pub const fn is_none_or(self, f: impl [const] FnOnce(T) -> bool + [const] Destruct) -> bool {
match self {
None => true,
Some(x) => f(x),
@ -1030,7 +1030,7 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn unwrap_or(self, default: T) -> T
where
T: ~const Destruct,
T: [const] Destruct,
{
match self {
Some(x) => x,
@ -1053,7 +1053,7 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn unwrap_or_else<F>(self, f: F) -> T
where
F: ~const FnOnce() -> T + ~const Destruct,
F: [const] FnOnce() -> T + [const] Destruct,
{
match self {
Some(x) => x,
@ -1085,7 +1085,7 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn unwrap_or_default(self) -> T
where
T: ~const Default,
T: [const] Default,
{
match self {
Some(x) => x,
@ -1152,7 +1152,7 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn map<U, F>(self, f: F) -> Option<U>
where
F: ~const FnOnce(T) -> U + ~const Destruct,
F: [const] FnOnce(T) -> U + [const] Destruct,
{
match self {
Some(x) => Some(f(x)),
@ -1183,7 +1183,7 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn inspect<F>(self, f: F) -> Self
where
F: ~const FnOnce(&T) + ~const Destruct,
F: [const] FnOnce(&T) + [const] Destruct,
{
if let Some(ref x) = self {
f(x);
@ -1216,8 +1216,8 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn map_or<U, F>(self, default: U, f: F) -> U
where
F: ~const FnOnce(T) -> U + ~const Destruct,
U: ~const Destruct,
F: [const] FnOnce(T) -> U + [const] Destruct,
U: [const] Destruct,
{
match self {
Some(t) => f(t),
@ -1263,8 +1263,8 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn map_or_else<U, D, F>(self, default: D, f: F) -> U
where
D: ~const FnOnce() -> U + ~const Destruct,
F: ~const FnOnce(T) -> U + ~const Destruct,
D: [const] FnOnce() -> U + [const] Destruct,
F: [const] FnOnce(T) -> U + [const] Destruct,
{
match self {
Some(t) => f(t),
@ -1294,8 +1294,8 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn map_or_default<U, F>(self, f: F) -> U
where
U: ~const Default,
F: ~const FnOnce(T) -> U + ~const Destruct,
U: [const] Default,
F: [const] FnOnce(T) -> U + [const] Destruct,
{
match self {
Some(t) => f(t),
@ -1327,7 +1327,7 @@ impl<T> Option<T> {
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn ok_or<E: ~const Destruct>(self, err: E) -> Result<T, E> {
pub const fn ok_or<E: [const] Destruct>(self, err: E) -> Result<T, E> {
match self {
Some(v) => Ok(v),
None => Err(err),
@ -1355,7 +1355,7 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn ok_or_else<E, F>(self, err: F) -> Result<T, E>
where
F: ~const FnOnce() -> E + ~const Destruct,
F: [const] FnOnce() -> E + [const] Destruct,
{
match self {
Some(v) => Ok(v),
@ -1487,8 +1487,8 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn and<U>(self, optb: Option<U>) -> Option<U>
where
T: ~const Destruct,
U: ~const Destruct,
T: [const] Destruct,
U: [const] Destruct,
{
match self {
Some(_) => optb,
@ -1531,7 +1531,7 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn and_then<U, F>(self, f: F) -> Option<U>
where
F: ~const FnOnce(T) -> Option<U> + ~const Destruct,
F: [const] FnOnce(T) -> Option<U> + [const] Destruct,
{
match self {
Some(x) => f(x),
@ -1568,8 +1568,8 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn filter<P>(self, predicate: P) -> Self
where
P: ~const FnOnce(&T) -> bool + ~const Destruct,
T: ~const Destruct,
P: [const] FnOnce(&T) -> bool + [const] Destruct,
T: [const] Destruct,
{
if let Some(x) = self {
if predicate(&x) {
@ -1611,7 +1611,7 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn or(self, optb: Option<T>) -> Option<T>
where
T: ~const Destruct,
T: [const] Destruct,
{
match self {
x @ Some(_) => x,
@ -1637,10 +1637,10 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn or_else<F>(self, f: F) -> Option<T>
where
F: ~const FnOnce() -> Option<T> + ~const Destruct,
F: [const] FnOnce() -> Option<T> + [const] Destruct,
//FIXME(const_hack): this `T: ~const Destruct` is unnecessary, but even precise live drops can't tell
// no value of type `T` gets dropped here
T: ~const Destruct,
T: [const] Destruct,
{
match self {
x @ Some(_) => x,
@ -1674,7 +1674,7 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn xor(self, optb: Option<T>) -> Option<T>
where
T: ~const Destruct,
T: [const] Destruct,
{
match (self, optb) {
(a @ Some(_), None) => a,
@ -1712,7 +1712,7 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn insert(&mut self, value: T) -> &mut T
where
T: ~const Destruct,
T: [const] Destruct,
{
*self = Some(value);
@ -1768,7 +1768,7 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn get_or_insert_default(&mut self) -> &mut T
where
T: ~const Default + ~const Destruct,
T: [const] Default + [const] Destruct,
{
self.get_or_insert_with(T::default)
}
@ -1795,8 +1795,8 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn get_or_insert_with<F>(&mut self, f: F) -> &mut T
where
F: ~const FnOnce() -> T + ~const Destruct,
T: ~const Destruct,
F: [const] FnOnce() -> T + [const] Destruct,
T: [const] Destruct,
{
if let None = self {
*self = Some(f());
@ -1863,7 +1863,7 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn take_if<P>(&mut self, predicate: P) -> Option<T>
where
P: ~const FnOnce(&mut T) -> bool + ~const Destruct,
P: [const] FnOnce(&mut T) -> bool + [const] Destruct,
{
if self.as_mut().map_or(false, predicate) { self.take() } else { None }
}
@ -1911,8 +1911,8 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn zip<U>(self, other: Option<U>) -> Option<(T, U)>
where
T: ~const Destruct,
U: ~const Destruct,
T: [const] Destruct,
U: [const] Destruct,
{
match (self, other) {
(Some(a), Some(b)) => Some((a, b)),
@ -1952,9 +1952,9 @@ impl<T> Option<T> {
#[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
pub const fn zip_with<U, F, R>(self, other: Option<U>, f: F) -> Option<R>
where
F: ~const FnOnce(T, U) -> R + ~const Destruct,
T: ~const Destruct,
U: ~const Destruct,
F: [const] FnOnce(T, U) -> R + [const] Destruct,
T: [const] Destruct,
U: [const] Destruct,
{
match (self, other) {
(Some(a), Some(b)) => Some(f(a, b)),
@ -2149,7 +2149,7 @@ impl<T> const Clone for Option<T>
where
// FIXME(const_hack): the T: ~const Destruct should be inferred from the Self: ~const Destruct in clone_from.
// See https://github.com/rust-lang/rust/issues/144207
T: ~const Clone + ~const Destruct,
T: [const] Clone + [const] Destruct,
{
#[inline]
fn clone(&self) -> Self {
@ -2307,7 +2307,7 @@ impl<'a, T> const From<&'a mut Option<T>> for Option<&'a mut T> {
impl<T> crate::marker::StructuralPartialEq for Option<T> {}
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
impl<T: ~const PartialEq> const PartialEq for Option<T> {
impl<T: [const] PartialEq> const PartialEq for Option<T> {
#[inline]
fn eq(&self, other: &Self) -> bool {
// Spelling out the cases explicitly optimizes better than

View file

@ -1528,7 +1528,7 @@ impl<T> *const [T] {
#[inline]
pub const unsafe fn get_unchecked<I>(self, index: I) -> *const I::Output
where
I: ~const SliceIndex<[T]>,
I: [const] SliceIndex<[T]>,
{
// SAFETY: the caller ensures that `self` is dereferenceable and `index` in-bounds.
unsafe { index.get_unchecked(self) }

View file

@ -1885,7 +1885,7 @@ impl<T> *mut [T] {
#[inline(always)]
pub const unsafe fn get_unchecked_mut<I>(self, index: I) -> *mut I::Output
where
I: ~const SliceIndex<[T]>,
I: [const] SliceIndex<[T]>,
{
// SAFETY: the caller ensures that `self` is dereferenceable and `index` in-bounds.
unsafe { index.get_unchecked_mut(self) }

View file

@ -1601,7 +1601,7 @@ impl<T> NonNull<[T]> {
#[inline]
pub const unsafe fn get_unchecked_mut<I>(self, index: I) -> NonNull<I::Output>
where
I: ~const SliceIndex<[T]>,
I: [const] SliceIndex<[T]>,
{
// SAFETY: the caller ensures that `self` is dereferenceable and `index` in-bounds.
// As a consequence, the resulting pointer cannot be null.

View file

@ -610,9 +610,9 @@ impl<T, E> Result<T, E> {
#[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")]
pub const fn is_ok_and<F>(self, f: F) -> bool
where
F: ~const FnOnce(T) -> bool + ~const Destruct,
T: ~const Destruct,
E: ~const Destruct,
F: [const] FnOnce(T) -> bool + [const] Destruct,
T: [const] Destruct,
E: [const] Destruct,
{
match self {
Err(_) => false,
@ -665,9 +665,9 @@ impl<T, E> Result<T, E> {
#[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")]
pub const fn is_err_and<F>(self, f: F) -> bool
where
F: ~const FnOnce(E) -> bool + ~const Destruct,
E: ~const Destruct,
T: ~const Destruct,
F: [const] FnOnce(E) -> bool + [const] Destruct,
E: [const] Destruct,
T: [const] Destruct,
{
match self {
Ok(_) => false,
@ -699,8 +699,8 @@ impl<T, E> Result<T, E> {
#[rustc_diagnostic_item = "result_ok_method"]
pub const fn ok(self) -> Option<T>
where
T: ~const Destruct,
E: ~const Destruct,
T: [const] Destruct,
E: [const] Destruct,
{
match self {
Ok(x) => Some(x),
@ -727,8 +727,8 @@ impl<T, E> Result<T, E> {
#[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")]
pub const fn err(self) -> Option<E>
where
T: ~const Destruct,
E: ~const Destruct,
T: [const] Destruct,
E: [const] Destruct,
{
match self {
Ok(_) => None,
@ -822,7 +822,7 @@ impl<T, E> Result<T, E> {
#[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")]
pub const fn map<U, F>(self, op: F) -> Result<U, E>
where
F: ~const FnOnce(T) -> U + ~const Destruct,
F: [const] FnOnce(T) -> U + [const] Destruct,
{
match self {
Ok(t) => Ok(op(t)),
@ -854,10 +854,10 @@ impl<T, E> Result<T, E> {
#[must_use = "if you don't need the returned value, use `if let` instead"]
pub const fn map_or<U, F>(self, default: U, f: F) -> U
where
F: ~const FnOnce(T) -> U + ~const Destruct,
T: ~const Destruct,
E: ~const Destruct,
U: ~const Destruct,
F: [const] FnOnce(T) -> U + [const] Destruct,
T: [const] Destruct,
E: [const] Destruct,
U: [const] Destruct,
{
match self {
Ok(t) => f(t),
@ -888,8 +888,8 @@ impl<T, E> Result<T, E> {
#[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")]
pub const fn map_or_else<U, D, F>(self, default: D, f: F) -> U
where
D: ~const FnOnce(E) -> U + ~const Destruct,
F: ~const FnOnce(T) -> U + ~const Destruct,
D: [const] FnOnce(E) -> U + [const] Destruct,
F: [const] FnOnce(T) -> U + [const] Destruct,
{
match self {
Ok(t) => f(t),
@ -919,10 +919,10 @@ impl<T, E> Result<T, E> {
#[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")]
pub const fn map_or_default<U, F>(self, f: F) -> U
where
F: ~const FnOnce(T) -> U + ~const Destruct,
U: ~const Default,
T: ~const Destruct,
E: ~const Destruct,
F: [const] FnOnce(T) -> U + [const] Destruct,
U: [const] Default,
T: [const] Destruct,
E: [const] Destruct,
{
match self {
Ok(t) => f(t),
@ -953,7 +953,7 @@ impl<T, E> Result<T, E> {
#[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")]
pub const fn map_err<F, O>(self, op: O) -> Result<T, F>
where
O: ~const FnOnce(E) -> F + ~const Destruct,
O: [const] FnOnce(E) -> F + [const] Destruct,
{
match self {
Ok(t) => Ok(t),
@ -979,7 +979,7 @@ impl<T, E> Result<T, E> {
#[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")]
pub const fn inspect<F>(self, f: F) -> Self
where
F: ~const FnOnce(&T) + ~const Destruct,
F: [const] FnOnce(&T) + [const] Destruct,
{
if let Ok(ref t) = self {
f(t);
@ -1007,7 +1007,7 @@ impl<T, E> Result<T, E> {
#[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")]
pub const fn inspect_err<F>(self, f: F) -> Self
where
F: ~const FnOnce(&E) + ~const Destruct,
F: [const] FnOnce(&E) + [const] Destruct,
{
if let Err(ref e) = self {
f(e);
@ -1254,8 +1254,8 @@ impl<T, E> Result<T, E> {
#[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")]
pub const fn unwrap_or_default(self) -> T
where
T: ~const Default + ~const Destruct,
E: ~const Destruct,
T: [const] Default + [const] Destruct,
E: [const] Destruct,
{
match self {
Ok(x) => x,
@ -1350,7 +1350,7 @@ impl<T, E> Result<T, E> {
#[rustc_const_unstable(feature = "const_try", issue = "74935")]
pub const fn into_ok(self) -> T
where
E: ~const Into<!>,
E: [const] Into<!>,
{
match self {
Ok(x) => x,
@ -1387,7 +1387,7 @@ impl<T, E> Result<T, E> {
#[rustc_const_unstable(feature = "const_try", issue = "74935")]
pub const fn into_err(self) -> E
where
T: ~const Into<!>,
T: [const] Into<!>,
{
match self {
Ok(x) => x.into(),
@ -1431,9 +1431,9 @@ impl<T, E> Result<T, E> {
#[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")]
pub const fn and<U>(self, res: Result<U, E>) -> Result<U, E>
where
T: ~const Destruct,
E: ~const Destruct,
U: ~const Destruct,
T: [const] Destruct,
E: [const] Destruct,
U: [const] Destruct,
{
match self {
Ok(_) => res,
@ -1477,7 +1477,7 @@ impl<T, E> Result<T, E> {
#[rustc_confusables("flat_map", "flatmap")]
pub const fn and_then<U, F>(self, op: F) -> Result<U, E>
where
F: ~const FnOnce(T) -> Result<U, E> + ~const Destruct,
F: [const] FnOnce(T) -> Result<U, E> + [const] Destruct,
{
match self {
Ok(t) => op(t),
@ -1517,9 +1517,9 @@ impl<T, E> Result<T, E> {
#[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")]
pub const fn or<F>(self, res: Result<T, F>) -> Result<T, F>
where
T: ~const Destruct,
E: ~const Destruct,
F: ~const Destruct,
T: [const] Destruct,
E: [const] Destruct,
F: [const] Destruct,
{
match self {
Ok(v) => Ok(v),
@ -1548,7 +1548,7 @@ impl<T, E> Result<T, E> {
#[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")]
pub const fn or_else<F, O>(self, op: O) -> Result<T, F>
where
O: ~const FnOnce(E) -> Result<T, F> + ~const Destruct,
O: [const] FnOnce(E) -> Result<T, F> + [const] Destruct,
{
match self {
Ok(t) => Ok(t),
@ -1579,8 +1579,8 @@ impl<T, E> Result<T, E> {
#[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")]
pub const fn unwrap_or(self, default: T) -> T
where
T: ~const Destruct,
E: ~const Destruct,
T: [const] Destruct,
E: [const] Destruct,
{
match self {
Ok(t) => t,
@ -1605,7 +1605,7 @@ impl<T, E> Result<T, E> {
#[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")]
pub const fn unwrap_or_else<F>(self, op: F) -> T
where
F: ~const FnOnce(E) -> T + ~const Destruct,
F: [const] FnOnce(E) -> T + [const] Destruct,
{
match self {
Ok(t) => t,
@ -2164,7 +2164,7 @@ impl<T, E> const ops::Try for Result<T, E> {
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
#[rustc_const_unstable(feature = "const_try", issue = "74935")]
impl<T, E, F: ~const From<E>> const ops::FromResidual<Result<convert::Infallible, E>>
impl<T, E, F: [const] From<E>> const ops::FromResidual<Result<convert::Infallible, E>>
for Result<T, F>
{
#[inline]
@ -2178,7 +2178,7 @@ impl<T, E, F: ~const From<E>> const ops::FromResidual<Result<convert::Infallible
#[diagnostic::do_not_recommend]
#[unstable(feature = "try_trait_v2_yeet", issue = "96374")]
#[rustc_const_unstable(feature = "const_try", issue = "74935")]
impl<T, E, F: ~const From<E>> const ops::FromResidual<ops::Yeet<E>> for Result<T, F> {
impl<T, E, F: [const] From<E>> const ops::FromResidual<ops::Yeet<E>> for Result<T, F> {
#[inline]
fn from_residual(ops::Yeet(e): ops::Yeet<E>) -> Self {
Err(From::from(e))

View file

@ -11,7 +11,7 @@ use crate::ops::ControlFlow;
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
impl<T, U> const PartialEq<[U]> for [T]
where
T: ~const PartialEq<U>,
T: [const] PartialEq<U>,
{
fn eq(&self, other: &[U]) -> bool {
SlicePartialEq::equal(self, other)
@ -109,7 +109,7 @@ trait SlicePartialEq<B> {
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
impl<A, B> const SlicePartialEq<B> for [A]
where
A: ~const PartialEq<B>,
A: [const] PartialEq<B>,
{
default fn equal(&self, other: &[B]) -> bool {
if self.len() != other.len() {
@ -138,7 +138,7 @@ where
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
impl<A, B> const SlicePartialEq<B> for [A]
where
A: ~const BytewiseEq<B>,
A: [const] BytewiseEq<B>,
{
fn equal(&self, other: &[B]) -> bool {
if self.len() != other.len() {

View file

@ -9,7 +9,7 @@ use crate::{ops, range};
#[rustc_const_unstable(feature = "const_index", issue = "143775")]
impl<T, I> const ops::Index<I> for [T]
where
I: ~const SliceIndex<[T]>,
I: [const] SliceIndex<[T]>,
{
type Output = I::Output;
@ -23,7 +23,7 @@ where
#[rustc_const_unstable(feature = "const_index", issue = "143775")]
impl<T, I> const ops::IndexMut<I> for [T]
where
I: ~const SliceIndex<[T]>,
I: [const] SliceIndex<[T]>,
{
#[inline(always)]
fn index_mut(&mut self, index: I) -> &mut I::Output {

View file

@ -569,7 +569,7 @@ impl<T> [T] {
#[rustc_const_unstable(feature = "const_index", issue = "143775")]
pub const fn get<I>(&self, index: I) -> Option<&I::Output>
where
I: ~const SliceIndex<Self>,
I: [const] SliceIndex<Self>,
{
index.get(self)
}
@ -596,7 +596,7 @@ impl<T> [T] {
#[rustc_const_unstable(feature = "const_index", issue = "143775")]
pub const fn get_mut<I>(&mut self, index: I) -> Option<&mut I::Output>
where
I: ~const SliceIndex<Self>,
I: [const] SliceIndex<Self>,
{
index.get_mut(self)
}
@ -636,7 +636,7 @@ impl<T> [T] {
#[rustc_const_unstable(feature = "const_index", issue = "143775")]
pub const unsafe fn get_unchecked<I>(&self, index: I) -> &I::Output
where
I: ~const SliceIndex<Self>,
I: [const] SliceIndex<Self>,
{
// SAFETY: the caller must uphold most of the safety requirements for `get_unchecked`;
// the slice is dereferenceable because `self` is a safe reference.
@ -681,7 +681,7 @@ impl<T> [T] {
#[rustc_const_unstable(feature = "const_index", issue = "143775")]
pub const unsafe fn get_unchecked_mut<I>(&mut self, index: I) -> &mut I::Output
where
I: ~const SliceIndex<Self>,
I: [const] SliceIndex<Self>,
{
// SAFETY: the caller must uphold the safety requirements for `get_unchecked_mut`;
// the slice is dereferenceable because `self` is a safe reference.

View file

@ -603,7 +603,7 @@ impl str {
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[rustc_const_unstable(feature = "const_index", issue = "143775")]
#[inline]
pub const fn get<I: ~const SliceIndex<str>>(&self, i: I) -> Option<&I::Output> {
pub const fn get<I: [const] SliceIndex<str>>(&self, i: I) -> Option<&I::Output> {
i.get(self)
}
@ -636,7 +636,7 @@ impl str {
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[rustc_const_unstable(feature = "const_index", issue = "143775")]
#[inline]
pub const fn get_mut<I: ~const SliceIndex<str>>(&mut self, i: I) -> Option<&mut I::Output> {
pub const fn get_mut<I: [const] SliceIndex<str>>(&mut self, i: I) -> Option<&mut I::Output> {
i.get_mut(self)
}

View file

@ -53,7 +53,7 @@ impl PartialOrd for str {
#[rustc_const_unstable(feature = "const_index", issue = "143775")]
impl<I> const ops::Index<I> for str
where
I: ~const SliceIndex<str>,
I: [const] SliceIndex<str>,
{
type Output = I::Output;
@ -67,7 +67,7 @@ where
#[rustc_const_unstable(feature = "const_index", issue = "143775")]
impl<I> const ops::IndexMut<I> for str
where
I: ~const SliceIndex<str>,
I: [const] SliceIndex<str>,
{
#[inline]
fn index_mut(&mut self, index: I) -> &mut I::Output {

View file

@ -291,12 +291,7 @@ impl Step for Cargotest {
.args(builder.config.test_args())
.env("RUSTC", builder.rustc(tested_compiler))
.env("RUSTDOC", builder.rustdoc_for_compiler(tested_compiler));
add_rustdoc_cargo_linker_args(
&mut cmd,
builder,
tested_compiler.host,
LldThreads::No,
);
add_rustdoc_cargo_linker_args(&mut cmd, builder, tested_compiler.host, LldThreads::No);
cmd.delay_failure().run(builder);
}
@ -1119,12 +1114,7 @@ impl Step for RustdocGUI {
cmd.env("RUSTDOC", builder.rustdoc_for_compiler(self.compiler))
.env("RUSTC", builder.rustc(self.compiler));
add_rustdoc_cargo_linker_args(
&mut cmd,
builder,
self.compiler.host,
LldThreads::No,
);
add_rustdoc_cargo_linker_args(&mut cmd, builder, self.compiler.host, LldThreads::No);
for path in &builder.paths {
if let Some(p) = helpers::is_valid_test_suite_arg(path, "tests/rustdoc-gui", builder) {

View file

@ -1,20 +1,20 @@
error: `[const]` is not allowed here
--> const-super-trait.rs:7:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^
LL | trait Bar: [const] Foo {}
| ^^^^^^^
|
note: this trait is not `const`, so it cannot have `[const]` trait bounds
--> const-super-trait.rs:7:1
|
LL | trait Bar: ~const Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^
LL | trait Bar: [const] Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0658]: const trait impls are experimental
--> const-super-trait.rs:7:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^
LL | trait Bar: [const] Foo {}
| ^^^^^^^
|
= note: see issue #143874 <https://github.com/rust-lang/rust/issues/143874> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
@ -23,8 +23,8 @@ LL | trait Bar: ~const Foo {}
error[E0658]: const trait impls are experimental
--> const-super-trait.rs:9:17
|
LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^
LL | const fn foo<T: [const] Bar>(x: &T) {
| ^^^^^^^
|
= note: see issue #143874 <https://github.com/rust-lang/rust/issues/143874> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
@ -33,8 +33,8 @@ LL | const fn foo<T: ~const Bar>(x: &T) {
error: `[const]` can only be applied to `const` traits
--> const-super-trait.rs:7:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^ can't be applied to `Foo`
LL | trait Bar: [const] Foo {}
| ^^^^^^^ can't be applied to `Foo`
|
help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `const` to allow it to have `const` implementations
|
@ -44,12 +44,12 @@ LL | #[const_trait] trait Foo {
error: `[const]` can only be applied to `const` traits
--> const-super-trait.rs:9:17
|
LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^ can't be applied to `Bar`
LL | const fn foo<T: [const] Bar>(x: &T) {
| ^^^^^^^ can't be applied to `Bar`
|
help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `const` to allow it to have `const` implementations
|
LL | #[const_trait] trait Bar: ~const Foo {}
LL | #[const_trait] trait Bar: [const] Foo {}
| ++++++++++++++
error[E0015]: cannot call non-const method `<T as Foo>::a` in constant functions

View file

@ -1,20 +1,20 @@
error: `[const]` is not allowed here
--> const-super-trait.rs:7:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^
LL | trait Bar: [const] Foo {}
| ^^^^^^^
|
note: this trait is not `const`, so it cannot have `[const]` trait bounds
--> const-super-trait.rs:7:1
|
LL | trait Bar: ~const Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^
LL | trait Bar: [const] Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: `[const]` can only be applied to `const` traits
--> const-super-trait.rs:7:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^ can't be applied to `Foo`
LL | trait Bar: [const] Foo {}
| ^^^^^^^ can't be applied to `Foo`
|
help: mark `Foo` as `const` to allow it to have `const` implementations
|
@ -24,12 +24,12 @@ LL | #[const_trait] trait Foo {
error: `[const]` can only be applied to `const` traits
--> const-super-trait.rs:9:17
|
LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^ can't be applied to `Bar`
LL | const fn foo<T: [const] Bar>(x: &T) {
| ^^^^^^^ can't be applied to `Bar`
|
help: mark `Bar` as `const` to allow it to have `const` implementations
|
LL | #[const_trait] trait Bar: ~const Foo {}
LL | #[const_trait] trait Bar: [const] Foo {}
| ++++++++++++++
error[E0015]: cannot call non-const method `<T as Foo>::a` in constant functions

View file

@ -1,36 +1,36 @@
error: `[const]` is not allowed here
--> const-super-trait.rs:7:12
|
7 | trait Bar: ~const Foo {}
| ^^^^^^
7 | trait Bar: [const] Foo {}
| ^^^^^^^
|
note: this trait is not `const`, so it cannot have `[const]` trait bounds
--> const-super-trait.rs:7:1
|
7 | trait Bar: ~const Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^
7 | trait Bar: [const] Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0658]: const trait impls are experimental
--> const-super-trait.rs:7:12
|
7 | trait Bar: ~const Foo {}
| ^^^^^^
7 | trait Bar: [const] Foo {}
| ^^^^^^^
|
= note: see issue #143874 <https://github.com/rust-lang/rust/issues/143874> for more information
error[E0658]: const trait impls are experimental
--> const-super-trait.rs:9:17
|
9 | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^
9 | const fn foo<T: [const] Bar>(x: &T) {
| ^^^^^^^
|
= note: see issue #143874 <https://github.com/rust-lang/rust/issues/143874> for more information
error: `[const]` can only be applied to `const` traits
--> const-super-trait.rs:7:12
|
7 | trait Bar: ~const Foo {}
| ^^^^^^ can't be applied to `Foo`
7 | trait Bar: [const] Foo {}
| ^^^^^^^ can't be applied to `Foo`
|
note: `Foo` can't be used with `[const]` because it isn't `const`
--> const-super-trait.rs:3:1
@ -41,14 +41,14 @@ note: `Foo` can't be used with `[const]` because it isn't `const`
error: `[const]` can only be applied to `const` traits
--> const-super-trait.rs:9:17
|
9 | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^ can't be applied to `Bar`
9 | const fn foo<T: [const] Bar>(x: &T) {
| ^^^^^^^ can't be applied to `Bar`
|
note: `Bar` can't be used with `[const]` because it isn't `const`
--> const-super-trait.rs:7:1
|
7 | trait Bar: ~const Foo {}
| ^^^^^^^^^^^^^^^^^^^^^
7 | trait Bar: [const] Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0015]: cannot call non-const method `<T as Foo>::a` in constant functions
--> const-super-trait.rs:10:7

View file

@ -1,14 +1,14 @@
error: `[const]` is not allowed here
--> const-super-trait.rs:7:12
|
7 | trait Bar: ~const Foo {}
| ^^^^^^
7 | trait Bar: [const] Foo {}
| ^^^^^^^
|
note: this trait is not `const`, so it cannot have `[const]` trait bounds
--> const-super-trait.rs:7:1
|
7 | trait Bar: ~const Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^
7 | trait Bar: [const] Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0554]: `#![feature]` may not be used on the NIGHTLY release channel
--> const-super-trait.rs:1:30
@ -19,8 +19,8 @@ error[E0554]: `#![feature]` may not be used on the NIGHTLY release channel
error: `[const]` can only be applied to `const` traits
--> const-super-trait.rs:7:12
|
7 | trait Bar: ~const Foo {}
| ^^^^^^ can't be applied to `Foo`
7 | trait Bar: [const] Foo {}
| ^^^^^^^ can't be applied to `Foo`
|
note: `Foo` can't be used with `[const]` because it isn't `const`
--> const-super-trait.rs:3:1
@ -31,14 +31,14 @@ note: `Foo` can't be used with `[const]` because it isn't `const`
error: `[const]` can only be applied to `const` traits
--> const-super-trait.rs:9:17
|
9 | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^ can't be applied to `Bar`
9 | const fn foo<T: [const] Bar>(x: &T) {
| ^^^^^^^ can't be applied to `Bar`
|
note: `Bar` can't be used with `[const]` because it isn't `const`
--> const-super-trait.rs:7:1
|
7 | trait Bar: ~const Foo {}
| ^^^^^^^^^^^^^^^^^^^^^
7 | trait Bar: [const] Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0015]: cannot call non-const method `<T as Foo>::a` in constant functions
--> const-super-trait.rs:10:7

View file

@ -4,9 +4,9 @@ trait Foo {
fn a(&self);
}
trait Bar: ~const Foo {}
trait Bar: [const] Foo {}
const fn foo<T: ~const Bar>(x: &T) {
const fn foo<T: [const] Bar>(x: &T) {
x.a();
}