about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorOli Scherer <github333195615777966@oli-obk.de>2025-03-11 12:08:45 +0000
committerOli Scherer <github333195615777966@oli-obk.de>2025-06-26 13:46:45 +0000
commiteb7245a864613f290c5668f4f4e8376edd065dc6 (patch)
treec31fc679f821ab1d469de7324a71d91f72787cbb /src
parent18f4cb11108bbb3119d4ba2a7eb06c80adf6a438 (diff)
downloadrust-eb7245a864613f290c5668f4f4e8376edd065dc6.tar.gz
rust-eb7245a864613f290c5668f4f4e8376edd065dc6.zip
Change const trait bound syntax from ~const to [const]
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/clean/mod.rs6
-rw-r--r--src/librustdoc/html/format.rs2
-rw-r--r--src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs2
-rw-r--r--src/tools/clippy/tests/ui/assign_ops.fixed2
-rw-r--r--src/tools/clippy/tests/ui/assign_ops.rs2
-rw-r--r--src/tools/clippy/tests/ui/trait_duplication_in_bounds.fixed4
-rw-r--r--src/tools/clippy/tests/ui/trait_duplication_in_bounds.rs4
-rw-r--r--src/tools/clippy/tests/ui/trait_duplication_in_bounds.stderr4
-rw-r--r--src/tools/rustfmt/tests/source/type.rs12
-rw-r--r--src/tools/rustfmt/tests/target/type.rs12
10 files changed, 25 insertions, 25 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index d77bdf09d01..3d027db2622 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -227,7 +227,7 @@ fn clean_generic_bound<'tcx>(
     Some(match bound {
         hir::GenericBound::Outlives(lt) => GenericBound::Outlives(clean_lifetime(lt, cx)),
         hir::GenericBound::Trait(t) => {
-            // `T: ~const Destruct` is hidden because `T: Destruct` is a no-op.
+            // `T: [const] Destruct` is hidden because `T: Destruct` is a no-op.
             if let hir::BoundConstness::Maybe(_) = t.modifiers.constness
                 && cx.tcx.lang_items().destruct_trait() == Some(t.trait_ref.trait_def_id().unwrap())
             {
@@ -395,7 +395,7 @@ pub(crate) fn clean_predicate<'tcx>(
         ty::ClauseKind::ConstEvaluatable(..)
         | ty::ClauseKind::WellFormed(..)
         | ty::ClauseKind::ConstArgHasType(..)
-        // FIXME(const_trait_impl): We can probably use this `HostEffect` pred to render `~const`.
+        // FIXME(const_trait_impl): We can probably use this `HostEffect` pred to render `[const]`.
         | ty::ClauseKind::HostEffect(_) => None,
     }
 }
@@ -404,7 +404,7 @@ fn clean_poly_trait_predicate<'tcx>(
     pred: ty::PolyTraitPredicate<'tcx>,
     cx: &mut DocContext<'tcx>,
 ) -> Option<WherePredicate> {
-    // `T: ~const Destruct` is hidden because `T: Destruct` is a no-op.
+    // `T: [const] Destruct` is hidden because `T: Destruct` is a no-op.
     // FIXME(const_trait_impl) check constness
     if Some(pred.skip_binder().def_id()) == cx.tcx.lang_items().destruct_trait() {
         return None;
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index 6ab1520386d..bcb3e57c844 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -268,7 +268,7 @@ impl clean::GenericBound {
         fmt::from_fn(move |f| match self {
             clean::GenericBound::Outlives(lt) => write!(f, "{}", lt.print()),
             clean::GenericBound::TraitBound(ty, modifiers) => {
-                // `const` and `~const` trait bounds are experimental; don't render them.
+                // `const` and `[const]` trait bounds are experimental; don't render them.
                 let hir::TraitBoundModifiers { polarity, constness: _ } = modifiers;
                 f.write_str(match polarity {
                     hir::BoundPolarity::Positive => "",
diff --git a/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs b/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs
index e629012b187..328fe3d428b 100644
--- a/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs
+++ b/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs
@@ -436,7 +436,7 @@ fn is_ty_const_destruct<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, body: &Body<'tcx>
     // FIXME(const_trait_impl, fee1-dead) revert to const destruct once it works again
     #[expect(unused)]
     fn is_ty_const_destruct_unused<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, body: &Body<'tcx>) -> bool {
-        // If this doesn't need drop at all, then don't select `~const Destruct`.
+        // If this doesn't need drop at all, then don't select `[const] Destruct`.
         if !ty.needs_drop(tcx, body.typing_env(tcx)) {
             return false;
         }
diff --git a/src/tools/clippy/tests/ui/assign_ops.fixed b/src/tools/clippy/tests/ui/assign_ops.fixed
index 3bc6885d7c3..99beea850a2 100644
--- a/src/tools/clippy/tests/ui/assign_ops.fixed
+++ b/src/tools/clippy/tests/ui/assign_ops.fixed
@@ -91,7 +91,7 @@ mod issue14871 {
 
     impl<T> const NumberConstants for T
     where
-        T: Number + ~const core::ops::Add,
+        T: Number + [const] core::ops::Add,
     {
         fn constant(value: usize) -> Self {
             let mut res = Self::ZERO;
diff --git a/src/tools/clippy/tests/ui/assign_ops.rs b/src/tools/clippy/tests/ui/assign_ops.rs
index f1f8f9daff9..900d5ad38e0 100644
--- a/src/tools/clippy/tests/ui/assign_ops.rs
+++ b/src/tools/clippy/tests/ui/assign_ops.rs
@@ -91,7 +91,7 @@ mod issue14871 {
 
     impl<T> const NumberConstants for T
     where
-        T: Number + ~const core::ops::Add,
+        T: Number + [const] core::ops::Add,
     {
         fn constant(value: usize) -> Self {
             let mut res = Self::ZERO;
diff --git a/src/tools/clippy/tests/ui/trait_duplication_in_bounds.fixed b/src/tools/clippy/tests/ui/trait_duplication_in_bounds.fixed
index 666ff78b218..cf52ecf2f03 100644
--- a/src/tools/clippy/tests/ui/trait_duplication_in_bounds.fixed
+++ b/src/tools/clippy/tests/ui/trait_duplication_in_bounds.fixed
@@ -169,9 +169,9 @@ where
 // #13476
 #[const_trait]
 trait ConstTrait {}
-const fn const_trait_bounds_good<T: ConstTrait + ~const ConstTrait>() {}
+const fn const_trait_bounds_good<T: ConstTrait + [const] ConstTrait>() {}
 
-const fn const_trait_bounds_bad<T: ~const ConstTrait>() {}
+const fn const_trait_bounds_bad<T: [const] ConstTrait>() {}
 //~^ trait_duplication_in_bounds
 
 fn projections<T, U, V>()
diff --git a/src/tools/clippy/tests/ui/trait_duplication_in_bounds.rs b/src/tools/clippy/tests/ui/trait_duplication_in_bounds.rs
index a1a86fe058e..955562f08dc 100644
--- a/src/tools/clippy/tests/ui/trait_duplication_in_bounds.rs
+++ b/src/tools/clippy/tests/ui/trait_duplication_in_bounds.rs
@@ -169,9 +169,9 @@ where
 // #13476
 #[const_trait]
 trait ConstTrait {}
-const fn const_trait_bounds_good<T: ConstTrait + ~const ConstTrait>() {}
+const fn const_trait_bounds_good<T: ConstTrait + [const] ConstTrait>() {}
 
-const fn const_trait_bounds_bad<T: ~const ConstTrait + ~const ConstTrait>() {}
+const fn const_trait_bounds_bad<T: [const] ConstTrait + [const] ConstTrait>() {}
 //~^ trait_duplication_in_bounds
 
 fn projections<T, U, V>()
diff --git a/src/tools/clippy/tests/ui/trait_duplication_in_bounds.stderr b/src/tools/clippy/tests/ui/trait_duplication_in_bounds.stderr
index d76b4e45848..ab31721ef51 100644
--- a/src/tools/clippy/tests/ui/trait_duplication_in_bounds.stderr
+++ b/src/tools/clippy/tests/ui/trait_duplication_in_bounds.stderr
@@ -61,8 +61,8 @@ LL | fn bad_trait_object(arg0: &(dyn Any + Send + Send)) {
 error: these bounds contain repeated elements
   --> tests/ui/trait_duplication_in_bounds.rs:174:36
    |
-LL | const fn const_trait_bounds_bad<T: ~const ConstTrait + ~const ConstTrait>() {}
-   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `~const ConstTrait`
+LL | const fn const_trait_bounds_bad<T: [const] ConstTrait + [const] ConstTrait>() {}
+   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[const] ConstTrait`
 
 error: these where clauses contain repeated elements
   --> tests/ui/trait_duplication_in_bounds.rs:181:8
diff --git a/src/tools/rustfmt/tests/source/type.rs b/src/tools/rustfmt/tests/source/type.rs
index 7a232f85198..213fad7cb16 100644
--- a/src/tools/rustfmt/tests/source/type.rs
+++ b/src/tools/rustfmt/tests/source/type.rs
@@ -142,18 +142,18 @@ type MyFn = fn(a: SomeLongComplexType, b: SomeOtherLongComplexType,) -> Box<Futu
 
 // Const bound
 
-trait T: ~   const  Super {}
+trait T: [   const ] Super {}
 
-const fn not_quite_const<S: ~  const    T>() -> i32 { <S as T>::CONST }
+const fn not_quite_const<S: [  const  ]  T>() -> i32 { <S as T>::CONST }
 
-impl ~    const T {}
+impl     const T for U {}
 
-fn apit(_: impl ~   const T) {}
+fn apit(_: impl [   const ] T) {}
 
-fn rpit() -> impl ~  const T { S }
+fn rpit() -> impl [  const] T { S }
 
 pub struct Foo<T: Trait>(T);
-impl<T:   ~  const Trait> Foo<T> {
+impl<T:   [  const] Trait> Foo<T> {
     fn new(t: T) -> Self {
         Self(t)
     }
diff --git a/src/tools/rustfmt/tests/target/type.rs b/src/tools/rustfmt/tests/target/type.rs
index 325adb52f3f..93479f8b484 100644
--- a/src/tools/rustfmt/tests/target/type.rs
+++ b/src/tools/rustfmt/tests/target/type.rs
@@ -147,22 +147,22 @@ type MyFn = fn(
 
 // Const bound
 
-trait T: ~const Super {}
+trait T: [const] Super {}
 
-const fn not_quite_const<S: ~const T>() -> i32 {
+const fn not_quite_const<S: [const] T>() -> i32 {
     <S as T>::CONST
 }
 
-impl ~const T {}
+impl const T for U {}
 
-fn apit(_: impl ~const T) {}
+fn apit(_: impl [const] T) {}
 
-fn rpit() -> impl ~const T {
+fn rpit() -> impl [const] T {
     S
 }
 
 pub struct Foo<T: Trait>(T);
-impl<T: ~const Trait> Foo<T> {
+impl<T: [const] Trait> Foo<T> {
     fn new(t: T) -> Self {
         Self(t)
     }