Skip to content

Commit 1be86fc

Browse files
committed
---
yaml --- r: 114681 b: refs/heads/auto c: c5229e5 h: refs/heads/master i: 114679: b1d9365 v: v3
1 parent faefa74 commit 1be86fc

File tree

7 files changed

+77
-151
lines changed

7 files changed

+77
-151
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 5592a8f5db52a11b63547b661b3a635655b16980
16+
refs/heads/auto: c5229e5d2ea6168ec80a7feeea1a513b2b3176c0
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/libcore/cmp.rs

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,81 @@ pub fn max<T: TotalOrd>(v1: T, v2: T) -> T {
189189
if v1 > v2 { v1 } else { v2 }
190190
}
191191

192+
// Implementation of Eq/TotalEq for some primitive types
193+
#[cfg(not(test))]
194+
mod impls {
195+
use cmp::{Ord, TotalOrd, Eq, TotalEq, Ordering};
196+
197+
// & pointers
198+
impl<'a, T: Eq> Eq for &'a T {
199+
#[inline]
200+
fn eq(&self, other: & &'a T) -> bool { *(*self) == *(*other) }
201+
#[inline]
202+
fn ne(&self, other: & &'a T) -> bool { *(*self) != *(*other) }
203+
}
204+
impl<'a, T: Ord> Ord for &'a T {
205+
#[inline]
206+
fn lt(&self, other: & &'a T) -> bool { *(*self) < *(*other) }
207+
#[inline]
208+
fn le(&self, other: & &'a T) -> bool { *(*self) <= *(*other) }
209+
#[inline]
210+
fn ge(&self, other: & &'a T) -> bool { *(*self) >= *(*other) }
211+
#[inline]
212+
fn gt(&self, other: & &'a T) -> bool { *(*self) > *(*other) }
213+
}
214+
impl<'a, T: TotalOrd> TotalOrd for &'a T {
215+
#[inline]
216+
fn cmp(&self, other: & &'a T) -> Ordering { (**self).cmp(*other) }
217+
}
218+
impl<'a, T: TotalEq> TotalEq for &'a T {}
219+
220+
// @ pointers
221+
impl<T:Eq> Eq for @T {
222+
#[inline]
223+
fn eq(&self, other: &@T) -> bool { *(*self) == *(*other) }
224+
#[inline]
225+
fn ne(&self, other: &@T) -> bool { *(*self) != *(*other) }
226+
}
227+
impl<T:Ord> Ord for @T {
228+
#[inline]
229+
fn lt(&self, other: &@T) -> bool { *(*self) < *(*other) }
230+
#[inline]
231+
fn le(&self, other: &@T) -> bool { *(*self) <= *(*other) }
232+
#[inline]
233+
fn ge(&self, other: &@T) -> bool { *(*self) >= *(*other) }
234+
#[inline]
235+
fn gt(&self, other: &@T) -> bool { *(*self) > *(*other) }
236+
}
237+
impl<T: TotalOrd> TotalOrd for @T {
238+
#[inline]
239+
fn cmp(&self, other: &@T) -> Ordering { (**self).cmp(*other) }
240+
}
241+
impl<T: TotalEq> TotalEq for @T {}
242+
243+
// ~ pointers
244+
impl<T:Eq> Eq for ~T {
245+
#[inline]
246+
fn eq(&self, other: &~T) -> bool { *(*self) == *(*other) }
247+
#[inline]
248+
fn ne(&self, other: &~T) -> bool { *(*self) != *(*other) }
249+
}
250+
impl<T:Ord> Ord for ~T {
251+
#[inline]
252+
fn lt(&self, other: &~T) -> bool { *(*self) < *(*other) }
253+
#[inline]
254+
fn le(&self, other: &~T) -> bool { *(*self) <= *(*other) }
255+
#[inline]
256+
fn ge(&self, other: &~T) -> bool { *(*self) >= *(*other) }
257+
#[inline]
258+
fn gt(&self, other: &~T) -> bool { *(*self) > *(*other) }
259+
}
260+
impl<T: TotalOrd> TotalOrd for ~T {
261+
#[inline]
262+
fn cmp(&self, other: &~T) -> Ordering { (**self).cmp(*other) }
263+
}
264+
impl<T: TotalEq> TotalEq for ~T {}
265+
}
266+
192267
#[cfg(test)]
193268
mod test {
194269
use super::lexical_ordering;

branches/auto/src/libstd/gc.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ collector is task-local so `Gc<T>` is not sendable.
2020

2121
use kinds::marker;
2222
use clone::Clone;
23-
use managed;
2423

2524
/// Immutable garbage-collected pointer type
2625
#[lang="gc"]
@@ -55,7 +54,7 @@ impl<T: 'static> Gc<T> {
5554
/// Determine if two garbage-collected boxes point to the same object
5655
#[inline]
5756
pub fn ptr_eq(&self, other: &Gc<T>) -> bool {
58-
managed::ptr_eq(self.ptr, other.ptr)
57+
self.borrow() as *T == other.borrow() as *T
5958
}
6059
}
6160

branches/auto/src/libstd/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,6 @@ pub mod strbuf;
203203

204204
pub mod ascii;
205205

206-
mod managed;
207-
mod reference;
208206
pub mod rc;
209207
pub mod gc;
210208

branches/auto/src/libstd/managed.rs

Lines changed: 0 additions & 58 deletions
This file was deleted.

branches/auto/src/libstd/owned.rs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
//! Operations on unique pointer types
1212
13-
#[cfg(not(test))] use cmp::*;
14-
1513
/// A value that represents the global exchange heap. This is the default
1614
/// place that the `box` keyword allocates into when no place is supplied.
1715
///
@@ -33,32 +31,3 @@ pub struct Box<T>(*T);
3331

3432
#[cfg(test)]
3533
pub struct Box<T>(*T);
36-
37-
#[cfg(not(test))]
38-
impl<T:Eq> Eq for Box<T> {
39-
#[inline]
40-
fn eq(&self, other: &Box<T>) -> bool { *(*self) == *(*other) }
41-
#[inline]
42-
fn ne(&self, other: &Box<T>) -> bool { *(*self) != *(*other) }
43-
}
44-
45-
#[cfg(not(test))]
46-
impl<T:Ord> Ord for Box<T> {
47-
#[inline]
48-
fn lt(&self, other: &Box<T>) -> bool { *(*self) < *(*other) }
49-
#[inline]
50-
fn le(&self, other: &Box<T>) -> bool { *(*self) <= *(*other) }
51-
#[inline]
52-
fn ge(&self, other: &Box<T>) -> bool { *(*self) >= *(*other) }
53-
#[inline]
54-
fn gt(&self, other: &Box<T>) -> bool { *(*self) > *(*other) }
55-
}
56-
57-
#[cfg(not(test))]
58-
impl<T: TotalOrd> TotalOrd for Box<T> {
59-
#[inline]
60-
fn cmp(&self, other: &Box<T>) -> Ordering { (**self).cmp(*other) }
61-
}
62-
63-
#[cfg(not(test))]
64-
impl<T: TotalEq> TotalEq for Box<T> {}

branches/auto/src/libstd/reference.rs

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)