Skip to content

Commit 8c3fe94

Browse files
committed
Breaking: Make WebWindowHandle and Win32WindowHandle !Send and !Sync
1 parent f963828 commit 8c3fe94

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/lib.rs

+2-2
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

+6-1
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
/// Raw display handle for the Web.
@@ -33,6 +34,7 @@ pub struct WebWindowHandle {
3334
///
3435
/// [data attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-*
3536
pub id: u32,
37+
_marker: PhantomData<*const ()>,
3638
}
3739

3840
impl WebWindowHandle {
@@ -48,7 +50,10 @@ impl WebWindowHandle {
4850
/// let handle = WebWindowHandle::new(id);
4951
/// ```
5052
pub fn new(id: u32) -> Self {
51-
Self { id }
53+
Self {
54+
id,
55+
_marker: PhantomData,
56+
}
5257
}
5358
}
5459

src/windows.rs

+3
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

@@ -32,6 +33,7 @@ pub struct Win32WindowHandle {
3233
pub hwnd: NonZeroIsize,
3334
/// The `GWLP_HINSTANCE` associated with this type's `HWND`.
3435
pub hinstance: Option<NonZeroIsize>,
36+
_marker: PhantomData<*const ()>,
3537
}
3638

3739
impl Win32WindowHandle {
@@ -58,6 +60,7 @@ impl Win32WindowHandle {
5860
Self {
5961
hwnd,
6062
hinstance: None,
63+
_marker: PhantomData,
6164
}
6265
}
6366
}

0 commit comments

Comments
 (0)