]> git.lizzy.rs Git - rust.git/commit
Simplify std::num::Primitive trait definition
authorBrendan Zabarauskas <bjzaba@yahoo.com.au>
Fri, 17 Jan 2014 21:53:00 +0000 (08:53 +1100)
committerBrendan Zabarauskas <bjzaba@yahoo.com.au>
Fri, 17 Jan 2014 22:12:53 +0000 (09:12 +1100)
commit472dfe74b32bfa855b70bf8ec59beddbd0514be1
tree15c18502fdbf22fdf3a80bda2a8968aaa39ada5c
parent80a3f453db387d02dcb596745731031e7a8c9048
Simplify std::num::Primitive trait definition

This removes the `Primitive::{bits, bytes, is_signed}` methods and removes the operator trait constraints, for the reasons outlined below:

- The `Primitive::{bits, bytes}` associated functions were originally added to reflect the existing `BITS` and `BYTES` statics included in the numeric modules. These statics are only exist as a workaround for Rust's lack of CTFE, and should probably be deprecated in the future in favor of using the `std::mem::size_of` function (see #11621).

- `Primitive::is_signed` seems to be of little utility and does not seem to be used anywhere in the Rust compiler or libraries. It is also rather ugly to call due to the `Option<Self>` workaround for #8888.

- The operator trait constraints are already covered by the `Num` trait.
src/libstd/num/f32.rs
src/libstd/num/f64.rs
src/libstd/num/int_macros.rs
src/libstd/num/mod.rs
src/libstd/num/uint_macros.rs