File tree Expand file tree Collapse file tree 7 files changed +16
-16
lines changed Expand file tree Collapse file tree 7 files changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -243,24 +243,22 @@ fn test_siphash_2_4() {
243243 t += 1 ;
244244 }
245245}
246- #[ test] #[ cfg( target_arch = "arm" ) ]
246+
247+ #[ test]
248+ #[ cfg( target_pointer_width = "32" ) ]
247249fn test_hash_usize ( ) {
248250 let val = 0xdeadbeef_deadbeef_u64 ;
249251 assert ! ( hash( & ( val as u64 ) ) != hash( & ( val as usize ) ) ) ;
250252 assert_eq ! ( hash( & ( val as u32 ) ) , hash( & ( val as usize ) ) ) ;
251253}
252- #[ test] #[ cfg( target_arch = "x86_64" ) ]
254+
255+ #[ test]
256+ #[ cfg( target_pointer_width = "64" ) ]
253257fn test_hash_usize ( ) {
254258 let val = 0xdeadbeef_deadbeef_u64 ;
255259 assert_eq ! ( hash( & ( val as u64 ) ) , hash( & ( val as usize ) ) ) ;
256260 assert ! ( hash( & ( val as u32 ) ) != hash( & ( val as usize ) ) ) ;
257261}
258- #[ test] #[ cfg( target_arch = "x86" ) ]
259- fn test_hash_usize ( ) {
260- let val = 0xdeadbeef_deadbeef_u64 ;
261- assert ! ( hash( & ( val as u64 ) ) != hash( & ( val as usize ) ) ) ;
262- assert_eq ! ( hash( & ( val as u32 ) ) , hash( & ( val as usize ) ) ) ;
263- }
264262
265263#[ test]
266264fn test_hash_idempotent ( ) {
Original file line number Diff line number Diff line change @@ -92,14 +92,15 @@ impl Condvar {
9292 assert_eq ! ( r, 0 ) ;
9393
9494 // Nanosecond calculations can't overflow because both values are below 1e9.
95- let nsec = dur. subsec_nanos ( ) as libc:: c_long + now. tv_nsec as libc:: c_long ;
95+ let nsec = dur. subsec_nanos ( ) + now. tv_nsec as u32 ;
96+
9697 let sec = saturating_cast_to_time_t ( dur. as_secs ( ) )
9798 . checked_add ( ( nsec / 1_000_000_000 ) as libc:: time_t )
9899 . and_then ( |s| s. checked_add ( now. tv_sec ) ) ;
99100 let nsec = nsec % 1_000_000_000 ;
100101
101102 let timeout = sec. map ( |s| {
102- libc:: timespec { tv_sec : s, tv_nsec : nsec }
103+ libc:: timespec { tv_sec : s, tv_nsec : nsec as _ }
103104 } ) . unwrap_or ( TIMESPEC_MAX ) ;
104105
105106 let r = libc:: pthread_cond_timedwait ( self . inner . get ( ) , mutex:: raw ( mutex) ,
Original file line number Diff line number Diff line change @@ -132,14 +132,14 @@ impl FileAttr {
132132 pub fn modified ( & self ) -> io:: Result < SystemTime > {
133133 Ok ( SystemTime :: from ( libc:: timespec {
134134 tv_sec : self . stat . st_mtime as libc:: time_t ,
135- tv_nsec : self . stat . st_mtime_nsec as libc :: c_long ,
135+ tv_nsec : self . stat . st_mtime_nsec as _ ,
136136 } ) )
137137 }
138138
139139 pub fn accessed ( & self ) -> io:: Result < SystemTime > {
140140 Ok ( SystemTime :: from ( libc:: timespec {
141141 tv_sec : self . stat . st_atime as libc:: time_t ,
142- tv_nsec : self . stat . st_atime_nsec as libc :: c_long ,
142+ tv_nsec : self . stat . st_atime_nsec as _ ,
143143 } ) )
144144 }
145145
Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ impl Thread {
149149
150150 pub fn sleep ( dur : Duration ) {
151151 let mut secs = dur. as_secs ( ) ;
152- let mut nsecs = dur. subsec_nanos ( ) as libc :: c_long ;
152+ let mut nsecs = dur. subsec_nanos ( ) as _ ;
153153
154154 // If we're awoken with a signal then the return value will be -1 and
155155 // nanosleep will fill in `ts` with the remaining time.
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ impl Timespec {
6060 Timespec {
6161 t : libc:: timespec {
6262 tv_sec : secs,
63- tv_nsec : nsec as libc :: c_long ,
63+ tv_nsec : nsec as _ ,
6464 } ,
6565 }
6666 }
@@ -83,7 +83,7 @@ impl Timespec {
8383 Timespec {
8484 t : libc:: timespec {
8585 tv_sec : secs,
86- tv_nsec : nsec as libc :: c_long ,
86+ tv_nsec : nsec as _ ,
8787 } ,
8888 }
8989 }
Original file line number Diff line number Diff line change 1313// ignore-x86
1414// ignore-arm
1515// ignore-emscripten
16+ // ignore-gnux32
1617// ignore 32-bit platforms (LLVM has a bug with them)
1718
1819// See issue #37945.
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ pub fn get_env(triple: &str) -> Option<&str> {
7373}
7474
7575pub fn get_pointer_width ( triple : & str ) -> & ' static str {
76- if triple. contains ( "64" ) || triple. starts_with ( "s390x" ) {
76+ if ( triple. contains ( "64" ) && !triple . ends_with ( "gnux32" ) ) || triple. starts_with ( "s390x" ) {
7777 "64bit"
7878 } else {
7979 "32bit"
You can’t perform that action at this time.
0 commit comments