summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2012-07-27 19:32:42 -0700
committerPatrick Walton <pcwalton@mimiga.net>2012-07-27 19:35:24 -0700
commit93c2f5e0e43532a2288ed6dec378564264d1a77c (patch)
tree2d8d3f5d4667f7a009fa338bc34076216873b35c /src/libcore
parente6d2e49852873c52b872185a0ae5a8ca941ed2f1 (diff)
downloadrust-93c2f5e0e43532a2288ed6dec378564264d1a77c.tar.gz
rust-93c2f5e0e43532a2288ed6dec378564264d1a77c.zip
rustc: Use coherence for operator overloading.
The only use of the old-style impls is now placement new.
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/core.rs3
-rw-r--r--src/libcore/ops.rs50
2 files changed, 43 insertions, 10 deletions
diff --git a/src/libcore/core.rs b/src/libcore/core.rs
index fdf53524188..cd7252be9ec 100644
--- a/src/libcore/core.rs
+++ b/src/libcore/core.rs
@@ -31,7 +31,8 @@ import f32::num;
 import f64::num;
 import num::num;
 import ops::{const, copy, send, owned};
-import ops::{add, sub, mul, div, modulo, neg, bitops, index};
+import ops::{add, sub, mul, div, modulo, neg, bitand, bitor, bitxor, shl};
+import ops::{shr, index};
 
 export path, option, some, none, unreachable;
 export extensions;
diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs
index 61efe704974..2a05aeb72c2 100644
--- a/src/libcore/ops.rs
+++ b/src/libcore/ops.rs
@@ -1,64 +1,96 @@
 // Core operators and kinds.
 
+#[cfg(notest)]
 #[lang="const"]
 trait const {
     // Empty.
 }
 
+#[cfg(notest)]
 #[lang="copy"]
 trait copy {
     // Empty.
 }
 
+#[cfg(notest)]
 #[lang="send"]
 trait send {
     // Empty.
 }
 
+#[cfg(notest)]
 #[lang="owned"]
 trait owned {
     // Empty.
 }
 
+#[cfg(notest)]
 #[lang="add"]
 trait add<RHS,Result> {
     pure fn add(rhs: RHS) -> Result;
 }
 
+#[cfg(notest)]
 #[lang="sub"]
 trait sub<RHS,Result> {
     pure fn sub(rhs: RHS) -> Result;
 }
 
+#[cfg(notest)]
 #[lang="mul"]
 trait mul<RHS,Result> {
     pure fn mul(rhs: RHS) -> Result;
 }
 
+#[cfg(notest)]
 #[lang="div"]
 trait div<RHS,Result> {
     pure fn div(rhs: RHS) -> Result;
 }
 
+#[cfg(notest)]
 #[lang="modulo"]
 trait modulo<RHS,Result> {
     pure fn modulo(rhs: RHS) -> Result;
 }
 
+#[cfg(notest)]
 #[lang="neg"]
-trait neg<RHS,Result> {
-    pure fn neg(rhs: RHS) -> Result;
+trait neg<Result> {
+    pure fn neg() -> Result;
 }
 
-#[lang="bitops"]
-trait bitops<RHS,BitCount,Result> {
-    pure fn and(rhs: RHS) -> Result;
-    pure fn or(rhs: RHS) -> Result;
-    pure fn xor(rhs: RHS) -> Result;
-    pure fn shl(n: BitCount) -> Result;
-    pure fn shr(n: BitCount) -> Result;
+#[cfg(notest)]
+#[lang="bitand"]
+trait bitand<RHS,Result> {
+    pure fn bitand(rhs: RHS) -> Result;
 }
 
+#[cfg(notest)]
+#[lang="bitor"]
+trait bitor<RHS,Result> {
+    pure fn bitor(rhs: RHS) -> Result;
+}
+
+#[cfg(notest)]
+#[lang="bitxor"]
+trait bitxor<RHS,Result> {
+    pure fn bitxor(rhs: RHS) -> Result;
+}
+
+#[cfg(notest)]
+#[lang="shl"]
+trait shl<RHS,Result> {
+    pure fn shl(rhs: RHS) -> Result;
+}
+
+#[cfg(notest)]
+#[lang="shr"]
+trait shr<RHS,Result> {
+    pure fn shr(rhs: RHS) -> Result;
+}
+
+#[cfg(notest)]
 #[lang="index"]
 trait index<Index,Result> {
     pure fn index(index: Index) -> Result;