feat(core): impl Step for NonZero<u*> by jalil-salame · Pull Request #127534 · rust-lang/rust (original) (raw)

Implement Step for NonZero unsigned integers as discussed in libs-team#130.

step_nonzero_impls was adapted from step_integer_impls and the tests were adapted from the step tests.

It seems to compile and pass the tests c:

I would like to test the edge cases, specially around overflows. To ensure safe code cannot generate a 0 NonZero, but I don't know how to go about it. I would love some feedback on that (and the PR overall).

The impls are tagges with #[unstable(feature = "step_trait", reason = "recently redesigned", issue = "42168")]. I assumed this was appropriate, but I am not sure.