1212//! of any type.
1313
1414use cast:: transmute;
15+ #[ cfg( stage0) ]
1516use cmp:: Eq ;
1617use option:: { Option , Some , None } ;
18+ #[ cfg( stage0) ]
1719use to_bytes:: { IterBytes , Cb } ;
1820use to_str:: ToStr ;
1921use unstable:: intrinsics;
2022use util:: Void ;
23+ #[ cfg( not( stage0) ) ]
24+ use unstable:: intrinsics:: TypeId ;
2125
2226///////////////////////////////////////////////////////////////////////////////
2327// TypeId
2428///////////////////////////////////////////////////////////////////////////////
2529
2630/// `TypeId` represents a globally unique identifier for a type
31+ #[ cfg( stage0) ]
2732pub struct TypeId {
2833 priv t: u64 ,
2934}
3035
36+ #[ cfg( stage0) ]
3137impl TypeId {
3238 /// Returns the `TypeId` of the type this generic function has been instantiated with
3339 #[ inline]
@@ -36,13 +42,15 @@ impl TypeId {
3642 }
3743}
3844
45+ #[ cfg( stage0) ]
3946impl Eq for TypeId {
4047 #[ inline]
4148 fn eq ( & self , & other: & TypeId ) -> bool {
4249 self . t == other. t
4350 }
4451}
4552
53+ #[ cfg( stage0) ]
4654impl IterBytes for TypeId {
4755 fn iter_bytes ( & self , lsb0 : bool , f : Cb ) -> bool {
4856 self . t . iter_bytes ( lsb0, f)
@@ -189,29 +197,6 @@ mod tests {
189197
190198 static TEST : & ' static str = "Test" ;
191199
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-
215200 #[ test]
216201 fn any_as_void_ptr ( ) {
217202 let ( a, b, c) = ( ~5 u as ~Any , ~TEST as ~Any , ~Test as ~Any ) ;
0 commit comments