Skip to content

Commit 9824d90

Browse files
committed
auto merge of #8155 : stepancheg/rust/unit-zero, r=alexcrichton
2 parents 5c6069c + a591273 commit 9824d90

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/libstd/nil.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Functions for the unit type.
1616

1717
#[cfg(not(test))]
1818
use prelude::*;
19+
#[cfg(not(test))]
20+
use num::Zero;
21+
22+
1923

2024
#[cfg(not(test))]
2125
impl Eq for () {
@@ -48,3 +52,10 @@ impl TotalEq for () {
4852
#[inline]
4953
fn equals(&self, _other: &()) -> bool { true }
5054
}
55+
56+
#[cfg(not(test))]
57+
impl Zero for () {
58+
fn zero() -> () { () }
59+
fn is_zero(&self) -> bool { true }
60+
}
61+

src/test/run-pass/deriving-zero.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ struct Lots {
3434
h: ~[util::NonCopyable],
3535
i: @mut (int, int),
3636
j: bool,
37+
k: (),
3738
}
3839

3940
fn main() {

0 commit comments

Comments
 (0)