Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/libstd/nil.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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 }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these two functions be marked with #[inline]?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bstrie added in pull request #8404

}

1 change: 1 addition & 0 deletions src/test/run-pass/deriving-zero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct Lots {
h: ~[util::NonCopyable],
i: @mut (int, int),
j: bool,
k: (),
}

fn main() {
Expand Down