12
12
//! of any type.
13
13
14
14
use cast:: transmute;
15
+ #[ cfg( stage0) ]
15
16
use cmp:: Eq ;
16
17
use option:: { Option , Some , None } ;
18
+ #[ cfg( stage0) ]
17
19
use to_bytes:: { IterBytes , Cb } ;
18
20
use to_str:: ToStr ;
19
21
use unstable:: intrinsics;
20
22
use util:: Void ;
23
+ #[ cfg( not( stage0) ) ]
24
+ use unstable:: intrinsics:: TypeId ;
21
25
22
26
///////////////////////////////////////////////////////////////////////////////
23
27
// TypeId
24
28
///////////////////////////////////////////////////////////////////////////////
25
29
26
30
/// `TypeId` represents a globally unique identifier for a type
31
+ #[ cfg( stage0) ]
27
32
pub struct TypeId {
28
33
priv t: u64 ,
29
34
}
30
35
36
+ #[ cfg( stage0) ]
31
37
impl TypeId {
32
38
/// Returns the `TypeId` of the type this generic function has been instantiated with
33
39
#[ inline]
@@ -36,13 +42,15 @@ impl TypeId {
36
42
}
37
43
}
38
44
45
+ #[ cfg( stage0) ]
39
46
impl Eq for TypeId {
40
47
#[ inline]
41
48
fn eq ( & self , & other: & TypeId ) -> bool {
42
49
self . t == other. t
43
50
}
44
51
}
45
52
53
+ #[ cfg( stage0) ]
46
54
impl IterBytes for TypeId {
47
55
fn iter_bytes ( & self , lsb0 : bool , f : Cb ) -> bool {
48
56
self . t . iter_bytes ( lsb0, f)
@@ -189,29 +197,6 @@ mod tests {
189
197
190
198
static TEST : & ' static str = "Test" ;
191
199
192
- #[ test]
193
- fn type_id ( ) {
194
- let ( a, b, c) = ( TypeId :: of :: < uint > ( ) , TypeId :: of :: < & ' static str > ( ) ,
195
- TypeId :: of :: < Test > ( ) ) ;
196
- let ( d, e, f) = ( TypeId :: of :: < uint > ( ) , TypeId :: of :: < & ' static str > ( ) ,
197
- TypeId :: of :: < Test > ( ) ) ;
198
-
199
- assert ! ( a != b) ;
200
- assert ! ( a != c) ;
201
- assert ! ( b != c) ;
202
-
203
- assert_eq ! ( a, d) ;
204
- assert_eq ! ( b, e) ;
205
- assert_eq ! ( c, f) ;
206
- }
207
-
208
- #[ test]
209
- fn type_id_hash ( ) {
210
- let ( a, b) = ( TypeId :: of :: < uint > ( ) , TypeId :: of :: < uint > ( ) ) ;
211
-
212
- assert_eq ! ( a. hash( ) , b. hash( ) ) ;
213
- }
214
-
215
200
#[ test]
216
201
fn any_as_void_ptr ( ) {
217
202
let ( a, b, c) = ( ~5 u as ~Any , ~TEST as ~Any , ~Test as ~Any ) ;
0 commit comments