Skip to content

ctutils: use new cmov trait impls; remove unsafe#1405

Merged
tarcieri merged 1 commit intomasterfrom
ctutils/use-new-cmov-trait-impls
Jan 19, 2026
Merged

ctutils: use new cmov trait impls; remove unsafe#1405
tarcieri merged 1 commit intomasterfrom
ctutils/use-new-cmov-trait-impls

Conversation

@tarcieri
Copy link
Member

In #1404 impls of Cmov and CmovEq were added to the NonZero* and Ordering types and slices thereof, which is what the unsafe code in ctutils existed to handle.

Now they can be handled like the other types cmov already has trait impls for.

And with that, we can remove all of the unsafe code in this crate, with all of it having been factored into the cmov crate, which makes that the one place to look for unsafe auditing.

With all the unsafe removed, this also adds forbid(unsafe_code).

@tarcieri tarcieri force-pushed the ctutils/use-new-cmov-trait-impls branch from 0b8fd74 to f80984e Compare January 19, 2026 04:33
In #1404 impls of `Cmov` and `CmovEq` were added to the `NonZero*` and
`Ordering` types and slices thereof, which is what the unsafe code in
`ctutils` existed to handle.

Now they can be handled like the other types `cmov` already has trait
impls for.

And with that, we can remove all of the unsafe code in this crate,
with all of it having been factored into the `cmov` crate, which makes
that the one place to look for `unsafe` auditing.

With all the `unsafe` removed, this also adds `forbid(unsafe_code)`.
@tarcieri tarcieri force-pushed the ctutils/use-new-cmov-trait-impls branch from f80984e to 94f8a30 Compare January 19, 2026 04:53
@tarcieri tarcieri merged commit 1be824b into master Jan 19, 2026
120 checks passed
@tarcieri tarcieri deleted the ctutils/use-new-cmov-trait-impls branch January 19, 2026 04:59
@tarcieri tarcieri mentioned this pull request Jan 20, 2026
tarcieri added a commit that referenced this pull request Jan 20, 2026
## Added
- `core::num::NonZero<T>` support (#1368)
- Pluggable trait impls for `[T]` and `[T; N]` with helper traits: (#1388)
  - `CtAssign`: `CtAssignSlice`
  - `CtEq`: `CtEqSlice`
  - `CtSelect`: `CtSelectArray`
- `CtSelectUsingCtAssign` marker trait (#1391)

## Changed
- Split `CtAssign` out of `CtSelect` (#1363)
- Bump `cmov` to v0.5 (#1386)

## Removed
- `BytesCtEq`/`BytesCtSelect` no longer needed because default `[u8]`
  impls are fast (#1376)
- `target_pointer_width` gating (#1389)
- `unsafe` code (#1405)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant