Skip to content

Commit

Permalink
invariance is maintained by top-level EventLoopWindowTarget<T>
Browse files Browse the repository at this point in the history
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<T>` here.
  • Loading branch information
nerditation authored and madsmtm committed Dec 23, 2023
1 parent fa99990 commit dac99dd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub struct EventLoop<T: 'static> {
/// `&EventLoop`.
pub struct EventLoopWindowTarget<T: 'static> {
pub(crate) p: platform_impl::EventLoopWindowTarget<T>,
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.
Expand Down
5 changes: 1 addition & 4 deletions src/platform_impl/windows/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,7 @@ pub struct EventLoopWindowTarget<T: 'static> {
thread_id: u32,
thread_msg_target: HWND,
pub(crate) runner_shared: EventLoopRunnerShared<UserEventPlaceholder>,
// 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<T>,
}

impl<T: 'static> EventLoop<T> {
Expand Down

0 comments on commit dac99dd

Please sign in to comment.