Skip to content

Commit 4f3c174

Browse files
committed
Change const trait bound syntax from ~const to [const]
1 parent 1d764e0 commit 4f3c174

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

clippy_utils/src/qualify_min_const_fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ fn is_ty_const_destruct<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, body: &Body<'tcx>
436436
// FIXME(const_trait_impl, fee1-dead) revert to const destruct once it works again
437437
#[expect(unused)]
438438
fn is_ty_const_destruct_unused<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, body: &Body<'tcx>) -> bool {
439-
// If this doesn't need drop at all, then don't select `~const Destruct`.
439+
// If this doesn't need drop at all, then don't select `[const] Destruct`.
440440
if !ty.needs_drop(tcx, body.typing_env(tcx)) {
441441
return false;
442442
}

tests/ui/assign_ops.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ mod issue14871 {
9191

9292
impl<T> const NumberConstants for T
9393
where
94-
T: Number + ~const core::ops::Add,
94+
T: Number + [const] core::ops::Add,
9595
{
9696
fn constant(value: usize) -> Self {
9797
let mut res = Self::ZERO;

tests/ui/assign_ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ mod issue14871 {
9191

9292
impl<T> const NumberConstants for T
9393
where
94-
T: Number + ~const core::ops::Add,
94+
T: Number + [const] core::ops::Add,
9595
{
9696
fn constant(value: usize) -> Self {
9797
let mut res = Self::ZERO;

tests/ui/trait_duplication_in_bounds.fixed

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ where
169169
// #13476
170170
#[const_trait]
171171
trait ConstTrait {}
172-
const fn const_trait_bounds_good<T: ConstTrait + ~const ConstTrait>() {}
172+
const fn const_trait_bounds_good<T: ConstTrait + [const] ConstTrait>() {}
173173

174-
const fn const_trait_bounds_bad<T: ~const ConstTrait>() {}
174+
const fn const_trait_bounds_bad<T: [const] ConstTrait>() {}
175175
//~^ trait_duplication_in_bounds
176176

177177
fn projections<T, U, V>()

tests/ui/trait_duplication_in_bounds.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ where
169169
// #13476
170170
#[const_trait]
171171
trait ConstTrait {}
172-
const fn const_trait_bounds_good<T: ConstTrait + ~const ConstTrait>() {}
172+
const fn const_trait_bounds_good<T: ConstTrait + [const] ConstTrait>() {}
173173

174-
const fn const_trait_bounds_bad<T: ~const ConstTrait + ~const ConstTrait>() {}
174+
const fn const_trait_bounds_bad<T: [const] ConstTrait + [const] ConstTrait>() {}
175175
//~^ trait_duplication_in_bounds
176176

177177
fn projections<T, U, V>()

tests/ui/trait_duplication_in_bounds.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ LL | fn bad_trait_object(arg0: &(dyn Any + Send + Send)) {
6161
error: these bounds contain repeated elements
6262
--> tests/ui/trait_duplication_in_bounds.rs:174:36
6363
|
64-
LL | const fn const_trait_bounds_bad<T: ~const ConstTrait + ~const ConstTrait>() {}
65-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `~const ConstTrait`
64+
LL | const fn const_trait_bounds_bad<T: [const] ConstTrait + [const] ConstTrait>() {}
65+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[const] ConstTrait`
6666

6767
error: these where clauses contain repeated elements
6868
--> tests/ui/trait_duplication_in_bounds.rs:181:8

0 commit comments

Comments
 (0)