]> git.lizzy.rs Git - rust.git/blob - src/libstd/owned.rs
Ignore tests broken by failing on ICE
[rust.git] / src / libstd / owned.rs
1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 //! Operations on unique pointer types
12
13 #[cfg(not(test))] use cmp::*;
14
15 /// A value that represents the global exchange heap. This is the default
16 /// place that the `box` keyword allocates into when no place is supplied.
17 ///
18 /// The following two examples are equivalent:
19 ///
20 ///     let foo = box(HEAP) Bar::new(...);
21 ///     let foo = box Bar::new(...);
22 #[lang="exchange_heap"]
23 #[cfg(not(test))]
24 pub static HEAP: () = ();
25
26 #[cfg(test)]
27 pub static HEAP: () = ();
28
29 /// A type that represents a uniquely-owned value.
30 #[lang="owned_box"]
31 #[cfg(not(test))]
32 pub struct Box<T>(*T);
33
34 #[cfg(test)]
35 pub struct Box<T>(*T);
36
37 #[cfg(not(test))]
38 impl<T:Eq> Eq for ~T {
39     #[inline]
40     fn eq(&self, other: &~T) -> bool { *(*self) == *(*other) }
41     #[inline]
42     fn ne(&self, other: &~T) -> bool { *(*self) != *(*other) }
43 }
44
45 #[cfg(not(test))]
46 impl<T:Ord> Ord for ~T {
47     #[inline]
48     fn lt(&self, other: &~T) -> bool { *(*self) < *(*other) }
49     #[inline]
50     fn le(&self, other: &~T) -> bool { *(*self) <= *(*other) }
51     #[inline]
52     fn ge(&self, other: &~T) -> bool { *(*self) >= *(*other) }
53     #[inline]
54     fn gt(&self, other: &~T) -> bool { *(*self) > *(*other) }
55 }
56
57 #[cfg(not(test))]
58 impl<T: TotalOrd> TotalOrd for ~T {
59     #[inline]
60     fn cmp(&self, other: &~T) -> Ordering { (**self).cmp(*other) }
61 }
62
63 #[cfg(not(test))]
64 impl<T: TotalEq> TotalEq for ~T {}