diff --git a/crates/objc2/src/runtime/nscopying.rs b/crates/objc2/src/runtime/nscopying.rs index 5ea023f9c..94cb0f02e 100644 --- a/crates/objc2/src/runtime/nscopying.rs +++ b/crates/objc2/src/runtime/nscopying.rs @@ -9,10 +9,11 @@ pub trait Copyhelper { type CopyOutput: ?Sized + Message; type MutableCopyOutput: ?Sized + Message; + // TODO: Use this to autogenerate `ToOwned` impls #[doc(hidden)] fn __do_copy(t: &T) -> Id; } -impl> Copyhelper for Unknown { +impl> Copyhelper for Unknown { type CopyOutput = T; type MutableCopyOutput = T; @@ -21,7 +22,7 @@ impl> Copyhelper for Unkno t.copy() } } -impl> Copyhelper for Immutable { +impl> Copyhelper for Immutable { type CopyOutput = T; type MutableCopyOutput = T; @@ -30,7 +31,7 @@ impl> Copyhelper for Imm t.copy() } } -impl> Copyhelper for Mutable { +impl> Copyhelper for Mutable { type CopyOutput = T; type MutableCopyOutput = T; @@ -41,8 +42,8 @@ impl> Copyhelper for Mutab } impl Copyhelper for ImmutableWithMutableSubclass where - T: ClassType + NSCopying + Message>, - S: ClassType + Message>, + T: NSCopying + Message>, + S: Message>, { type CopyOutput = T; type MutableCopyOutput = S; @@ -54,8 +55,8 @@ where } impl Copyhelper for MutableWithImmutableSuperclass where - T: ClassType + NSMutableCopying + Message>, - S: ClassType + Message>, + T: NSMutableCopying + Message>, + S: Message>, { type CopyOutput = S; type MutableCopyOutput = T; @@ -65,7 +66,7 @@ where t.mutableCopy() } } -impl> Copyhelper for InteriorMutable { +impl> Copyhelper for InteriorMutable { type CopyOutput = T; type MutableCopyOutput = T; @@ -74,7 +75,7 @@ impl> Copyhelper f t.copy() } } -impl> Copyhelper for MainThreadOnly { +impl> Copyhelper for MainThreadOnly { type CopyOutput = T; type MutableCopyOutput = T; @@ -100,7 +101,7 @@ pub unsafe trait NSCopying { /// `NSString`. fn copy(&self) -> Id<>::CopyOutput> where - Self: Sized + ClassType, + Self: Sized + Message, Self::Kind: Copyhelper, { unsafe { msg_send_id![self, copy] } @@ -132,9 +133,10 @@ crate::__inner_extern_protocol!( /// - The `mutableCopy` selector must return an owned object. /// - TODO: More. pub unsafe trait NSMutableCopying { + #[allow(non_snake_case)] fn mutableCopy(&self) -> Id<>::MutableCopyOutput> where - Self: Sized + ClassType, + Self: Sized + Message, Self::Kind: Copyhelper, { unsafe { msg_send_id![self, mutableCopy] }