Closed
Description
opened on Jan 23, 2024
Feature gate: #![feature(generic_nonzero)]
This is a tracking issue for replacing the distinct NonZero*
types with a generic NonZero<T>
type. This allows using NonZero
with FFI type aliases instead of having weird type names like NonZero_c_ulonglong
.
This replaces the following tracking issues:
Public API
use core::num::{NonZero, NonZeroU8};
assert_eq!(NonZero::new(33u8), NonZeroU8::new(33));
Steps / History
- Initial implementation attempt: Add generic
NonZero
type. #100428 - Consolidate all associated items on the NonZero integer types into a single impl block per type #118665
- Add private
NonZero<T>
type alias. #119990 - Manually implement derived
NonZero
traits. #120160 - Switch
NonZero
alias direction. #120165 - Use
Self
inNonZero*
implementations. #120244 - Make
NonZero
constructors generic. #120521 - Use
transmute_unchecked
inNonZero::new
. #120809 - Make
NonZero::get
generic. #120563 - Use generic
NonZero
internally. #120486 - Make other methods generic. (optional, can happen after stabilization)
- Refactor trait implementations in
core::convert::num
. #121277 - Use generic
NonZero
everywhere inlibrary
. #121454 - Use generic
NonZero
in tests. #121461 - Make
ZeroablePrimitive
trait unsafe. #121850 - Final comment period (FCP)1
- Stabilization
- Generic
NonZero
post-stabilization changes. #124587
Unresolved Questions
- None yet.
Activity