Implement Zero for unit

This commit is contained in:
Stepan Koltsov 2013-07-31 18:19:26 +04:00
parent 6296dc0d73
commit a5912736be
2 changed files with 12 additions and 0 deletions

View file

@ -16,6 +16,10 @@ Functions for the unit type.
#[cfg(not(test))]
use prelude::*;
#[cfg(not(test))]
use num::Zero;
#[cfg(not(test))]
impl Eq for () {
@ -48,3 +52,10 @@ impl TotalEq for () {
#[inline]
fn equals(&self, _other: &()) -> bool { true }
}
#[cfg(not(test))]
impl Zero for () {
fn zero() -> () { () }
fn is_zero(&self) -> bool { true }
}

View file

@ -34,6 +34,7 @@ struct Lots {
h: ~[util::NonCopyable],
i: @mut (int, int),
j: bool,
k: (),
}
fn main() {