1+ //! Comprehensively checks the correctness and consistency of `std::any::TypeId::of`.
2+
13//@ run-pass
24
35#![ allow( deprecated) ]
4- //@ aux-build:typeid-intrinsic-aux1.rs
5- //@ aux-build:typeid-intrinsic-aux2.rs
6-
76#![ feature( core_intrinsics) ]
87
9- extern crate typeid_intrinsic_aux1 as other1;
10- extern crate typeid_intrinsic_aux2 as other2;
8+ //@ aux-build:typeid-consistency-comprehensive-aux1.rs
9+ //@ aux-build:typeid-consistency-comprehensive-aux2.rs
10+
11+ extern crate typeid_consistency_comprehensive_aux1 as other1;
12+ extern crate typeid_consistency_comprehensive_aux2 as other2;
1113
12- use std:: hash:: { SipHasher , Hasher , Hash } ;
1314use std:: any:: TypeId ;
15+ use std:: hash:: { Hash , Hasher , SipHasher } ;
1416
1517struct A ;
1618struct Test ;
@@ -35,6 +37,7 @@ pub fn main() {
3537 assert_eq ! ( TypeId :: of:: <other2:: G >( ) , other2:: id_G( ) ) ;
3638 assert_eq ! ( TypeId :: of:: <other2:: H >( ) , other2:: id_H( ) ) ;
3739 assert_eq ! ( TypeId :: of:: <other1:: I >( ) , other2:: id_I( ) ) ;
40+ //^ This line seems to be comparing other1::I with other2::id_I()
3841
3942 assert_eq ! ( other1:: id_F( ) , other2:: id_F( ) ) ;
4043 assert_eq ! ( other1:: id_G( ) , other2:: id_G( ) ) ;
@@ -49,10 +52,8 @@ pub fn main() {
4952 assert_eq ! ( other2:: foo:: <A >( ) , other1:: foo:: <A >( ) ) ;
5053
5154 // sanity test of TypeId
52- let ( a, b, c) = ( TypeId :: of :: < usize > ( ) , TypeId :: of :: < & ' static str > ( ) ,
53- TypeId :: of :: < Test > ( ) ) ;
54- let ( d, e, f) = ( TypeId :: of :: < usize > ( ) , TypeId :: of :: < & ' static str > ( ) ,
55- TypeId :: of :: < Test > ( ) ) ;
55+ let ( a, b, c) = ( TypeId :: of :: < usize > ( ) , TypeId :: of :: < & ' static str > ( ) , TypeId :: of :: < Test > ( ) ) ;
56+ let ( d, e, f) = ( TypeId :: of :: < usize > ( ) , TypeId :: of :: < & ' static str > ( ) , TypeId :: of :: < Test > ( ) ) ;
5657
5758 assert ! ( a != b) ;
5859 assert ! ( a != c) ;
@@ -82,10 +83,7 @@ pub fn main() {
8283 assert_ne ! ( TypeId :: of:: <other1:: I32Iterator >( ) , TypeId :: of:: <other1:: U32Iterator >( ) ) ;
8384
8485 // Check fn pointer against collisions
85- assert_ne ! (
86- TypeId :: of:: <fn ( fn ( A ) -> A ) -> A >( ) ,
87- TypeId :: of:: <fn ( fn ( ) -> A , A ) -> A >( )
88- ) ;
86+ assert_ne ! ( TypeId :: of:: <fn ( fn ( A ) -> A ) -> A >( ) , TypeId :: of:: <fn ( fn ( ) -> A , A ) -> A >( ) ) ;
8987 assert_ne ! (
9088 TypeId :: of:: <for <' a> fn ( & ' a i32 ) -> & ' a i32 >( ) ,
9189 TypeId :: of:: <for <' a> fn ( & ' a i32 ) -> & ' static i32 >( )
0 commit comments