rustc: Use coherence for operator overloading.
The only use of the old-style impls is now placement new.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user