From e0dab5599eb408356d052a7b08664495d385f41d Mon Sep 17 00:00:00 2001 From: nerditation Date: Wed, 30 Aug 2023 09:07:01 +0800 Subject: [PATCH] invariance is maintained by top-level EventLoopWindowTarget this field is transitional and her to keep API compatibility only. the correct variance and such is already ensured by the top-level `EventLoopWindowTarget`, just use `PhantomData` here. --- src/event_loop.rs | 2 +- src/platform_impl/windows/event_loop.rs | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/event_loop.rs b/src/event_loop.rs index 6dfa96b1e1..b719e1d996 100644 --- a/src/event_loop.rs +++ b/src/event_loop.rs @@ -50,7 +50,7 @@ pub struct EventLoop { /// `&EventLoop`. pub struct EventLoopWindowTarget { pub(crate) p: platform_impl::EventLoopWindowTarget, - pub(crate) _marker: PhantomData<*mut ()>, // Not Send nor Sync + pub(crate) _marker: PhantomData<*mut T>, // Not Send nor Sync + invariant over T } /// Object that allows building the event loop. diff --git a/src/platform_impl/windows/event_loop.rs b/src/platform_impl/windows/event_loop.rs index f853bb7876..3f3344ef44 100644 --- a/src/platform_impl/windows/event_loop.rs +++ b/src/platform_impl/windows/event_loop.rs @@ -182,10 +182,7 @@ pub struct EventLoopWindowTarget { thread_id: u32, thread_msg_target: HWND, pub(crate) runner_shared: EventLoopRunnerShared, - // TODO - // eventually should be removed after all the backends refactored, - // but for now should this be invariant or contra-variant to T? - _marker: PhantomData<*mut T>, + _marker: PhantomData, } impl EventLoop {