Merge pull request #2560 from bstrie/num
Allow multiple `num` impls to be imported at once
This commit is contained in:
commit
c91d5aa95c
2 changed files with 3 additions and 5 deletions
|
@ -1,6 +1,5 @@
|
|||
import T = inst::T;
|
||||
import cmp::{eq, ord};
|
||||
import num::num;
|
||||
|
||||
export min_value, max_value;
|
||||
export min, max;
|
||||
|
@ -124,7 +123,7 @@ impl eq of eq for T {
|
|||
}
|
||||
}
|
||||
|
||||
impl num of num for T {
|
||||
impl num of num::num for T {
|
||||
fn add(&&other: T) -> T { ret self + other; }
|
||||
fn sub(&&other: T) -> T { ret self - other; }
|
||||
fn mul(&&other: T) -> T { ret self * other; }
|
||||
|
@ -196,7 +195,7 @@ fn test_to_str() {
|
|||
|
||||
#[test]
|
||||
fn test_ifaces() {
|
||||
fn test<U:num>(ten: U) {
|
||||
fn test<U:num::num>(ten: U) {
|
||||
assert (ten.to_int() == 10);
|
||||
|
||||
let two = ten.from_int(2);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import T = inst::T;
|
||||
import cmp::{eq, ord};
|
||||
import num::num;
|
||||
|
||||
export min_value, max_value;
|
||||
export min, max;
|
||||
|
@ -65,7 +64,7 @@ impl eq of eq for T {
|
|||
}
|
||||
}
|
||||
|
||||
impl num of num for T {
|
||||
impl num of num::num for T {
|
||||
fn add(&&other: T) -> T { ret self + other; }
|
||||
fn sub(&&other: T) -> T { ret self - other; }
|
||||
fn mul(&&other: T) -> T { ret self * other; }
|
||||
|
|
Loading…
Reference in a new issue