rust-num / num-traits

Numeric traits for generic mathematics in Rust
Apache License 2.0
699 stars 131 forks source link

Officially deprecate `Saturating` #255

Open benluelo opened 1 year ago

benluelo commented 1 year ago

The Saturating trait was deprecated here: https://github.com/rust-num/num-traits/commit/86c31265f582d98ca58ff494567f1bbaf6aa4b5b, but not officially (i.e. no #[deprecated, reason = "..."] attribute). Is there a reason for this? Would it be possible to do this?

benluelo commented 1 year ago

Possibly related to https://github.com/rust-num/num-traits/issues/47, although I don't think that deprecating a trait is a breaking change

cuviper commented 1 year ago

It's unfortunately tied to the PrimInt trait, as mentioned in https://github.com/rust-num/num-traits/pull/165#issuecomment-622645129. For that reason, I think a "soft" deprecation is better so folks don't have to squash a warning they can't otherwise avoid. There's also no inherent disadvantage to using Saturating -- it's just not consistent with how we did Checked* and Wrapping* traits.

Deprecation is not a breaking change though, you're right about that.