Skip to content

Conversation

@cuviper
Copy link
Member

@cuviper cuviper commented Dec 20, 2025

We can't name a specific error type in PrimitiveNumber: FromStr because it's different between floats and ints. However, we can refine that in PrimitiveFloat and PrimitiveInteger to specify their respective error types.

Similarly, PrimitiveInteger: TryFrom<_> is not specific because the error could be Infallible or TryFromIntError. In the cases of PrimitiveSigned: TryFrom<i8> and PrimitiveUnsigned: TryFrom<u8> though, we do know they are always Infallible -- which is implied by their respective From, but needs to be explicit.

We can't name a specific error type in `PrimitiveNumber: FromStr`
because it's different between floats and ints. However, we **can**
refine that in `PrimitiveFloat` and `PrimitiveInteger` to specify their
respective error types.

Similarly, `PrimitiveInteger: TryFrom<_>` is not specific because the
error could be `Infallible` or `TryFromIntError`. In the cases of
`PrimitiveSigned: TryFrom<i8>` and `PrimitiveUnsigned: TryFrom<u8>`
though, we do know they are always `Infallible` -- which is implied by
their respective `From`, but needs to be explicit.
@cuviper cuviper added this pull request to the merge queue Dec 20, 2025
Merged via the queue into rust-num:main with commit 6ec3465 Dec 20, 2025
9 checks passed
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