about summary refs log tree commit diff
path: root/src/libstd/sys/windows
diff options
context:
space:
mode:
authorJoshua Sheard <mail@jsheard.com>2017-09-14 14:19:53 +0100
committerGitHub <noreply@github.com>2017-09-14 14:19:53 +0100
commit597ac36547f5b135d55bd4cf26964762c8c4796f (patch)
treed722ef4a71813b7182eb47f4584d9b35490b3476 /src/libstd/sys/windows
parent8e80cee144f1a75ab902c3b64e58979b140b9f52 (diff)
parent2b6bc588ca7197bc5d9f212e9e91a2c3811d025c (diff)
downloadrust-597ac36547f5b135d55bd4cf26964762c8c4796f.tar.gz
rust-597ac36547f5b135d55bd4cf26964762c8c4796f.zip
Merge branch 'master' into threadname
Diffstat (limited to 'src/libstd/sys/windows')
-rw-r--r--src/libstd/sys/windows/thread.rs2
-rw-r--r--src/libstd/sys/windows/time.rs9
2 files changed, 8 insertions, 3 deletions
diff --git a/src/libstd/sys/windows/thread.rs b/src/libstd/sys/windows/thread.rs
index 4043f6bc738..c47baaa2434 100644
--- a/src/libstd/sys/windows/thread.rs
+++ b/src/libstd/sys/windows/thread.rs
@@ -21,6 +21,8 @@ use time::Duration;
 
 use super::to_u16s;
 
+pub const DEFAULT_MIN_STACK_SIZE: usize = 2 * 1024 * 1024;
+
 pub struct Thread {
     handle: Handle
 }
diff --git a/src/libstd/sys/windows/time.rs b/src/libstd/sys/windows/time.rs
index ef8ed606526..1be29b5139a 100644
--- a/src/libstd/sys/windows/time.rs
+++ b/src/libstd/sys/windows/time.rs
@@ -16,6 +16,7 @@ use sys::c;
 use sys::cvt;
 use sys_common::mul_div_u64;
 use time::Duration;
+use convert::TryInto;
 
 const NANOS_PER_SEC: u64 = 1_000_000_000;
 const INTERVALS_PER_SEC: u64 = NANOS_PER_SEC / 100;
@@ -173,9 +174,11 @@ impl From<c::FILETIME> for SystemTime {
 }
 
 fn dur2intervals(d: &Duration) -> i64 {
-    d.as_secs().checked_mul(INTERVALS_PER_SEC).and_then(|i| {
-        i.checked_add(d.subsec_nanos() as u64 / 100)
-    }).expect("overflow when converting duration to intervals") as i64
+    d.as_secs()
+        .checked_mul(INTERVALS_PER_SEC)
+        .and_then(|i| i.checked_add(d.subsec_nanos() as u64 / 100))
+        .and_then(|i| i.try_into().ok())
+        .expect("overflow when converting duration to intervals")
 }
 
 fn intervals2dur(intervals: u64) -> Duration {