Skip to content

ctutils: core::num::NonZero<T> support#1368

Merged
tarcieri merged 1 commit intomasterfrom
ctutils/nonzero-support
Jan 17, 2026
Merged

ctutils: core::num::NonZero<T> support#1368
tarcieri merged 1 commit intomasterfrom
ctutils/nonzero-support

Conversation

@tarcieri
Copy link
Member

Adds initial support for the following aliases of NonZero<T>:

  • NonZeroI8
  • NonZeroI16
  • NonZeroI32
  • NonZeroI64
  • NonZeroI128
  • NonZeroU8
  • NonZeroU16
  • NonZeroU32
  • NonZeroU64
  • NonZeroU128

(We can't yet implement things generically because NonZero bounds on T: ZeroablePrimitive which is unstable)

The following traits are impl'd for all of the above:

  • CtAssign
  • CtEq
  • CtNeg
  • CtSelect

The following are impl'd for the unsigned NonZeroU* types:

  • CtGt
  • CtLt

Adds initial support for the following aliases of `NonZero<T>`:

- NonZeroI8
- NonZeroI16
- NonZeroI32
- NonZeroI64
- NonZeroI128
- NonZeroU8
- NonZeroU16
- NonZeroU32
- NonZeroU64
- NonZeroU128

(We can't yet implement things generically because `NonZero` bounds on
`T: ZeroablePrimitive` which is unstable)

The following traits are impl'd for all of the above:
- `CtAssign`
- `CtEq`
- `CtNeg`
- `CtSelect`

The following are impl'd for the unsigned `NonZeroU*` types:
- `CtGt`
- `CtLt`
@tarcieri tarcieri merged commit 2a8b0b1 into master Jan 17, 2026
12 checks passed
@tarcieri tarcieri deleted the ctutils/nonzero-support branch January 17, 2026 01:35
@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