diff --git a/objc2-foundation/src/array.rs b/objc2-foundation/src/array.rs index 1dba1e2a6..d84015725 100644 --- a/objc2-foundation/src/array.rs +++ b/objc2-foundation/src/array.rs @@ -43,19 +43,10 @@ unsafe impl Send for NSArray {} object! { // TODO: Ensure that this deref to NSArray is safe! - unsafe pub struct NSMutableArray: NSArray { - item: PhantomData>, - } + // This "inherits" NSArray, and has the same `Send`/`Sync` impls as that. + unsafe pub struct NSMutableArray: NSArray {} } -// SAFETY: Same as NSArray. -// -// TODO: Properly verify this -unsafe impl Sync for NSMutableArray {} -unsafe impl Send for NSMutableArray {} -unsafe impl Sync for NSMutableArray {} -unsafe impl Send for NSMutableArray {} - unsafe fn from_refs(cls: &Class, refs: &[&T]) -> NonNull { let obj: *mut Object = unsafe { msg_send![cls, alloc] }; let obj: *mut Object = unsafe { diff --git a/objc2/src/rc/id.rs b/objc2/src/rc/id.rs index 01c3c215c..79ba29cfe 100644 --- a/objc2/src/rc/id.rs +++ b/objc2/src/rc/id.rs @@ -2,8 +2,8 @@ use core::fmt; use core::marker::PhantomData; use core::mem::ManuallyDrop; use core::ops::{Deref, DerefMut}; +use core::panic::{RefUnwindSafe, UnwindSafe}; use core::ptr::NonNull; -use std::panic::{RefUnwindSafe, UnwindSafe}; use super::AutoreleasePool; use super::{Owned, Ownership, Shared}; @@ -117,6 +117,11 @@ pub struct Id { item: PhantomData, /// To prevent warnings about unused type parameters. own: PhantomData, + /// Marks the type as !UnwindSafe. Later on we'll re-enable this. + /// + /// See for why this is + /// required. + notunwindsafe: PhantomData<&'static mut ()>, } impl Id { @@ -171,6 +176,7 @@ impl Id { ptr, item: PhantomData, own: PhantomData, + notunwindsafe: PhantomData, } }