rustc: Implement explicit self for Eq and Ord. r=graydon
This commit is contained in:
parent
4101587a88
commit
318e534895
89 changed files with 4175 additions and 92 deletions
|
@ -71,21 +71,45 @@ impl PosixPath : ToStr {
|
|||
}
|
||||
|
||||
impl PosixPath : Eq {
|
||||
#[cfg(stage0)]
|
||||
pure fn eq(other: &PosixPath) -> bool {
|
||||
return self.is_absolute == (*other).is_absolute &&
|
||||
self.components == (*other).components;
|
||||
}
|
||||
#[cfg(stage1)]
|
||||
#[cfg(stage2)]
|
||||
pure fn eq(&self, other: &PosixPath) -> bool {
|
||||
return (*self).is_absolute == (*other).is_absolute &&
|
||||
(*self).components == (*other).components;
|
||||
}
|
||||
#[cfg(stage0)]
|
||||
pure fn ne(other: &PosixPath) -> bool { !self.eq(other) }
|
||||
#[cfg(stage1)]
|
||||
#[cfg(stage2)]
|
||||
pure fn ne(&self, other: &PosixPath) -> bool { !(*self).eq(other) }
|
||||
}
|
||||
|
||||
impl WindowsPath : Eq {
|
||||
#[cfg(stage0)]
|
||||
pure fn eq(other: &WindowsPath) -> bool {
|
||||
return self.host == (*other).host &&
|
||||
self.device == (*other).device &&
|
||||
self.is_absolute == (*other).is_absolute &&
|
||||
self.components == (*other).components;
|
||||
}
|
||||
#[cfg(stage1)]
|
||||
#[cfg(stage2)]
|
||||
pure fn eq(&self, other: &WindowsPath) -> bool {
|
||||
return (*self).host == (*other).host &&
|
||||
(*self).device == (*other).device &&
|
||||
(*self).is_absolute == (*other).is_absolute &&
|
||||
(*self).components == (*other).components;
|
||||
}
|
||||
#[cfg(stage0)]
|
||||
pure fn ne(other: &WindowsPath) -> bool { !self.eq(other) }
|
||||
#[cfg(stage1)]
|
||||
#[cfg(stage2)]
|
||||
pure fn ne(&self, other: &WindowsPath) -> bool { !(*self).eq(other) }
|
||||
}
|
||||
|
||||
// FIXME (#3227): when default methods in traits are working, de-duplicate
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue