Skip to content

Commit 191fffe

Browse files
committed
Breaking: Make WebWindowHandle and Win32WindowHandle !Send and !Sync
1 parent 83e5785 commit 191fffe

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,9 @@ mod tests {
463463
assert_not_impl_any!(WaylandWindowHandle: Send, Sync);
464464
assert_impl_all!(DrmWindowHandle: Send, Sync);
465465
assert_not_impl_any!(GbmWindowHandle: Send, Sync);
466-
assert_impl_all!(Win32WindowHandle: Send, Sync);
466+
assert_not_impl_any!(Win32WindowHandle: Send, Sync);
467467
assert_not_impl_any!(WinRtWindowHandle: Send, Sync);
468-
assert_impl_all!(WebWindowHandle: Send, Sync);
468+
assert_not_impl_any!(WebWindowHandle: Send, Sync);
469469
assert_not_impl_any!(WebCanvasWindowHandle: Send, Sync);
470470
assert_not_impl_any!(WebOffscreenCanvasWindowHandle: Send, Sync);
471471
assert_not_impl_any!(AndroidNdkWindowHandle: Send, Sync);

src/web.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use core::ffi::c_void;
2+
use core::marker::PhantomData;
23
use core::ptr::NonNull;
34

45
use super::DisplayHandle;
@@ -55,6 +56,7 @@ pub struct WebWindowHandle {
5556
///
5657
/// [data attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-*
5758
pub id: u32,
59+
_marker: PhantomData<*const ()>,
5860
}
5961

6062
impl WebWindowHandle {
@@ -70,7 +72,10 @@ impl WebWindowHandle {
7072
/// let handle = WebWindowHandle::new(id);
7173
/// ```
7274
pub fn new(id: u32) -> Self {
73-
Self { id }
75+
Self {
76+
id,
77+
_marker: PhantomData,
78+
}
7479
}
7580
}
7681

src/windows.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use core::ffi::c_void;
2+
use core::marker::PhantomData;
23
use core::num::NonZeroIsize;
34
use core::ptr::NonNull;
45

@@ -54,6 +55,7 @@ pub struct Win32WindowHandle {
5455
pub hwnd: NonZeroIsize,
5556
/// The `GWLP_HINSTANCE` associated with this type's `HWND`.
5657
pub hinstance: Option<NonZeroIsize>,
58+
_marker: PhantomData<*const ()>,
5759
}
5860

5961
impl Win32WindowHandle {
@@ -80,6 +82,7 @@ impl Win32WindowHandle {
8082
Self {
8183
hwnd,
8284
hinstance: None,
85+
_marker: PhantomData,
8386
}
8487
}
8588
}

0 commit comments

Comments
 (0)