diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2012-11-14 18:59:30 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2012-11-19 15:33:11 -0800 |
| commit | 318e534895f20e7991abbc644eec311816010ef1 (patch) | |
| tree | 764ce1ae3e9efbecd4fdc057663beb522b10bda9 /src/libcore/uint-template.rs | |
| parent | 4101587a88d719659d2e30feaad8437c55af9150 (diff) | |
rustc: Implement explicit self for Eq and Ord. r=graydon
Diffstat (limited to 'src/libcore/uint-template.rs')
| -rw-r--r-- | src/libcore/uint-template.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/libcore/uint-template.rs b/src/libcore/uint-template.rs index d406e36cc07..4f84f9acb7e 100644 --- a/src/libcore/uint-template.rs +++ b/src/libcore/uint-template.rs @@ -49,15 +49,39 @@ pub pure fn compl(i: T) -> T { } impl T : Ord { + #[cfg(stage0)] pure fn lt(other: &T) -> bool { self < (*other) } + #[cfg(stage1)] + #[cfg(stage2)] + pure fn lt(&self, other: &T) -> bool { (*self) < (*other) } + #[cfg(stage0)] pure fn le(other: &T) -> bool { self <= (*other) } + #[cfg(stage1)] + #[cfg(stage2)] + pure fn le(&self, other: &T) -> bool { (*self) <= (*other) } + #[cfg(stage0)] pure fn ge(other: &T) -> bool { self >= (*other) } + #[cfg(stage1)] + #[cfg(stage2)] + pure fn ge(&self, other: &T) -> bool { (*self) >= (*other) } + #[cfg(stage0)] pure fn gt(other: &T) -> bool { self > (*other) } + #[cfg(stage1)] + #[cfg(stage2)] + pure fn gt(&self, other: &T) -> bool { (*self) > (*other) } } impl T : Eq { + #[cfg(stage0)] pure fn eq(other: &T) -> bool { return self == (*other); } + #[cfg(stage1)] + #[cfg(stage2)] + pure fn eq(&self, other: &T) -> bool { return (*self) == (*other); } + #[cfg(stage0)] pure fn ne(other: &T) -> bool { return self != (*other); } + #[cfg(stage1)] + #[cfg(stage2)] + pure fn ne(&self, other: &T) -> bool { return (*self) != (*other); } } impl T: num::Num { |
