diff options
| author | bors <bors@rust-lang.org> | 2015-03-25 01:42:42 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-03-25 01:42:42 +0000 |
| commit | 593db005d4dbce2ff72009c1ba03477b031b2c0f (patch) | |
| tree | b585f5625dde7ab0af35fb3dd41a67ba0507f525 /src/libstd/sys | |
| parent | 123a754cb8356d0e78837dd4e58103ad801309ff (diff) | |
| parent | 3021d4c56422e15331e38f4b7b04c7229e024fda (diff) | |
| download | rust-593db005d4dbce2ff72009c1ba03477b031b2c0f.tar.gz rust-593db005d4dbce2ff72009c1ba03477b031b2c0f.zip | |
Auto merge of #23681 - alexcrichton:rollup, r=alexcrichton
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/common/helper_thread.rs | 4 | ||||
| -rw-r--r-- | src/libstd/sys/windows/net.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/windows/os.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/windows/thread_local.rs | 8 |
4 files changed, 10 insertions, 6 deletions
diff --git a/src/libstd/sys/common/helper_thread.rs b/src/libstd/sys/common/helper_thread.rs index 2a852fbcd57..10077dfd1b8 100644 --- a/src/libstd/sys/common/helper_thread.rs +++ b/src/libstd/sys/common/helper_thread.rs @@ -38,7 +38,7 @@ use thread; /// /// The fields of this helper are all public, but they should not be used, this /// is for static initialization. -pub struct Helper<M> { +pub struct Helper<M:Send> { /// Internal lock which protects the remaining fields pub lock: StaticMutex, pub cond: StaticCondvar, @@ -112,7 +112,7 @@ impl<M: Send> Helper<M> { self.cond.notify_one() }); - rt::at_exit(move || { self.shutdown() }); + let _ = rt::at_exit(move || { self.shutdown() }); *self.initialized.get() = true; } else if *self.chan.get() as uint == 1 { panic!("cannot continue usage after shutdown"); diff --git a/src/libstd/sys/windows/net.rs b/src/libstd/sys/windows/net.rs index e092faf4935..734268c70ac 100644 --- a/src/libstd/sys/windows/net.rs +++ b/src/libstd/sys/windows/net.rs @@ -36,7 +36,7 @@ pub fn init() { &mut data); assert_eq!(ret, 0); - rt::at_exit(|| { c::WSACleanup(); }) + let _ = rt::at_exit(|| { c::WSACleanup(); }); }); } diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs index 83d06371734..167db1e8ac2 100644 --- a/src/libstd/sys/windows/os.rs +++ b/src/libstd/sys/windows/os.rs @@ -109,7 +109,7 @@ impl Iterator for Env { if *self.cur == 0 { return None } let p = &*self.cur; let mut len = 0; - while *(p as *const _).offset(len) != 0 { + while *(p as *const u16).offset(len) != 0 { len += 1; } let p = p as *const u16; diff --git a/src/libstd/sys/windows/thread_local.rs b/src/libstd/sys/windows/thread_local.rs index 1359803070a..c908c791247 100644 --- a/src/libstd/sys/windows/thread_local.rs +++ b/src/libstd/sys/windows/thread_local.rs @@ -133,9 +133,8 @@ unsafe fn init_dtors() { if !DTORS.is_null() { return } let dtors = box Vec::<(Key, Dtor)>::new(); - DTORS = boxed::into_raw(dtors); - rt::at_exit(move|| { + let res = rt::at_exit(move|| { DTOR_LOCK.lock(); let dtors = DTORS; DTORS = 1 as *mut _; @@ -143,6 +142,11 @@ unsafe fn init_dtors() { assert!(DTORS as uint == 1); // can't re-init after destructing DTOR_LOCK.unlock(); }); + if res.is_ok() { + DTORS = boxed::into_raw(dtors); + } else { + DTORS = 1 as *mut _; + } } unsafe fn register_dtor(key: Key, dtor: Dtor) { |
