We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6296dc0 commit a591273Copy full SHA for a591273
src/libstd/nil.rs
@@ -16,6 +16,10 @@ Functions for the unit type.
16
17
#[cfg(not(test))]
18
use prelude::*;
19
+#[cfg(not(test))]
20
+use num::Zero;
21
+
22
23
24
25
impl Eq for () {
@@ -48,3 +52,10 @@ impl TotalEq for () {
48
52
#[inline]
49
53
fn equals(&self, _other: &()) -> bool { true }
50
54
}
55
56
57
+impl Zero for () {
58
+ fn zero() -> () { () }
59
+ fn is_zero(&self) -> bool { true }
60
+}
61
src/test/run-pass/deriving-zero.rs
@@ -34,6 +34,7 @@ struct Lots {
34
h: ~[util::NonCopyable],
35
i: @mut (int, int),
36
j: bool,
37
+ k: (),
38
39
40
fn main() {
0 commit comments