From 7bc34622f037fedf3cf15c4a6beea1b40494cb2f Mon Sep 17 00:00:00 2001 From: Boxy Date: Wed, 6 Aug 2025 13:51:50 +0100 Subject: [PATCH] tidy --- library/core/src/array/mod.rs | 4 +- library/core/src/cell.rs | 8 +- library/core/src/clone.rs | 2 +- library/core/src/cmp.rs | 8 +- library/core/src/cmp/bytewise.rs | 2 +- library/core/src/convert/mod.rs | 12 +-- library/core/src/intrinsics/mod.rs | 4 +- library/core/src/net/socket_addr.rs | 2 +- library/core/src/num/nonzero.rs | 2 +- library/core/src/ops/deref.rs | 2 +- library/core/src/ops/function.rs | 10 +-- library/core/src/ops/index.rs | 2 +- library/core/src/ops/try_trait.rs | 2 +- library/core/src/option.rs | 72 ++++++++-------- library/core/src/ptr/const_ptr.rs | 2 +- library/core/src/ptr/mut_ptr.rs | 2 +- library/core/src/ptr/non_null.rs | 2 +- library/core/src/result.rs | 82 +++++++++---------- library/core/src/slice/cmp.rs | 6 +- library/core/src/slice/index.rs | 4 +- library/core/src/slice/mod.rs | 8 +- library/core/src/str/mod.rs | 4 +- library/core/src/str/traits.rs | 4 +- src/bootstrap/src/core/build_steps/test.rs | 14 +--- .../const-super-trait-nightly-disabled.stderr | 26 +++--- .../const-super-trait-nightly-enabled.stderr | 18 ++-- .../const-super-trait-stable-disabled.stderr | 28 +++---- .../const-super-trait-stable-enabled.stderr | 20 ++--- .../const-super-trait.rs | 4 +- 29 files changed, 173 insertions(+), 183 deletions(-) diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index 1c23218552aa..b3a498570f95 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 const Index for [T; N] where - [T]: ~const Index, + [T]: [const] Index, { type Output = <[T] as Index>::Output; @@ -392,7 +392,7 @@ where #[rustc_const_unstable(feature = "const_index", issue = "143775")] impl const IndexMut for [T; N] where - [T]: ~const IndexMut, + [T]: [const] IndexMut, { #[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 d67408cae1b9..c639d50cc3d8 100644 --- a/library/core/src/cell.rs +++ b/library/core/src/cell.rs @@ -334,7 +334,7 @@ impl Clone for Cell { #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_default", issue = "143894")] -impl const Default for Cell { +impl const Default for Cell { /// Creates a `Cell`, with the `Default` value for T. #[inline] fn default() -> Cell { @@ -1325,7 +1325,7 @@ impl Clone for RefCell { #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_default", issue = "143894")] -impl const Default for RefCell { +impl const Default for RefCell { /// Creates a `RefCell`, with the `Default` value for T. #[inline] fn default() -> RefCell { @@ -2333,7 +2333,7 @@ impl UnsafeCell { #[stable(feature = "unsafe_cell_default", since = "1.10.0")] #[rustc_const_unstable(feature = "const_default", issue = "143894")] -impl const Default for UnsafeCell { +impl const Default for UnsafeCell { /// Creates an `UnsafeCell`, with the `Default` value for T. fn default() -> UnsafeCell { UnsafeCell::new(Default::default()) @@ -2438,7 +2438,7 @@ impl SyncUnsafeCell { #[unstable(feature = "sync_unsafe_cell", issue = "95439")] #[rustc_const_unstable(feature = "const_default", issue = "143894")] -impl const Default for SyncUnsafeCell { +impl const Default for SyncUnsafeCell { /// Creates an `SyncUnsafeCell`, with the `Default` value for T. fn default() -> SyncUnsafeCell { SyncUnsafeCell::new(Default::default()) diff --git a/library/core/src/clone.rs b/library/core/src/clone.rs index 51d037ddfd2c..e315c4fac08a 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 1b9af10a6fda..a64fade285bf 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 const PartialEq<&B> for &A where - A: ~const PartialEq, + A: [const] PartialEq, { #[inline] fn eq(&self, other: &&B) -> bool { @@ -2094,7 +2094,7 @@ mod impls { #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] impl const PartialEq<&mut B> for &mut A where - A: ~const PartialEq, + A: [const] PartialEq, { #[inline] fn eq(&self, other: &&mut B) -> bool { @@ -2164,7 +2164,7 @@ mod impls { #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] impl const PartialEq<&mut B> for &A where - A: ~const PartialEq, + A: [const] PartialEq, { #[inline] fn eq(&self, other: &&mut B) -> bool { @@ -2180,7 +2180,7 @@ mod impls { #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] impl const PartialEq<&B> for &mut A where - A: ~const PartialEq, + A: [const] PartialEq, { #[inline] fn eq(&self, other: &&B) -> bool { diff --git a/library/core/src/cmp/bytewise.rs b/library/core/src/cmp/bytewise.rs index 7d61c9345ecf..a06a6e8b69a2 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: - ~const PartialEq + Sized + [const] PartialEq + Sized { } diff --git a/library/core/src/convert/mod.rs b/library/core/src/convert/mod.rs index 220a24caf09e..0c3034c3d4cf 100644 --- a/library/core/src/convert/mod.rs +++ b/library/core/src/convert/mod.rs @@ -717,7 +717,7 @@ pub trait TryFrom: Sized { #[rustc_const_unstable(feature = "const_try", issue = "74935")] impl const AsRef for &T where - T: ~const AsRef, + T: [const] AsRef, { #[inline] fn as_ref(&self) -> &U { @@ -730,7 +730,7 @@ where #[rustc_const_unstable(feature = "const_try", issue = "74935")] impl const AsRef for &mut T where - T: ~const AsRef, + T: [const] AsRef, { #[inline] fn as_ref(&self) -> &U { @@ -751,7 +751,7 @@ where #[rustc_const_unstable(feature = "const_try", issue = "74935")] impl const AsMut for &mut T where - T: ~const AsMut, + T: [const] AsMut, { #[inline] fn as_mut(&mut self) -> &mut U { @@ -772,7 +772,7 @@ where #[rustc_const_unstable(feature = "const_from", issue = "143773")] impl const Into for T where - U: ~const From, + U: [const] From, { /// Calls `U::from(self)`. /// @@ -816,7 +816,7 @@ impl const From for T { #[rustc_const_unstable(feature = "const_from", issue = "143773")] impl const TryInto for T where - U: ~const TryFrom, + U: [const] TryFrom, { type Error = U::Error; @@ -832,7 +832,7 @@ where #[rustc_const_unstable(feature = "const_from", issue = "143773")] impl const TryFrom for T where - U: ~const Into, + U: [const] Into, { type Error = Infallible; diff --git a/library/core/src/intrinsics/mod.rs b/library/core/src/intrinsics/mod.rs index 106cc725fee2..4f020a756278 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(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(a: T, b: T) -> T { +pub const unsafe fn disjoint_bitor(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(x: T, y: T) -> (T, bool); #[rustc_nounwind] #[rustc_intrinsic] #[miri::intrinsic_fallback_is_spec] -pub const fn carrying_mul_add, U>( +pub const fn carrying_mul_add, 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 69924199f99f..df99e9b20c2e 100644 --- a/library/core/src/net/socket_addr.rs +++ b/library/core/src/net/socket_addr.rs @@ -613,7 +613,7 @@ impl const From for SocketAddr { #[stable(feature = "addr_from_into_ip", since = "1.17.0")] #[rustc_const_unstable(feature = "const_try", issue = "74935")] -impl> const From<(I, u16)> for SocketAddr { +impl> 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 f793602de508..d4606651411c 100644 --- a/library/core/src/num/nonzero.rs +++ b/library/core/src/num/nonzero.rs @@ -203,7 +203,7 @@ impl Copy for NonZero where T: ZeroablePrimitive {} #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] impl const PartialEq for NonZero 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 c2dede9fa088..5f68c1f55c25 100644 --- a/library/core/src/ops/deref.rs +++ b/library/core/src/ops/deref.rs @@ -269,7 +269,7 @@ impl 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 efc751a094d1..ad46e52a475d 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 const Fn for &F where - F: ~const Fn, + F: [const] Fn, { 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 const FnMut for &F where - F: ~const Fn, + F: [const] Fn, { 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 const FnOnce for &F where - F: ~const Fn, + F: [const] Fn, { type Output = F::Output; @@ -295,7 +295,7 @@ mod impls { #[rustc_const_unstable(feature = "const_trait_impl", issue = "143874")] impl const FnMut for &mut F where - F: ~const FnMut, + F: [const] FnMut, { 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 const FnOnce for &mut F where - F: ~const FnMut, + F: [const] FnMut, { 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 d8489e9a9491..1aed2fb4742e 100644 --- a/library/core/src/ops/index.rs +++ b/library/core/src/ops/index.rs @@ -169,7 +169,7 @@ see chapter in The Book : ~const Index { +pub trait IndexMut: [const] Index { /// 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 a889c824be53..76bf438878f0 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 ed070fbd2274..560d20ce6179 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -651,7 +651,7 @@ impl Option { #[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 Option { #[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 Option { #[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 Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn unwrap_or_else(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 Option { #[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 Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn map(self, f: F) -> Option 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 Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn inspect(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 Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn map_or(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 Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn map_or_else(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 Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn map_or_default(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 Option { #[inline] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] - pub const fn ok_or(self, err: E) -> Result { + pub const fn ok_or(self, err: E) -> Result { match self { Some(v) => Ok(v), None => Err(err), @@ -1355,7 +1355,7 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn ok_or_else(self, err: F) -> Result where - F: ~const FnOnce() -> E + ~const Destruct, + F: [const] FnOnce() -> E + [const] Destruct, { match self { Some(v) => Ok(v), @@ -1487,8 +1487,8 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn and(self, optb: Option) -> Option where - T: ~const Destruct, - U: ~const Destruct, + T: [const] Destruct, + U: [const] Destruct, { match self { Some(_) => optb, @@ -1531,7 +1531,7 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn and_then(self, f: F) -> Option where - F: ~const FnOnce(T) -> Option + ~const Destruct, + F: [const] FnOnce(T) -> Option + [const] Destruct, { match self { Some(x) => f(x), @@ -1568,8 +1568,8 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn filter

(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 Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn or(self, optb: Option) -> Option where - T: ~const Destruct, + T: [const] Destruct, { match self { x @ Some(_) => x, @@ -1637,10 +1637,10 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn or_else(self, f: F) -> Option where - F: ~const FnOnce() -> Option + ~const Destruct, + F: [const] FnOnce() -> Option + [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 Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn xor(self, optb: Option) -> Option where - T: ~const Destruct, + T: [const] Destruct, { match (self, optb) { (a @ Some(_), None) => a, @@ -1712,7 +1712,7 @@ impl Option { #[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 Option { #[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 Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn get_or_insert_with(&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 Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn take_if

(&mut self, predicate: P) -> Option 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 Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn zip(self, other: Option) -> 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 Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn zip_with(self, other: Option, f: F) -> Option 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 const Clone for Option 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> for Option<&'a mut T> { impl crate::marker::StructuralPartialEq for Option {} #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] -impl const PartialEq for Option { +impl const PartialEq for Option { #[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 2ad520b7ead7..8b3703bd4b32 100644 --- a/library/core/src/ptr/const_ptr.rs +++ b/library/core/src/ptr/const_ptr.rs @@ -1528,7 +1528,7 @@ impl *const [T] { #[inline] pub const unsafe fn get_unchecked(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 579e2461103d..af39ec86d7ac 100644 --- a/library/core/src/ptr/mut_ptr.rs +++ b/library/core/src/ptr/mut_ptr.rs @@ -1885,7 +1885,7 @@ impl *mut [T] { #[inline(always)] pub const unsafe fn get_unchecked_mut(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 62da6567cca7..8667361fecc7 100644 --- a/library/core/src/ptr/non_null.rs +++ b/library/core/src/ptr/non_null.rs @@ -1601,7 +1601,7 @@ impl NonNull<[T]> { #[inline] pub const unsafe fn get_unchecked_mut(self, index: I) -> NonNull 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 474f86395ae0..6148bdb866ad 100644 --- a/library/core/src/result.rs +++ b/library/core/src/result.rs @@ -610,9 +610,9 @@ impl Result { #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] pub const fn is_ok_and(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 Result { #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] pub const fn is_err_and(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 Result { #[rustc_diagnostic_item = "result_ok_method"] pub const fn ok(self) -> Option where - T: ~const Destruct, - E: ~const Destruct, + T: [const] Destruct, + E: [const] Destruct, { match self { Ok(x) => Some(x), @@ -727,8 +727,8 @@ impl Result { #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] pub const fn err(self) -> Option where - T: ~const Destruct, - E: ~const Destruct, + T: [const] Destruct, + E: [const] Destruct, { match self { Ok(_) => None, @@ -822,7 +822,7 @@ impl Result { #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] pub const fn map(self, op: F) -> Result 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 Result { #[must_use = "if you don't need the returned value, use `if let` instead"] pub const fn map_or(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 Result { #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] pub const fn map_or_else(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 Result { #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] pub const fn map_or_default(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 Result { #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] pub const fn map_err(self, op: O) -> Result 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 Result { #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] pub const fn inspect(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 Result { #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] pub const fn inspect_err(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 Result { #[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 Result { #[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 Result { #[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 Result { #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] pub const fn and(self, res: Result) -> Result 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 Result { #[rustc_confusables("flat_map", "flatmap")] pub const fn and_then(self, op: F) -> Result where - F: ~const FnOnce(T) -> Result + ~const Destruct, + F: [const] FnOnce(T) -> Result + [const] Destruct, { match self { Ok(t) => op(t), @@ -1517,9 +1517,9 @@ impl Result { #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] pub const fn or(self, res: Result) -> Result 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 Result { #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] pub const fn or_else(self, op: O) -> Result where - O: ~const FnOnce(E) -> Result + ~const Destruct, + O: [const] FnOnce(E) -> Result + [const] Destruct, { match self { Ok(t) => Ok(t), @@ -1579,8 +1579,8 @@ impl Result { #[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 Result { #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] pub const fn unwrap_or_else(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 const ops::Try for Result { #[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")] #[rustc_const_unstable(feature = "const_try", issue = "74935")] -impl> const ops::FromResidual> +impl> const ops::FromResidual> for Result { #[inline] @@ -2178,7 +2178,7 @@ impl> const ops::FromResidual> const ops::FromResidual> for Result { +impl> const ops::FromResidual> for Result { #[inline] fn from_residual(ops::Yeet(e): ops::Yeet) -> Self { Err(From::from(e)) diff --git a/library/core/src/slice/cmp.rs b/library/core/src/slice/cmp.rs index 1eda8bc1bec4..68bd12aa7bf2 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 const PartialEq<[U]> for [T] where - T: ~const PartialEq, + T: [const] PartialEq, { fn eq(&self, other: &[U]) -> bool { SlicePartialEq::equal(self, other) @@ -109,7 +109,7 @@ trait SlicePartialEq { #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] impl const SlicePartialEq for [A] where - A: ~const PartialEq, + A: [const] PartialEq, { 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 const SlicePartialEq for [A] where - A: ~const BytewiseEq, + A: [const] BytewiseEq, { 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 322b3580eded..ae360df80f60 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 const ops::Index 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 const ops::IndexMut 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 cb3315f362a1..64f5b5dd8313 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -569,7 +569,7 @@ impl [T] { #[rustc_const_unstable(feature = "const_index", issue = "143775")] pub const fn get(&self, index: I) -> Option<&I::Output> where - I: ~const SliceIndex, + I: [const] SliceIndex, { index.get(self) } @@ -596,7 +596,7 @@ impl [T] { #[rustc_const_unstable(feature = "const_index", issue = "143775")] pub const fn get_mut(&mut self, index: I) -> Option<&mut I::Output> where - I: ~const SliceIndex, + I: [const] SliceIndex, { index.get_mut(self) } @@ -636,7 +636,7 @@ impl [T] { #[rustc_const_unstable(feature = "const_index", issue = "143775")] pub const unsafe fn get_unchecked(&self, index: I) -> &I::Output where - I: ~const SliceIndex, + I: [const] SliceIndex, { // 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] { #[rustc_const_unstable(feature = "const_index", issue = "143775")] pub const unsafe fn get_unchecked_mut(&mut self, index: I) -> &mut I::Output where - I: ~const SliceIndex, + I: [const] SliceIndex, { // 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 c40af4de7e03..1b6e84175b93 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>(&self, i: I) -> Option<&I::Output> { + pub const fn get>(&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>(&mut self, i: I) -> Option<&mut I::Output> { + pub const fn get_mut>(&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 1597d1c1fa86..dc88f35eca7e 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 const ops::Index for str where - I: ~const SliceIndex, + I: [const] SliceIndex, { type Output = I::Output; @@ -67,7 +67,7 @@ where #[rustc_const_unstable(feature = "const_index", issue = "143775")] impl const ops::IndexMut for str where - I: ~const SliceIndex, + I: [const] SliceIndex, { #[inline] fn index_mut(&mut self, index: I) -> &mut I::Output { diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index acd4d461fa0f..c842a17cbc8b 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -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) { diff --git a/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-disabled.stderr b/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-disabled.stderr index 464208f989e3..895558f3b0fc 100644 --- a/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-disabled.stderr +++ b/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-disabled.stderr @@ -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 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(x: &T) { - | ^^^^^^ +LL | const fn foo(x: &T) { + | ^^^^^^^ | = note: see issue #143874 for more information = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable @@ -33,8 +33,8 @@ LL | const fn foo(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(x: &T) { - | ^^^^^^ can't be applied to `Bar` +LL | const fn foo(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 `::a` in constant functions diff --git a/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-enabled.stderr b/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-enabled.stderr index 569e559186f7..821ab6fa57cd 100644 --- a/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-enabled.stderr +++ b/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-enabled.stderr @@ -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(x: &T) { - | ^^^^^^ can't be applied to `Bar` +LL | const fn foo(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 `::a` in constant functions diff --git a/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-disabled.stderr b/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-disabled.stderr index 694e06fb6ea2..b39be78e4384 100644 --- a/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-disabled.stderr +++ b/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-disabled.stderr @@ -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 for more information error[E0658]: const trait impls are experimental --> const-super-trait.rs:9:17 | -9 | const fn foo(x: &T) { - | ^^^^^^ +9 | const fn foo(x: &T) { + | ^^^^^^^ | = note: see issue #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(x: &T) { - | ^^^^^^ can't be applied to `Bar` +9 | const fn foo(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 `::a` in constant functions --> const-super-trait.rs:10:7 diff --git a/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-enabled.stderr b/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-enabled.stderr index 2109f0deb729..30ee5cf6f4b0 100644 --- a/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-enabled.stderr +++ b/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-enabled.stderr @@ -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(x: &T) { - | ^^^^^^ can't be applied to `Bar` +9 | const fn foo(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 `::a` in constant functions --> const-super-trait.rs:10:7 diff --git a/tests/run-make/const-trait-stable-toolchain/const-super-trait.rs b/tests/run-make/const-trait-stable-toolchain/const-super-trait.rs index b2ee96d79f70..2371dfc0e6d0 100644 --- a/tests/run-make/const-trait-stable-toolchain/const-super-trait.rs +++ b/tests/run-make/const-trait-stable-toolchain/const-super-trait.rs @@ -4,9 +4,9 @@ trait Foo { fn a(&self); } -trait Bar: ~const Foo {} +trait Bar: [const] Foo {} -const fn foo(x: &T) { +const fn foo(x: &T) { x.a(); }