diff --git a/src/libcore/tests/hash/sip.rs b/src/libcore/tests/hash/sip.rs index 4a9657e0340..c6dd41798f2 100644 --- a/src/libcore/tests/hash/sip.rs +++ b/src/libcore/tests/hash/sip.rs @@ -243,24 +243,22 @@ fn test_siphash_2_4() { t += 1; } } -#[test] #[cfg(target_arch = "arm")] + +#[test] +#[cfg(target_pointer_width = "32")] fn test_hash_usize() { let val = 0xdeadbeef_deadbeef_u64; assert!(hash(&(val as u64)) != hash(&(val as usize))); assert_eq!(hash(&(val as u32)), hash(&(val as usize))); } -#[test] #[cfg(target_arch = "x86_64")] + +#[test] +#[cfg(target_pointer_width = "64")] fn test_hash_usize() { let val = 0xdeadbeef_deadbeef_u64; assert_eq!(hash(&(val as u64)), hash(&(val as usize))); assert!(hash(&(val as u32)) != hash(&(val as usize))); } -#[test] #[cfg(target_arch = "x86")] -fn test_hash_usize() { - let val = 0xdeadbeef_deadbeef_u64; - assert!(hash(&(val as u64)) != hash(&(val as usize))); - assert_eq!(hash(&(val as u32)), hash(&(val as usize))); -} #[test] fn test_hash_idempotent() { diff --git a/src/liblibc b/src/liblibc index 44e4018e1a3..7e33065ce49 160000 --- a/src/liblibc +++ b/src/liblibc @@ -1 +1 @@ -Subproject commit 44e4018e1a37716286ec98cb5b7dd7d33ecaf940 +Subproject commit 7e33065ce49759958c0d1c04fcadef961032a943 diff --git a/src/libstd/sys/unix/condvar.rs b/src/libstd/sys/unix/condvar.rs index 89a44b97657..4f878d8ad1f 100644 --- a/src/libstd/sys/unix/condvar.rs +++ b/src/libstd/sys/unix/condvar.rs @@ -92,14 +92,15 @@ impl Condvar { assert_eq!(r, 0); // Nanosecond calculations can't overflow because both values are below 1e9. - let nsec = dur.subsec_nanos() as libc::c_long + now.tv_nsec as libc::c_long; + let nsec = dur.subsec_nanos() + now.tv_nsec as u32; + let sec = saturating_cast_to_time_t(dur.as_secs()) .checked_add((nsec / 1_000_000_000) as libc::time_t) .and_then(|s| s.checked_add(now.tv_sec)); let nsec = nsec % 1_000_000_000; let timeout = sec.map(|s| { - libc::timespec { tv_sec: s, tv_nsec: nsec } + libc::timespec { tv_sec: s, tv_nsec: nsec as _} }).unwrap_or(TIMESPEC_MAX); let r = libc::pthread_cond_timedwait(self.inner.get(), mutex::raw(mutex), diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index c4616c3b395..a1ca839dc18 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -132,14 +132,14 @@ impl FileAttr { pub fn modified(&self) -> io::Result { Ok(SystemTime::from(libc::timespec { tv_sec: self.stat.st_mtime as libc::time_t, - tv_nsec: self.stat.st_mtime_nsec as libc::c_long, + tv_nsec: self.stat.st_mtime_nsec as _, })) } pub fn accessed(&self) -> io::Result { Ok(SystemTime::from(libc::timespec { tv_sec: self.stat.st_atime as libc::time_t, - tv_nsec: self.stat.st_atime_nsec as libc::c_long, + tv_nsec: self.stat.st_atime_nsec as _, })) } diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index 6c4a3324296..cc889454ce9 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -149,7 +149,7 @@ impl Thread { pub fn sleep(dur: Duration) { let mut secs = dur.as_secs(); - let mut nsecs = dur.subsec_nanos() as libc::c_long; + let mut nsecs = dur.subsec_nanos() as _; // If we're awoken with a signal then the return value will be -1 and // nanosleep will fill in `ts` with the remaining time. diff --git a/src/libstd/sys/unix/time.rs b/src/libstd/sys/unix/time.rs index c1bea95ce91..837cd7292e2 100644 --- a/src/libstd/sys/unix/time.rs +++ b/src/libstd/sys/unix/time.rs @@ -60,7 +60,7 @@ impl Timespec { Timespec { t: libc::timespec { tv_sec: secs, - tv_nsec: nsec as libc::c_long, + tv_nsec: nsec as _, }, } } @@ -83,7 +83,7 @@ impl Timespec { Timespec { t: libc::timespec { tv_sec: secs, - tv_nsec: nsec as libc::c_long, + tv_nsec: nsec as _, }, } } diff --git a/src/test/codegen/issue-37945.rs b/src/test/codegen/issue-37945.rs index e7c91f30918..df02426badc 100644 --- a/src/test/codegen/issue-37945.rs +++ b/src/test/codegen/issue-37945.rs @@ -13,6 +13,7 @@ // ignore-x86 // ignore-arm // ignore-emscripten +// ignore-gnux32 // ignore 32-bit platforms (LLVM has a bug with them) // See issue #37945. diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs index 85fa38bbd3b..bd4044b4df3 100644 --- a/src/tools/compiletest/src/util.rs +++ b/src/tools/compiletest/src/util.rs @@ -73,7 +73,7 @@ pub fn get_env(triple: &str) -> Option<&str> { } pub fn get_pointer_width(triple: &str) -> &'static str { - if triple.contains("64") || triple.starts_with("s390x") { + if (triple.contains("64") && !triple.ends_with("gnux32")) || triple.starts_with("s390x") { "64bit" } else { "32bit"