librustc: convert TypeContents binops to by value

This commit is contained in:
Jorge Aparicio 2014-12-01 16:34:57 -05:00
parent c4fa2a37ae
commit eb71976137

View File

@ -2859,24 +2859,51 @@ impl TypeContents {
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl ops::BitOr<TypeContents,TypeContents> for TypeContents {
fn bitor(&self, other: &TypeContents) -> TypeContents {
TypeContents {bits: self.bits | other.bits}
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl ops::BitOr<TypeContents,TypeContents> for TypeContents {
fn bitor(self, other: TypeContents) -> TypeContents {
TypeContents {bits: self.bits | other.bits}
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl ops::BitAnd<TypeContents,TypeContents> for TypeContents {
fn bitand(&self, other: &TypeContents) -> TypeContents {
TypeContents {bits: self.bits & other.bits}
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl ops::BitAnd<TypeContents, TypeContents> for TypeContents {
fn bitand(self, other: TypeContents) -> TypeContents {
TypeContents {bits: self.bits & other.bits}
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl ops::Sub<TypeContents,TypeContents> for TypeContents {
fn sub(&self, other: &TypeContents) -> TypeContents {
TypeContents {bits: self.bits & !other.bits}
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl ops::Sub<TypeContents, TypeContents> for TypeContents {
fn sub(self, other: TypeContents) -> TypeContents {
TypeContents {bits: self.bits & !other.bits}
}
}
impl fmt::Show for TypeContents {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "TypeContents({:b})", self.bits)