diff options
| author | Boxy <rust@boxyuwu.dev> | 2025-08-06 13:51:50 +0100 |
|---|---|---|
| committer | Boxy <rust@boxyuwu.dev> | 2025-08-06 16:55:50 +0100 |
| commit | 7bc34622f037fedf3cf15c4a6beea1b40494cb2f (patch) | |
| tree | cef0c0a6a0bb035a176c63b6ac53e5b335cd6390 /library/core/src | |
| parent | 351e4bd1066a9d89b4d9f06c628ba0733c1850b5 (diff) | |
| download | rust-7bc34622f037fedf3cf15c4a6beea1b40494cb2f.tar.gz rust-7bc34622f037fedf3cf15c4a6beea1b40494cb2f.zip | |
tidy
Diffstat (limited to 'library/core/src')
| -rw-r--r-- | library/core/src/array/mod.rs | 4 | ||||
| -rw-r--r-- | library/core/src/cell.rs | 8 | ||||
| -rw-r--r-- | library/core/src/clone.rs | 2 | ||||
| -rw-r--r-- | library/core/src/cmp.rs | 8 | ||||
| -rw-r--r-- | library/core/src/cmp/bytewise.rs | 2 | ||||
| -rw-r--r-- | library/core/src/convert/mod.rs | 12 | ||||
| -rw-r--r-- | library/core/src/intrinsics/mod.rs | 4 | ||||
| -rw-r--r-- | library/core/src/net/socket_addr.rs | 2 | ||||
| -rw-r--r-- | library/core/src/num/nonzero.rs | 2 | ||||
| -rw-r--r-- | library/core/src/ops/deref.rs | 2 | ||||
| -rw-r--r-- | library/core/src/ops/function.rs | 10 | ||||
| -rw-r--r-- | library/core/src/ops/index.rs | 2 | ||||
| -rw-r--r-- | library/core/src/ops/try_trait.rs | 2 | ||||
| -rw-r--r-- | library/core/src/option.rs | 72 | ||||
| -rw-r--r-- | library/core/src/ptr/const_ptr.rs | 2 | ||||
| -rw-r--r-- | library/core/src/ptr/mut_ptr.rs | 2 | ||||
| -rw-r--r-- | library/core/src/ptr/non_null.rs | 2 | ||||
| -rw-r--r-- | library/core/src/result.rs | 82 | ||||
| -rw-r--r-- | library/core/src/slice/cmp.rs | 6 | ||||
| -rw-r--r-- | library/core/src/slice/index.rs | 4 | ||||
| -rw-r--r-- | library/core/src/slice/mod.rs | 8 | ||||
| -rw-r--r-- | library/core/src/str/mod.rs | 4 | ||||
| -rw-r--r-- | library/core/src/str/traits.rs | 4 |
23 files changed, 123 insertions, 123 deletions
diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index 1c23218552a..b3a498570f9 100644 --- a/library/core/src/array/mod.rs +++ b/library/core/src/array/mod.rs @@ -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 { diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs index d67408cae1b..c639d50cc3d 100644 --- a/library/core/src/cell.rs +++ b/library/core/src/cell.rs @@ -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()) diff --git a/library/core/src/clone.rs b/library/core/src/clone.rs index 51d037ddfd2..e315c4fac08 100644 --- a/library/core/src/clone.rs +++ b/library/core/src/clone.rs @@ -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() } diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index 1b9af10a6fd..a64fade285b 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -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 { diff --git a/library/core/src/cmp/bytewise.rs b/library/core/src/cmp/bytewise.rs index 7d61c9345ec..a06a6e8b69a 100644 --- a/library/core/src/cmp/bytewise.rs +++ b/library/core/src/cmp/bytewise.rs @@ -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 { } diff --git a/library/core/src/convert/mod.rs b/library/core/src/convert/mod.rs index 220a24caf09..0c3034c3d4c 100644 --- a/library/core/src/convert/mod.rs +++ b/library/core/src/convert/mod.rs @@ -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; diff --git a/library/core/src/intrinsics/mod.rs b/library/core/src/intrinsics/mod.rs index 106cc725fee..4f020a75627 100644 --- a/library/core/src/intrinsics/mod.rs +++ b/library/core/src/intrinsics/mod.rs @@ -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, diff --git a/library/core/src/net/socket_addr.rs b/library/core/src/net/socket_addr.rs index 69924199f99..df99e9b20c2 100644 --- a/library/core/src/net/socket_addr.rs +++ b/library/core/src/net/socket_addr.rs @@ -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`] diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs index f793602de50..d4606651411 100644 --- a/library/core/src/num/nonzero.rs +++ b/library/core/src/num/nonzero.rs @@ -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 { diff --git a/library/core/src/ops/deref.rs b/library/core/src/ops/deref.rs index c2dede9fa08..5f68c1f55c2 100644 --- a/library/core/src/ops/deref.rs +++ b/library/core/src/ops/deref.rs @@ -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"] diff --git a/library/core/src/ops/function.rs b/library/core/src/ops/function.rs index efc751a094d..ad46e52a475 100644 --- a/library/core/src/ops/function.rs +++ b/library/core/src/ops/function.rs @@ -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 { diff --git a/library/core/src/ops/index.rs b/library/core/src/ops/index.rs index d8489e9a949..1aed2fb4742 100644 --- a/library/core/src/ops/index.rs +++ b/library/core/src/ops/index.rs @@ -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 diff --git a/library/core/src/ops/try_trait.rs b/library/core/src/ops/try_trait.rs index a889c824be5..76bf438878f 100644 --- a/library/core/src/ops/try_trait.rs +++ b/library/core/src/ops/try_trait.rs @@ -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; diff --git a/library/core/src/option.rs b/library/core/src/option.rs index ed070fbd227..560d20ce617 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -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 diff --git a/library/core/src/ptr/const_ptr.rs b/library/core/src/ptr/const_ptr.rs index 2ad520b7ead..8b3703bd4b3 100644 --- a/library/core/src/ptr/const_ptr.rs +++ b/library/core/src/ptr/const_ptr.rs @@ -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) } diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs index 579e2461103..af39ec86d7a 100644 --- a/library/core/src/ptr/mut_ptr.rs +++ b/library/core/src/ptr/mut_ptr.rs @@ -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) } diff --git a/library/core/src/ptr/non_null.rs b/library/core/src/ptr/non_null.rs index 62da6567cca..8667361fecc 100644 --- a/library/core/src/ptr/non_null.rs +++ b/library/core/src/ptr/non_null.rs @@ -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. diff --git a/library/core/src/result.rs b/library/core/src/result.rs index 474f86395ae..6148bdb866a 100644 --- a/library/core/src/result.rs +++ b/library/core/src/result.rs @@ -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)) diff --git a/library/core/src/slice/cmp.rs b/library/core/src/slice/cmp.rs index 1eda8bc1bec..68bd12aa7bf 100644 --- a/library/core/src/slice/cmp.rs +++ b/library/core/src/slice/cmp.rs @@ -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() { diff --git a/library/core/src/slice/index.rs b/library/core/src/slice/index.rs index 322b3580ede..ae360df80f6 100644 --- a/library/core/src/slice/index.rs +++ b/library/core/src/slice/index.rs @@ -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 { diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index cb3315f362a..64f5b5dd831 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -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. diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index c40af4de7e0..1b6e84175b9 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -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) } diff --git a/library/core/src/str/traits.rs b/library/core/src/str/traits.rs index 1597d1c1fa8..dc88f35eca7 100644 --- a/library/core/src/str/traits.rs +++ b/library/core/src/str/traits.rs @@ -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 { |
