]> git.lizzy.rs Git - rust.git/commit
auto merge of #6471 : gifnksm/rust/reform-rational, r=brson
authorbors <bors@rust-lang.org>
Tue, 14 May 2013 22:28:59 +0000 (15:28 -0700)
committerbors <bors@rust-lang.org>
Tue, 14 May 2013 22:28:59 +0000 (15:28 -0700)
commitc30414f980eb3e8010640f6c83a5ef6f8e6ab047
tree1c7286df87d9beaa410a53fbdbcb714884d98e86
parent043d02213e19c5a5cffb781e5a11accbe28bf0de
parentda9c1fbf2740258fcb73a3d23bf3cf9d7d096189
auto merge of #6471 : gifnksm/rust/reform-rational, r=brson

`std::ratio` module contains `BigRational` type, but the type is not usable by following reasons.
* `Ratio::new` requires `T: Copy + Num + Ord`, but `BigInt` is not implicitly copyable, because it contains unique vector.
* `BigInt` is not implements `Num`

So, I rewrite `Ratio` as follows.
* `Ratio` requires `T: Clone + Integer + Ord`.
  * `Copy` -> `Clone`: to be able to use `BigRational`
  * `Num` -> `Integer`: It is incorrect that a rational number constructed by two non-integer numbers.
* `BigInt` implements `Num` and `Orderable` which are required by `Integer` bound
src/libstd/num/rational.rs