From 04077a2a53ba564096a0f58fcac1a1b158b0f293 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 21 Jan 2025 16:16:09 +0100 Subject: [PATCH] Remove objc_alloc optimization from msg_send! It's fairly difficult to make it trigger correctly in all situations, so let's instead use it internally in the safe `alloc` functions. This should push users towards using those instead. --- crates/objc2/CHANGELOG.md | 3 ++ .../src/__macro_helpers/method_family.rs | 5 -- crates/objc2/src/__macro_helpers/mod.rs | 6 +-- .../src/__macro_helpers/msg_send_retained.rs | 47 ++----------------- .../src/__macro_helpers/os_version/apple.rs | 4 +- crates/objc2/src/macros/mod.rs | 2 +- crates/objc2/src/main_thread_marker.rs | 4 +- crates/objc2/src/rc/allocated_partial_init.rs | 36 +++++++++++++- crates/objc2/src/top_level_traits.rs | 9 ++-- .../expected/apple-aarch64.s | 39 ++++++++------- .../expected/apple-armv7s.s | 20 +++++--- .../expected/apple-x86.s | 9 +++- .../expected/apple-x86_64.s | 4 +- .../ui/msg_send_invalid_receiver.stderr | 6 +-- .../test-ui/ui/msg_send_invalid_return.stderr | 24 +++++----- 15 files changed, 118 insertions(+), 100 deletions(-) diff --git a/crates/objc2/CHANGELOG.md b/crates/objc2/CHANGELOG.md index 845fd3ce1..890522a79 100644 --- a/crates/objc2/CHANGELOG.md +++ b/crates/objc2/CHANGELOG.md @@ -205,6 +205,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). * **BREAKING**: Removed the ability to implement `ClassType` manually, to make it easier to evolve the API going forwards. * **BREAKING**: Removed the deprecated `apple` Cargo feature flag. +* The optimization for converting `msg_send_id![cls, alloc]` to a call to + the faster runtime function `objc_alloc` no longer works, use + `AllocAnyThread::alloc` or `MainThreadOnly::alloc` instead. ### Fixed * Remove an incorrect assertion when adding protocols to classes in an unexpected diff --git a/crates/objc2/src/__macro_helpers/method_family.rs b/crates/objc2/src/__macro_helpers/method_family.rs index 74447ab21..68bf904b1 100644 --- a/crates/objc2/src/__macro_helpers/method_family.rs +++ b/crates/objc2/src/__macro_helpers/method_family.rs @@ -34,11 +34,6 @@ pub type MutableCopyFamily = MethodFamily<5>; /// No family. pub type NoneFamily = MethodFamily<6>; -/// The `alloc` selector itself. -/// -/// Used for a fast-path optimization using `objc_alloc`. -pub type AllocSelector = MethodFamily<7>; - // These are used to avoid trying to do retain-semantics for these special // selectors that would otherwise fall under `NoneFamily`. diff --git a/crates/objc2/src/__macro_helpers/mod.rs b/crates/objc2/src/__macro_helpers/mod.rs index 4e96dd312..ed5f8b9ae 100644 --- a/crates/objc2/src/__macro_helpers/mod.rs +++ b/crates/objc2/src/__macro_helpers/mod.rs @@ -41,9 +41,9 @@ pub use self::define_class::{ pub use self::defined_ivars::DefinedIvarsHelper; pub use self::image_info::ImageInfo; pub use self::method_family::{ - method_family, method_family_import, AllocFamily, AllocSelector, AutoreleaseSelector, - CopyFamily, DeallocSelector, InitFamily, MethodFamily, MutableCopyFamily, NewFamily, - NoneFamily, ReleaseSelector, RetainSelector, + method_family, method_family_import, AllocFamily, AutoreleaseSelector, CopyFamily, + DeallocSelector, InitFamily, MethodFamily, MutableCopyFamily, NewFamily, NoneFamily, + ReleaseSelector, RetainSelector, }; pub use self::module_info::ModuleInfo; pub use self::msg_send_retained::{MsgSend, MsgSendError, MsgSendSuper, MsgSendSuperError}; diff --git a/crates/objc2/src/__macro_helpers/msg_send_retained.rs b/crates/objc2/src/__macro_helpers/msg_send_retained.rs index 86e32c4ba..4a09fd8c1 100644 --- a/crates/objc2/src/__macro_helpers/msg_send_retained.rs +++ b/crates/objc2/src/__macro_helpers/msg_send_retained.rs @@ -1,14 +1,13 @@ use core::ptr; use crate::encode::{Encode, RefEncode}; -use crate::rc::{Allocated, Retained}; +use crate::rc::Retained; use crate::runtime::{AnyClass, MessageReceiver, Sel}; -use crate::{ClassType, Message}; +use crate::ClassType; use super::null_error::encountered_error; use super::{ - AllocSelector, ConvertArguments, KindSendMessage, KindSendMessageSuper, RetainSemantics, - TupleExtender, + ConvertArguments, KindSendMessage, KindSendMessageSuper, RetainSemantics, TupleExtender, }; // @@ -41,44 +40,6 @@ where } } -impl MsgSend<&AnyClass, Allocated> for AllocSelector -where - Return: Message, -{ - #[inline] - unsafe fn send_message( - cls: &AnyClass, - sel: Sel, - args: A, - ) -> Allocated { - // Available on non-fragile Apple runtimes. - #[cfg(all( - target_vendor = "apple", - not(all(target_os = "macos", target_arch = "x86")) - ))] - { - // We completely ignore both the selector and the arguments, since - // we know them to be `alloc` and empty (since this is the - // `AllocSelector` "family"). - let _ = sel; - let _ = args; - - // SAFETY: Checked by caller. - let obj: *mut Return = unsafe { crate::ffi::objc_alloc(cls).cast() }; - // SAFETY: The object is newly allocated, so this has +1 retain count - unsafe { Allocated::new(obj) } - } - #[cfg(not(all( - target_vendor = "apple", - not(all(target_os = "macos", target_arch = "x86")) - )))] - { - // SAFETY: Checked by caller - unsafe { super::AllocFamily::send_message(cls, sel, args) } - } - } -} - // // MsgSendSuper // @@ -357,7 +318,7 @@ mod tests { use super::*; - use crate::rc::{autoreleasepool, PartialInit, RcTestObject, ThreadTestData}; + use crate::rc::{autoreleasepool, Allocated, PartialInit, RcTestObject, ThreadTestData}; use crate::runtime::{AnyObject, NSObject, NSZone}; use crate::{class, define_class, extern_methods, msg_send, test_utils, AllocAnyThread}; diff --git a/crates/objc2/src/__macro_helpers/os_version/apple.rs b/crates/objc2/src/__macro_helpers/os_version/apple.rs index 35b9f15c1..7affc125a 100644 --- a/crates/objc2/src/__macro_helpers/os_version/apple.rs +++ b/crates/objc2/src/__macro_helpers/os_version/apple.rs @@ -207,8 +207,8 @@ fn version_from_plist() -> OSVersion { let path = PathBuf::from(root).join("System/Library/CoreServices/SystemVersion.plist"); let path = path.as_os_str().as_bytes(); - // SAFETY: Allocating a string is valid. - let alloc: Allocated = unsafe { msg_send![class!(NSString), alloc] }; + // SAFETY: Allocating a string is valid on all threads. + let alloc: Allocated = unsafe { Allocated::alloc(class!(NSString)) }; // SAFETY: The bytes are valid, and the length is correct. unsafe { let bytes_ptr: *const c_void = path.as_ptr().cast(); diff --git a/crates/objc2/src/macros/mod.rs b/crates/objc2/src/macros/mod.rs index 8aa93c862..f8b48860f 100644 --- a/crates/objc2/src/macros/mod.rs +++ b/crates/objc2/src/macros/mod.rs @@ -1197,7 +1197,7 @@ macro_rules! msg_send { }); [$obj:expr, alloc $(,)?] => ({ let result; - result = <$crate::__macro_helpers::AllocSelector as $crate::__macro_helpers::MsgSend<_, _>>::send_message( + result = <$crate::__macro_helpers::AllocFamily as $crate::__macro_helpers::MsgSend<_, _>>::send_message( $obj, $crate::sel!(alloc), (), diff --git a/crates/objc2/src/main_thread_marker.rs b/crates/objc2/src/main_thread_marker.rs index 4b9310cf3..500d47b4f 100644 --- a/crates/objc2/src/main_thread_marker.rs +++ b/crates/objc2/src/main_thread_marker.rs @@ -2,7 +2,7 @@ use core::fmt; use core::marker::PhantomData; use crate::rc::Allocated; -use crate::{msg_send, ClassType, MainThreadOnly}; +use crate::{ClassType, MainThreadOnly}; /// Whether the current thread is the main thread. #[inline] @@ -161,7 +161,7 @@ impl MainThreadMarker { // SAFETY: We hold `MainThreadMarker`, and classes are either only // safe to allocate on the main thread, or safe to allocate // everywhere. - unsafe { msg_send![T::class(), alloc] } + unsafe { Allocated::alloc(T::class()) } } } diff --git a/crates/objc2/src/rc/allocated_partial_init.rs b/crates/objc2/src/rc/allocated_partial_init.rs index 9550304f0..617d5d567 100644 --- a/crates/objc2/src/rc/allocated_partial_init.rs +++ b/crates/objc2/src/rc/allocated_partial_init.rs @@ -4,7 +4,7 @@ use core::ptr::NonNull; use core::{fmt, ptr}; use crate::__macro_helpers::defined_ivars::initialize_ivars; -use crate::runtime::{objc_release_fast, AnyObject}; +use crate::runtime::{objc_release_fast, AnyClass, AnyObject}; use crate::{DefinedClass, Message}; /// An Objective-C object that has been allocated, but not initialized. @@ -83,6 +83,40 @@ impl Allocated { } } + /// Allocate the object with a fast path using `objc_alloc`. + /// + /// + /// # Safety + /// + /// The object must be safe to allocate on the current thread, and the + /// object `T` must be an instance of the class. + #[doc(alias = "objc_alloc")] + #[inline] + pub(crate) unsafe fn alloc(cls: &AnyClass) -> Self + where + T: Sized, + { + // Available on non-fragile Apple runtimes. + #[cfg(all( + target_vendor = "apple", + not(all(target_os = "macos", target_arch = "x86")) + ))] + { + // SAFETY: Thread safety checked by the caller. + let obj: *mut T = unsafe { crate::ffi::objc_alloc(cls).cast() }; + // SAFETY: The object is newly allocated, so this has +1 retain count + unsafe { Self::new(obj) } + } + #[cfg(not(all( + target_vendor = "apple", + not(all(target_os = "macos", target_arch = "x86")) + )))] + { + // SAFETY: Thread safety checked by the caller. + unsafe { crate::msg_send![cls, alloc] } + } + } + /// Returns a raw pointer to the object. /// /// The pointer is valid for at least as long as the `Allocated` is held. diff --git a/crates/objc2/src/top_level_traits.rs b/crates/objc2/src/top_level_traits.rs index f64633c49..af610a1bc 100644 --- a/crates/objc2/src/top_level_traits.rs +++ b/crates/objc2/src/top_level_traits.rs @@ -5,7 +5,7 @@ use crate::__macro_helpers::defined_ivars::get_initialized_ivar_ptr; use crate::encode::RefEncode; use crate::rc::{Allocated, Retained}; use crate::runtime::{AnyClass, AnyProtocol, ProtocolObject}; -use crate::{msg_send, MainThreadMarker}; +use crate::MainThreadMarker; /// Types that can be sent Objective-C messages. /// @@ -455,7 +455,7 @@ pub unsafe trait AllocAnyThread: private::SealedAllocAnyThread { // to be allowed to `init` on the current thread. // // See also `MainThreadMarker::alloc`. - unsafe { msg_send![Self::class(), alloc] } + unsafe { Allocated::alloc(Self::class()) } } } @@ -551,7 +551,10 @@ pub unsafe trait MainThreadOnly: private::SealedMainThreadOnly { where Self: Sized + ClassType, { - mtm.alloc() + let _ = mtm; + // SAFETY: We hold `MainThreadMarker`, and the class is safe to + // allocate on the main thread. + unsafe { Allocated::alloc(Self::class()) } } } diff --git a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-aarch64.s b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-aarch64.s index 8def645fd..706c8f81b 100644 --- a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-aarch64.s +++ b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-aarch64.s @@ -15,13 +15,19 @@ _handle_alloc_init: stp x20, x19, [sp, #-32]! stp x29, x30, [sp, #16] add x29, sp, #16 - bl _objc_alloc - mov x19, x0 Lloh2: - adrp x8, L_OBJC_SELECTOR_REFERENCES_init@GOTPAGE + adrp x8, L_OBJC_SELECTOR_REFERENCES_alloc@GOTPAGE Lloh3: - ldr x8, [x8, L_OBJC_SELECTOR_REFERENCES_init@GOTPAGEOFF] + ldr x8, [x8, L_OBJC_SELECTOR_REFERENCES_alloc@GOTPAGEOFF] Lloh4: + ldr x1, [x8] + bl _objc_msgSend + mov x19, x0 +Lloh5: + adrp x8, L_OBJC_SELECTOR_REFERENCES_init@GOTPAGE +Lloh6: + ldr x8, [x8, L_OBJC_SELECTOR_REFERENCES_init@GOTPAGEOFF] +Lloh7: ldr x20, [x8] mov x1, x20 bl _objc_msgSend @@ -30,15 +36,16 @@ Lloh4: ldp x20, x19, [sp], #32 ret LBB1_2: -Lloh5: +Lloh8: adrp x2, l_anon.[ID].1@PAGE -Lloh6: +Lloh9: add x2, x2, l_anon.[ID].1@PAGEOFF mov x0, x19 mov x1, x20 bl SYM(objc2::__macro_helpers::retain_semantics::init_fail::GENERATED_ID, 0) + .loh AdrpLdrGotLdr Lloh5, Lloh6, Lloh7 .loh AdrpLdrGotLdr Lloh2, Lloh3, Lloh4 - .loh AdrpAdd Lloh5, Lloh6 + .loh AdrpAdd Lloh8, Lloh9 .globl _use_generic .p2align 2 @@ -47,32 +54,32 @@ _use_generic: stp x29, x30, [sp, #16] add x29, sp, #16 mov x19, x0 -Lloh7: +Lloh10: adrp x8, L_OBJC_SELECTOR_REFERENCES_67bf3e41c7e639a3@PAGE -Lloh8: +Lloh11: ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_67bf3e41c7e639a3@PAGEOFF] adrp x20, L_OBJC_SELECTOR_REFERENCES_91c006d97540f4b5@PAGE ldr x2, [x20, L_OBJC_SELECTOR_REFERENCES_91c006d97540f4b5@PAGEOFF] bl _objc_msgSend -Lloh9: +Lloh12: adrp x8, L_OBJC_SELECTOR_REFERENCES_2c2c9a8191012941@PAGE -Lloh10: +Lloh13: ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_2c2c9a8191012941@PAGEOFF] ldr x2, [x20, L_OBJC_SELECTOR_REFERENCES_91c006d97540f4b5@PAGEOFF] mov x0, x19 bl _objc_msgSend -Lloh11: +Lloh14: adrp x8, L_OBJC_SELECTOR_REFERENCES_993d94b40d47ed52@PAGE -Lloh12: +Lloh15: ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_993d94b40d47ed52@PAGEOFF] ldr x2, [x20, L_OBJC_SELECTOR_REFERENCES_91c006d97540f4b5@PAGEOFF] mov x0, x19 ldp x29, x30, [sp, #16] ldp x20, x19, [sp], #32 b _objc_msgSend - .loh AdrpLdr Lloh11, Lloh12 - .loh AdrpLdr Lloh9, Lloh10 - .loh AdrpLdr Lloh7, Lloh8 + .loh AdrpLdr Lloh14, Lloh15 + .loh AdrpLdr Lloh12, Lloh13 + .loh AdrpLdr Lloh10, Lloh11 .section __TEXT,__const l_anon.[ID].0: diff --git a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7s.s b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7s.s index 67b1e1676..a416b90fc 100644 --- a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7s.s +++ b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7s.s @@ -16,10 +16,15 @@ LPC0_0: _handle_alloc_init: push {r4, r5, r7, lr} add r7, sp, #8 - bl _objc_alloc - movw r1, :lower16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_0+8)) - movt r1, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_0+8)) + movw r1, :lower16:(LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr-(LPC1_0+8)) + movt r1, :upper16:(LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr-(LPC1_0+8)) LPC1_0: + ldr r1, [pc, r1] + ldr r1, [r1] + bl _objc_msgSend + movw r1, :lower16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_1+8)) + movt r1, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_1+8)) +LPC1_1: ldr r1, [pc, r1] mov r4, r0 ldr r5, [r1] @@ -28,9 +33,9 @@ LPC1_0: cmp r0, #0 popne {r4, r5, r7, pc} LBB1_1: - movw r2, :lower16:(l_anon.[ID].1-(LPC1_1+8)) - movt r2, :upper16:(l_anon.[ID].1-(LPC1_1+8)) -LPC1_1: + movw r2, :lower16:(l_anon.[ID].1-(LPC1_2+8)) + movt r2, :upper16:(l_anon.[ID].1-(LPC1_2+8)) +LPC1_2: add r2, pc, r2 mov r0, r4 mov r1, r5 @@ -172,6 +177,9 @@ L_OBJC_IMAGE_INFO_993d94b40d47ed52: .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers .p2align 2, 0x0 +LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr: + .indirect_symbol L_OBJC_SELECTOR_REFERENCES_alloc + .long 0 LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr: .indirect_symbol L_OBJC_SELECTOR_REFERENCES_init .long 0 diff --git a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86.s b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86.s index 46919075e..b860ddf83 100644 --- a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86.s +++ b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86.s @@ -29,9 +29,11 @@ _handle_alloc_init: call L1$pb L1$pb: pop edi - sub esp, 12 + mov eax, dword ptr [edi + LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr-L1$pb] + sub esp, 8 + push dword ptr [eax] push dword ptr [ebp + 8] - call _objc_alloc + call _objc_msgSend add esp, 16 mov esi, eax mov eax, dword ptr [edi + LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-L1$pb] @@ -185,6 +187,9 @@ L_OBJC_IMAGE_INFO_993d94b40d47ed52: .asciz "\000\000\000\000@\000\000" .section __IMPORT,__pointers,non_lazy_symbol_pointers +LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr: + .indirect_symbol L_OBJC_SELECTOR_REFERENCES_alloc + .long 0 LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr: .indirect_symbol L_OBJC_SELECTOR_REFERENCES_init .long 0 diff --git a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86_64.s b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86_64.s index e6092b8f4..33ff3869e 100644 --- a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86_64.s +++ b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86_64.s @@ -16,7 +16,9 @@ _handle_alloc_init: mov rbp, rsp push r14 push rbx - call _objc_alloc + mov rax, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_alloc@GOTPCREL] + mov rsi, qword ptr [rax] + call _objc_msgSend mov rbx, rax mov rax, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_init@GOTPCREL] mov r14, qword ptr [rax] diff --git a/crates/test-ui/ui/msg_send_invalid_receiver.stderr b/crates/test-ui/ui/msg_send_invalid_receiver.stderr index d25e080cf..b15d910b8 100644 --- a/crates/test-ui/ui/msg_send_invalid_receiver.stderr +++ b/crates/test-ui/ui/msg_send_invalid_receiver.stderr @@ -15,9 +15,9 @@ error[E0277]: the trait bound `Allocated: Encode` is not satisfied AtomicI8 and $N others = note: required for `Allocated` to implement `EncodeReturn` - = note: required for `Allocated` to implement `ConvertReturn>` - = note: required for `MethodFamily<7>` to implement `RetainSemantics<&NSObject, Allocated, KindSendMessage>` - = note: required for `MethodFamily<7>` to implement `MsgSend<&NSObject, Allocated>` + = note: required for `Allocated` to implement `ConvertReturn>` + = note: required for `MethodFamily<2>` to implement `RetainSemantics<&NSObject, Allocated, KindSendMessage>` + = note: required for `MethodFamily<2>` to implement `MsgSend<&NSObject, Allocated>` = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Retained: Encode` is not satisfied diff --git a/crates/test-ui/ui/msg_send_invalid_return.stderr b/crates/test-ui/ui/msg_send_invalid_return.stderr index a9c4d8176..7869ed610 100644 --- a/crates/test-ui/ui/msg_send_invalid_return.stderr +++ b/crates/test-ui/ui/msg_send_invalid_return.stderr @@ -15,9 +15,9 @@ error[E0277]: the trait bound `Retained: Encode` is not satisfied AtomicI8 and $N others = note: required for `Retained` to implement `EncodeReturn` - = note: required for `Retained` to implement `ConvertReturn>` - = note: required for `MethodFamily<7>` to implement `RetainSemantics<&AnyClass, Retained, KindSendMessage>` - = note: required for `MethodFamily<7>` to implement `MsgSend<&AnyClass, Retained>` + = note: required for `Retained` to implement `ConvertReturn>` + = note: required for `MethodFamily<2>` to implement `RetainSemantics<&AnyClass, Retained, KindSendMessage>` + = note: required for `MethodFamily<2>` to implement `MsgSend<&AnyClass, Retained>` = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Allocated: Encode` is not satisfied @@ -38,9 +38,9 @@ error[E0277]: the trait bound `Allocated: Encode` is not satisfied and $N others = note: required for `Option>` to implement `Encode` = note: required for `Option>` to implement `EncodeReturn` - = note: required for `Option>` to implement `ConvertReturn>` - = note: required for `MethodFamily<7>` to implement `RetainSemantics<&AnyClass, Option>, KindSendMessage>` - = note: required for `MethodFamily<7>` to implement `MsgSend<&AnyClass, Option>>` + = note: required for `Option>` to implement `ConvertReturn>` + = note: required for `MethodFamily<2>` to implement `RetainSemantics<&AnyClass, Option>, KindSendMessage>` + = note: required for `MethodFamily<2>` to implement `MsgSend<&AnyClass, Option>>` = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Allocated: OptionEncode` is not satisfied @@ -61,9 +61,9 @@ error[E0277]: the trait bound `Allocated: OptionEncode` is not satisf and $N others = note: required for `Option>` to implement `Encode` = note: required for `Option>` to implement `EncodeReturn` - = note: required for `Option>` to implement `ConvertReturn>` - = note: required for `MethodFamily<7>` to implement `RetainSemantics<&AnyClass, Option>, KindSendMessage>` - = note: required for `MethodFamily<7>` to implement `MsgSend<&AnyClass, Option>>` + = note: required for `Option>` to implement `ConvertReturn>` + = note: required for `MethodFamily<2>` to implement `RetainSemantics<&AnyClass, Option>, KindSendMessage>` + = note: required for `MethodFamily<2>` to implement `MsgSend<&AnyClass, Option>>` = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Retained>: Encode` is not satisfied @@ -83,9 +83,9 @@ error[E0277]: the trait bound `Retained>: Encode` is not sa AtomicI8 and $N others = note: required for `Retained>` to implement `EncodeReturn` - = note: required for `Retained>` to implement `ConvertReturn>` - = note: required for `MethodFamily<7>` to implement `RetainSemantics<&AnyClass, Retained>, KindSendMessage>` - = note: required for `MethodFamily<7>` to implement `MsgSend<&AnyClass, Retained>>` + = note: required for `Retained>` to implement `ConvertReturn>` + = note: required for `MethodFamily<2>` to implement `RetainSemantics<&AnyClass, Retained>, KindSendMessage>` + = note: required for `MethodFamily<2>` to implement `MsgSend<&AnyClass, Retained>>` = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Allocated: MessageReceiver` is not satisfied