]> git.lizzy.rs Git - rust.git/commitdiff
Allow multiple `num` impls to be imported at once
authorBen Striegel <ben.striegel@gmail.com>
Sat, 9 Jun 2012 05:36:26 +0000 (01:36 -0400)
committerBen Striegel <ben.striegel@gmail.com>
Sat, 9 Jun 2012 05:36:26 +0000 (01:36 -0400)
If we import num::num, it gets reexported implicitly and causes collisions if
you try to import (for example) int::num and i8::num at the same time.

src/libcore/int-template.rs
src/libcore/uint-template.rs

index 2ea166cfc36896ae8519066706d607297ddc56af..cfe6169760868478abef058a61140cfa81865290 100644 (file)
@@ -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 @@ fn eq(&&other: T) -> bool {
     }
 }
 
-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);
index 8a79270361d76ecc61f96a347e8b06da2ace56f2..cb9b759eeaed12d40d8e6cc8e5abfcd52ded0e56 100644 (file)
@@ -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 @@ fn eq(&&other: T) -> bool {
     }
 }
 
-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; }