diff options
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/common/thread_info.rs | 4 | ||||
| -rw-r--r-- | src/libstd/sys/windows/os.rs | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/libstd/sys/common/thread_info.rs b/src/libstd/sys/common/thread_info.rs index dc21feb17a8..8c76eb1504d 100644 --- a/src/libstd/sys/common/thread_info.rs +++ b/src/libstd/sys/common/thread_info.rs @@ -26,13 +26,13 @@ struct ThreadInfo { thread_local! { static THREAD_INFO: RefCell<Option<ThreadInfo>> = RefCell::new(None) } impl ThreadInfo { - fn with<R>(f: |&mut ThreadInfo| -> R) -> R { + fn with<R, F>(f: F) -> R where F: FnOnce(&mut ThreadInfo) -> R { if THREAD_INFO.destroyed() { panic!("Use of std::thread::Thread::current() is not possible after \ the thread's local data has been destroyed"); } - THREAD_INFO.with(|c| { + THREAD_INFO.with(move |c| { if c.borrow().is_none() { *c.borrow_mut() = Some(ThreadInfo { stack_bounds: (0, 0), diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs index e7194df7ac3..0f26e36a80f 100644 --- a/src/libstd/sys/windows/os.rs +++ b/src/libstd/sys/windows/os.rs @@ -124,7 +124,9 @@ pub unsafe fn pipe() -> IoResult<(FileDesc, FileDesc)> { } } -pub fn fill_utf16_buf_and_decode(f: |*mut u16, DWORD| -> DWORD) -> Option<String> { +pub fn fill_utf16_buf_and_decode<F>(mut f: F) -> Option<String> where + F: FnMut(*mut u16, DWORD) -> DWORD, +{ unsafe { let mut n = TMPBUF_SZ as DWORD; let mut res = None; |
