From dc81cbdcb14bfaed773f0cd32f050caa108938e2 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Thu, 1 Oct 2020 01:12:08 +0200 Subject: [PATCH] No longer put windows mutexes in a box. Windows SRW locks are movable (while not borrowed) according to their documentation. --- library/std/src/sys/windows/mutex.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/std/src/sys/windows/mutex.rs b/library/std/src/sys/windows/mutex.rs index fb6bb9583e2..fa51b006c34 100644 --- a/library/std/src/sys/windows/mutex.rs +++ b/library/std/src/sys/windows/mutex.rs @@ -29,7 +29,10 @@ pub struct Mutex { lock: AtomicUsize, } -pub type MovableMutex = Box; +// Windows SRW Locks are movable (while not borrowed). +// ReentrantMutexes (in Inner) are not, but those are stored indirectly through +// a Box, so do not move when the Mutex it self is moved. +pub type MovableMutex = Mutex; unsafe impl Send for Mutex {} unsafe impl Sync for Mutex {}