From 31ada5a052c79e16c7ad53ef030962e5f63a45d5 Mon Sep 17 00:00:00 2001 From: YVT Date: Fri, 9 Aug 2019 09:13:14 +0900 Subject: [PATCH] macOS/iOS: Fix auto trait impls of `EventLoopProxy` (#1084) * macOS/iOS: Fix auto trait impls of `EventLoopProxy` `EventLoopProxy` allows sending `T` from an arbitrary thread that owns the proxy object. Thus, if `T` is `!Send`, `EventLoopProxy` must not be allowed to leave the main thread. `EventLoopProxy` uses `std::sync::mpsc::Sender` under the hood, meaning the `!Sync` restriction of it also applies to `EventLoopProxy`. That is, even if `T` is thread-safe, a single `EventLoopProxy` object cannot be shared between threads. * Update `CHANGELOG.md` --- CHANGELOG.md | 3 ++- src/platform_impl/ios/event_loop.rs | 3 +-- src/platform_impl/macos/event_loop.rs | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f15ae5a..4352b252 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,8 @@ - On Linux, the functions `is_wayland`, `is_x11`, `xlib_xconnection` and `wayland_display` have been moved to a new `EventLoopWindowTargetExtUnix` trait. - On iOS, add `set_prefers_status_bar_hidden` extension function instead of hijacking `set_decorations` for this purpose. - +- On macOS and iOS, corrected the auto trait impls of `EventLoopProxy`. + # 0.20.0 Alpha 2 (2019-07-09) - On X11, non-resizable windows now have maximize explicitly disabled. diff --git a/src/platform_impl/ios/event_loop.rs b/src/platform_impl/ios/event_loop.rs index adbdd7c3..956b910a 100644 --- a/src/platform_impl/ios/event_loop.rs +++ b/src/platform_impl/ios/event_loop.rs @@ -142,8 +142,7 @@ pub struct EventLoopProxy { source: CFRunLoopSourceRef, } -unsafe impl Send for EventLoopProxy {} -unsafe impl Sync for EventLoopProxy {} +unsafe impl Send for EventLoopProxy {} impl Clone for EventLoopProxy { fn clone(&self) -> EventLoopProxy { diff --git a/src/platform_impl/macos/event_loop.rs b/src/platform_impl/macos/event_loop.rs index 32d8739c..b5fea9d1 100644 --- a/src/platform_impl/macos/event_loop.rs +++ b/src/platform_impl/macos/event_loop.rs @@ -113,8 +113,7 @@ pub struct Proxy { source: CFRunLoopSourceRef, } -unsafe impl Send for Proxy {} -unsafe impl Sync for Proxy {} +unsafe impl Send for Proxy {} impl Clone for Proxy { fn clone(&self) -> Self {