From 00e497ce7b0de4a54201b60358a273bddf51f555 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Wed, 28 Dec 2022 17:28:57 +0100 Subject: [PATCH] Default `Id` ownership to `Shared` --- crates/header-translator/src/rust_type.rs | 31 +++--- crates/icrate/examples/browser.rs | 8 +- crates/icrate/examples/delegate.rs | 8 +- crates/icrate/examples/nspasteboard.rs | 18 ++-- crates/icrate/examples/speech_synthesis.rs | 3 +- .../src/Foundation/__macro_helpers/cached.rs | 4 +- .../Foundation/additions/attributed_string.rs | 6 +- .../icrate/src/Foundation/additions/bundle.rs | 2 +- .../icrate/src/Foundation/additions/data.rs | 10 +- .../icrate/src/Foundation/additions/error.rs | 4 +- .../src/Foundation/additions/exception.rs | 8 +- .../additions/mutable_attributed_string.rs | 2 +- .../src/Foundation/additions/mutable_data.rs | 2 +- .../icrate/src/Foundation/additions/number.rs | 8 +- .../icrate/src/Foundation/additions/string.rs | 4 +- .../icrate/src/Foundation/additions/thread.rs | 2 +- .../icrate/src/Foundation/additions/uuid.rs | 6 +- .../icrate/src/Foundation/additions/value.rs | 2 +- crates/icrate/src/Foundation/fixes/NSUUID.rs | 2 +- .../src/Foundation/fixes/generic_return.rs | 18 ++-- crates/icrate/src/Metal/device.rs | 2 +- crates/icrate/src/Metal/private.rs | 10 +- crates/icrate/src/WebKit/fixes.rs | 2 +- crates/icrate/src/generated | 2 +- crates/icrate/tests/array.rs | 2 +- crates/icrate/tests/dictionary.rs | 4 +- crates/objc2/CHANGELOG.md | 4 + crates/objc2/README.md | 4 +- crates/objc2/benches/autorelease.rs | 18 ++-- crates/objc2/src/__macro_helpers.rs | 62 ++++++------ crates/objc2/src/declare.rs | 12 +-- .../objc2/src/declare/declare_class_tests.rs | 38 +++---- crates/objc2/src/declare/ivar.rs | 4 +- crates/objc2/src/declare/ivar_drop.rs | 8 +- crates/objc2/src/exception.rs | 14 +-- crates/objc2/src/lib.rs | 9 +- crates/objc2/src/macros.rs | 31 +++--- crates/objc2/src/macros/declare_class.rs | 10 +- crates/objc2/src/macros/extern_class.rs | 4 +- crates/objc2/src/macros/extern_methods.rs | 20 ++-- crates/objc2/src/macros/extern_protocol.rs | 8 +- crates/objc2/src/message/mod.rs | 22 ++--- crates/objc2/src/protocol.rs | 6 +- crates/objc2/src/rc/id.rs | 4 +- crates/objc2/src/rc/mod.rs | 4 +- crates/objc2/src/rc/test_object.rs | 14 +-- crates/objc2/src/rc/writeback.rs | 2 +- crates/objc2/src/runtime/nsobject.rs | 4 +- crates/objc2/tests/declare_class_self.rs | 6 +- crates/objc2/tests/id_retain_autoreleased.rs | 4 +- crates/objc2/tests/track_caller.rs | 31 +++--- .../expected/apple-aarch64.s | 22 ++--- .../expected/apple-armv7.s | 22 ++--- .../expected/apple-armv7s.s | 22 ++--- .../expected/apple-old-x86.s | 18 ++-- .../test_extern_protocol/expected/apple-x86.s | 18 ++-- .../expected/apple-x86_64.s | 18 ++-- .../crates/test_extern_protocol/lib.rs | 4 +- .../crates/test_msg_send_error/lib.rs | 12 +-- .../crates/test_msg_send_id/lib.rs | 26 ++--- .../expected/apple-aarch64.s | 94 +++++++++--------- .../expected/apple-armv7.s | 98 +++++++++---------- .../expected/apple-armv7s.s | 98 +++++++++---------- .../expected/apple-old-x86.s | 84 ++++++++-------- .../expected/apple-x86.s | 84 ++++++++-------- .../expected/apple-x86_64.s | 84 ++++++++-------- .../crates/test_msg_send_static_sel/lib.rs | 4 +- .../crates/test_retain_autoreleased/lib.rs | 4 +- crates/test-ui/ui/declare_add_bad_method.rs | 4 +- .../ui/declare_class_invalid_receiver.rs | 14 +-- .../ui/declare_class_invalid_receiver.stderr | 24 ++--- .../ui/declare_class_invalid_syntax.rs | 12 +-- .../ui/declare_class_invalid_syntax.stderr | 4 +- .../test-ui/ui/declare_class_invalid_type.rs | 4 +- .../ui/declare_class_invalid_type.stderr | 8 +- .../test-ui/ui/declare_class_invalid_type2.rs | 4 +- .../ui/declare_class_invalid_type2.stderr | 6 +- .../test-ui/ui/extern_methods_invalid_type.rs | 10 +- .../ui/extern_methods_invalid_type.stderr | 28 +++--- crates/test-ui/ui/extern_methods_variadic.rs | 6 +- .../test-ui/ui/extern_methods_variadic.stderr | 14 +-- .../extern_methods_wrong_arguments_error.rs | 10 +- ...xtern_methods_wrong_arguments_error.stderr | 8 +- crates/test-ui/ui/invalid_msg_send.rs | 4 +- crates/test-ui/ui/invalid_msg_send.stderr | 4 +- .../ui/msg_send_id_alloc_init_different.rs | 4 +- .../msg_send_id_alloc_init_different.stderr | 6 +- .../ui/msg_send_id_invalid_receiver.rs | 22 ++--- .../ui/msg_send_id_invalid_receiver.stderr | 72 +++++++------- .../test-ui/ui/msg_send_id_invalid_return.rs | 14 +-- .../ui/msg_send_id_invalid_return.stderr | 52 +++++----- crates/test-ui/ui/msg_send_id_unwrap.rs | 4 +- crates/test-ui/ui/msg_send_id_unwrap.stderr | 4 +- crates/test-ui/ui/msg_send_invalid_error.rs | 4 +- .../test-ui/ui/msg_send_invalid_error.stderr | 32 +++--- .../ui/msg_send_underspecified_error.rs | 6 +- .../ui/msg_send_underspecified_error.stderr | 12 +-- .../ui/msg_send_underspecified_error2.rs | 4 +- .../ui/msg_send_underspecified_error2.stderr | 11 ++- crates/test-ui/ui/not_writeback.rs | 6 +- crates/test-ui/ui/not_writeback.stderr | 22 ++--- .../test-ui/ui/nsarray_bound_not_send_sync.rs | 5 +- .../ui/nsarray_bound_not_send_sync.stderr | 16 +-- crates/test-ui/ui/wrong_optional.rs | 6 +- crates/tests/src/exception.rs | 4 +- crates/tests/src/test_object.rs | 10 +- 106 files changed, 843 insertions(+), 862 deletions(-) diff --git a/crates/header-translator/src/rust_type.rs b/crates/header-translator/src/rust_type.rs index 4e0931606..64ca79788 100644 --- a/crates/header-translator/src/rust_type.rs +++ b/crates/header-translator/src/rust_type.rs @@ -170,15 +170,6 @@ impl From for Ownership { } } -impl fmt::Display for Ownership { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - Self::Owned => write!(f, "Owned"), - Self::Shared => write!(f, "Shared"), - } - } -} - #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] enum TypeParams { Empty, @@ -234,14 +225,14 @@ impl IdType { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self.0 { IdType::Class { - ownership: Some(ownership), + ownership: Some(Ownership::Owned), .. } | IdType::Self_ { - ownership: Some(ownership), - } => write!(f, "{ownership}"), - IdType::GenericParam { name } => write!(f, "{name}Ownership"), - _ => write!(f, "{}", Ownership::Shared), + ownership: Some(Ownership::Owned), + } => write!(f, ", Owned"), + IdType::GenericParam { name } => write!(f, ", {name}Ownership"), + _ => Ok(()), } } } @@ -1598,9 +1589,9 @@ impl fmt::Display for Ty { nullability, } => { if *nullability == Nullability::NonNull { - write!(f, "Id<{ty}, {}>", ty.ownership()) + write!(f, "Id<{ty}{}>", ty.ownership()) } else { - write!(f, "Option>", ty.ownership()) + write!(f, "Option>", ty.ownership()) } } Inner::Class { nullability } => { @@ -1627,7 +1618,7 @@ impl fmt::Display for Ty { // NULL -> error write!( f, - " -> Result, Id<{}, Shared>>", + " -> Result, Id<{}>>", ty.ownership(), ItemIdentifier::nserror().path(), ) @@ -1636,7 +1627,7 @@ impl fmt::Display for Ty { // NO -> error write!( f, - " -> Result<(), Id<{}, Shared>>", + " -> Result<(), Id<{}>>", ItemIdentifier::nserror().path() ) } @@ -1733,9 +1724,9 @@ impl fmt::Display for Ty { nullability: inner_nullability, } if self.kind == TyKind::MethodArgument => { let tokens = if *inner_nullability == Nullability::NonNull { - format!("Id<{ty}, Shared>") + format!("Id<{ty}>") } else { - format!("Option>") + format!("Option>") }; if *nullability == Nullability::NonNull { write!(f, "&mut {tokens}") diff --git a/crates/icrate/examples/browser.rs b/crates/icrate/examples/browser.rs index 834a49ad8..91b44aed1 100644 --- a/crates/icrate/examples/browser.rs +++ b/crates/icrate/examples/browser.rs @@ -5,7 +5,7 @@ use icrate::{ objc2::{ declare::{Ivar, IvarDrop}, declare_class, extern_methods, msg_send, - rc::{Allocated, Id, Shared}, + rc::{Allocated, Id}, runtime::{Object, Sel}, sel, ClassType, ProtocolObject, }, @@ -24,8 +24,8 @@ use icrate::{ declare_class!( struct Delegate { - text_field: IvarDrop, "_text_field">, - web_view: IvarDrop, "_web_view">, + text_field: IvarDrop, "_text_field">, + web_view: IvarDrop, "_web_view">, } mod ivars; @@ -99,7 +99,7 @@ extern_methods!( this: Option>, text_field: &NSTextField, web_view: &WKWebView, - ) -> Id; + ) -> Id; } ); diff --git a/crates/icrate/examples/delegate.rs b/crates/icrate/examples/delegate.rs index c7f75b6a2..f689e318e 100644 --- a/crates/icrate/examples/delegate.rs +++ b/crates/icrate/examples/delegate.rs @@ -1,7 +1,7 @@ #![cfg_attr(not(target_os = "macos"), allow(unused))] use icrate::ns_string; use icrate::objc2::declare::{Ivar, IvarBool, IvarDrop, IvarEncode}; -use icrate::objc2::rc::{Id, Shared}; +use icrate::objc2::rc::Id; use icrate::objc2::runtime::Object; use icrate::objc2::{declare_class, msg_send, msg_send_id, ClassType}; use icrate::Foundation::{NSCopying, NSObject, NSString}; @@ -18,8 +18,8 @@ declare_class!( another_ivar: IvarBool<"_another_ivar">, box_ivar: IvarDrop, "_box_ivar">, maybe_box_ivar: IvarDrop>, "_maybe_box_ivar">, - id_ivar: IvarDrop, "_id_ivar">, - maybe_id_ivar: IvarDrop>, "_maybe_id_ivar">, + id_ivar: IvarDrop, "_id_ivar">, + maybe_id_ivar: IvarDrop>, "_maybe_id_ivar">, } mod ivars; @@ -80,7 +80,7 @@ declare_class!( #[cfg(target_os = "macos")] impl CustomAppDelegate { - pub fn new(ivar: u8, another_ivar: bool) -> Id { + pub fn new(ivar: u8, another_ivar: bool) -> Id { unsafe { msg_send_id![Self::alloc(), initWith: ivar, another: another_ivar] } } } diff --git a/crates/icrate/examples/nspasteboard.rs b/crates/icrate/examples/nspasteboard.rs index 47f4c27f1..730a01016 100644 --- a/crates/icrate/examples/nspasteboard.rs +++ b/crates/icrate/examples/nspasteboard.rs @@ -6,7 +6,7 @@ use std::mem::ManuallyDrop; -use icrate::objc2::rc::{Id, Shared}; +use icrate::objc2::rc::Id; use icrate::objc2::runtime::{Class, Object}; use icrate::objc2::{extern_class, msg_send, msg_send_id, ClassType}; use icrate::Foundation::{NSArray, NSDictionary, NSInteger, NSObject, NSString}; @@ -44,14 +44,14 @@ impl NSPasteboard { /// TODO: Is this safe to call outside the main thread? /// /// - pub fn general() -> Id { + pub fn general() -> Id { unsafe { msg_send_id![Self::class(), generalPasteboard] } } /// Simple, straightforward implementation /// /// - pub fn text_impl_1(&self) -> Id { + pub fn text_impl_1(&self) -> Id { let s = unsafe { NSPasteboardTypeString }.unwrap(); unsafe { msg_send_id![self, stringForType: s] } } @@ -61,7 +61,7 @@ impl NSPasteboard { /// of nitty-gritty details. /// /// - pub fn text_impl_2(&self) -> Id { + pub fn text_impl_2(&self) -> Id { // The NSPasteboard API is a bit weird, it requires you to pass // classes as objects, which `icrate::Foundation::NSArray` was not // really made for - so we convert the class to an `Object` type @@ -69,7 +69,7 @@ impl NSPasteboard { // how classes handle `release` calls? // // TODO: Investigate and find a better way to express this in objc2. - let string_classes: ManuallyDrop<[Id; 1]> = { + let string_classes: ManuallyDrop<[Id; 1]> = { let cls: *const Class = NSString::class(); let cls = cls as *mut Object; unsafe { ManuallyDrop::new([Id::new(cls).unwrap()]) } @@ -80,7 +80,7 @@ impl NSPasteboard { let options = NSDictionary::new(); let objects = unsafe { self.read_objects_for_classes(&class_array, &options) }; - // TODO: Should perhaps return Id? + // TODO: Should perhaps return Id? let ptr: *const Object = objects.first().unwrap(); // And this part is weird as well, since we now have to convert the @@ -96,9 +96,9 @@ impl NSPasteboard { /// SAFETY: `class_array` must contain classes! unsafe fn read_objects_for_classes( &self, - class_array: &NSArray, + class_array: &NSArray, options: &NSDictionary, - ) -> Id, Shared> { + ) -> Id> { unsafe { msg_send_id![self, readObjectsForClasses: class_array, options: options] } } @@ -113,7 +113,7 @@ impl NSPasteboard { /// /// /// - pub fn set_text(&self, text: Id) { + pub fn set_text(&self, text: Id) { let _: NSInteger = unsafe { msg_send![self, clearContents] }; let string_array = NSArray::from_slice(&[text]); let res: bool = unsafe { msg_send![self, writeObjects: &*string_array] }; diff --git a/crates/icrate/examples/speech_synthesis.rs b/crates/icrate/examples/speech_synthesis.rs index faf8bfb38..1b42c5ba6 100644 --- a/crates/icrate/examples/speech_synthesis.rs +++ b/crates/icrate/examples/speech_synthesis.rs @@ -19,7 +19,6 @@ use icrate::Foundation::{NSObject, NSString}; #[cfg(target_os = "macos")] mod appkit { - use icrate::objc2::rc::Shared; use icrate::Foundation::NSCopying; use super::*; @@ -75,7 +74,7 @@ mod appkit { pub struct Utterance { rate: f32, volume: f32, - string: Id, + string: Id, } impl Utterance { diff --git a/crates/icrate/src/Foundation/__macro_helpers/cached.rs b/crates/icrate/src/Foundation/__macro_helpers/cached.rs index 273d1e35d..e7002a0d1 100644 --- a/crates/icrate/src/Foundation/__macro_helpers/cached.rs +++ b/crates/icrate/src/Foundation/__macro_helpers/cached.rs @@ -2,7 +2,7 @@ use core::mem::ManuallyDrop; use core::ptr; use core::sync::atomic::{AtomicPtr, Ordering}; -use objc2::rc::{Id, Shared}; +use objc2::rc::Id; use objc2::Message; /// Allows storing an `Id` in a static and lazily loading it. @@ -23,7 +23,7 @@ impl CachedId { /// Returns the cached object. If no object is yet cached, creates one /// from the given closure and stores it. #[inline] - pub fn get(&self, f: impl FnOnce() -> Id) -> &'static T { + pub fn get(&self, f: impl FnOnce() -> Id) -> &'static T { // TODO: Investigate if we can use weaker orderings. let ptr = self.ptr.load(Ordering::SeqCst); // SAFETY: The pointer is either NULL, or has been created below. diff --git a/crates/icrate/src/Foundation/additions/attributed_string.rs b/crates/icrate/src/Foundation/additions/attributed_string.rs index b2923c830..756b26e35 100644 --- a/crates/icrate/src/Foundation/additions/attributed_string.rs +++ b/crates/icrate/src/Foundation/additions/attributed_string.rs @@ -21,7 +21,7 @@ extern_methods!( unsafe impl NSAttributedString { /// Construct an empty attributed string. #[method_id(new)] - pub fn new() -> Id; + pub fn new() -> Id; /// Creates a new attributed string from the given string and attributes. /// @@ -37,14 +37,14 @@ extern_methods!( pub unsafe fn new_with_attributes( string: &Foundation::NSString, attributes: &Foundation::NSDictionary, - ) -> Id { + ) -> Id { unsafe { Self::initWithString_attributes(Self::alloc(), string, Some(attributes)) } } /// Creates a new attributed string without any attributes. #[doc(alias = "initWithString:")] #[cfg(feature = "Foundation_NSString")] - pub fn from_nsstring(string: &Foundation::NSString) -> Id { + pub fn from_nsstring(string: &Foundation::NSString) -> Id { Self::initWithString(Self::alloc(), string) } } diff --git a/crates/icrate/src/Foundation/additions/bundle.rs b/crates/icrate/src/Foundation/additions/bundle.rs index 4b4038099..4dd6bcc92 100644 --- a/crates/icrate/src/Foundation/additions/bundle.rs +++ b/crates/icrate/src/Foundation/additions/bundle.rs @@ -14,7 +14,7 @@ impl RefUnwindSafe for NSBundle {} impl NSBundle { #[cfg(feature = "Foundation_NSString")] #[cfg(feature = "Foundation_NSDictionary")] - pub fn name(&self) -> Option> { + pub fn name(&self) -> Option> { use Foundation::{NSCopying, NSString}; let info = self.infoDictionary()?; diff --git a/crates/icrate/src/Foundation/additions/data.rs b/crates/icrate/src/Foundation/additions/data.rs index d42da910d..042d32896 100644 --- a/crates/icrate/src/Foundation/additions/data.rs +++ b/crates/icrate/src/Foundation/additions/data.rs @@ -24,14 +24,14 @@ extern_methods!( /// Creation methods. unsafe impl NSData { #[method_id(new)] - pub fn new() -> Id; + pub fn new() -> Id; - pub fn with_bytes(bytes: &[u8]) -> Id { + pub fn with_bytes(bytes: &[u8]) -> Id { unsafe { Id::cast(with_slice(Self::class(), bytes)) } } #[cfg(feature = "block")] - pub fn from_vec(bytes: Vec) -> Id { + pub fn from_vec(bytes: Vec) -> Id { // GNUStep's NSData `initWithBytesNoCopy:length:deallocator:` has a // bug; it forgets to assign the input buffer and length to the // instance before it swizzles to NSDataWithDeallocatorBlock. @@ -119,7 +119,7 @@ impl<'a> IntoIterator for &'a NSData { } } -pub(crate) unsafe fn with_slice(cls: &Class, bytes: &[u8]) -> Id { +pub(crate) unsafe fn with_slice(cls: &Class, bytes: &[u8]) -> Id { let bytes_ptr: *const c_void = bytes.as_ptr().cast(); unsafe { msg_send_id![ @@ -131,7 +131,7 @@ pub(crate) unsafe fn with_slice(cls: &Class, bytes: &[u8]) -> Id } #[cfg(feature = "block")] -pub(crate) unsafe fn with_vec(cls: &Class, bytes: Vec) -> Id { +pub(crate) unsafe fn with_vec(cls: &Class, bytes: Vec) -> Id { use core::mem::ManuallyDrop; use block2::{Block, ConcreteBlock}; diff --git a/crates/icrate/src/Foundation/additions/error.rs b/crates/icrate/src/Foundation/additions/error.rs index 9af4906b0..0d54c7c8a 100644 --- a/crates/icrate/src/Foundation/additions/error.rs +++ b/crates/icrate/src/Foundation/additions/error.rs @@ -2,7 +2,7 @@ use core::fmt; use core::panic::{RefUnwindSafe, UnwindSafe}; -use objc2::rc::{Id, Shared}; +use objc2::rc::Id; use objc2::ClassType; use crate::Foundation::{ @@ -19,7 +19,7 @@ impl RefUnwindSafe for NSError {} /// Creation methods. impl NSError { /// Construct a new [`NSError`] with the given code in the given domain. - pub fn new(code: NSInteger, domain: &NSErrorDomain) -> Id { + pub fn new(code: NSInteger, domain: &NSErrorDomain) -> Id { // SAFETY: `domain` and `user_info` are copied to the error object, so // even if the `&NSString` came from a `&mut NSMutableString`, we're // still good! diff --git a/crates/icrate/src/Foundation/additions/exception.rs b/crates/icrate/src/Foundation/additions/exception.rs index 585150cd2..a31282dcb 100644 --- a/crates/icrate/src/Foundation/additions/exception.rs +++ b/crates/icrate/src/Foundation/additions/exception.rs @@ -29,7 +29,7 @@ extern_methods!( name: &NSExceptionName, reason: Option<&Foundation::NSString>, user_info: Option<&Foundation::NSDictionary>, - ) -> Option> { + ) -> Option> { unsafe { msg_send_id![ Self::alloc(), @@ -62,7 +62,7 @@ extern_methods!( } /// Convert this into an [`Exception`] object. - pub fn into_exception(this: Id) -> Id { + pub fn into_exception(this: Id) -> Id { // SAFETY: Downcasting to "subclass" unsafe { Id::cast(this) } } @@ -82,9 +82,7 @@ extern_methods!( /// /// This should be considered a hint; it may return `Err` in very, very /// few cases where the object is actually an instance of `NSException`. - pub fn from_exception( - obj: Id, - ) -> Result, Id> { + pub fn from_exception(obj: Id) -> Result, Id> { if Self::is_nsexception(&obj) { // SAFETY: Just checked the object is an NSException Ok(unsafe { Id::cast::(obj) }) diff --git a/crates/icrate/src/Foundation/additions/mutable_attributed_string.rs b/crates/icrate/src/Foundation/additions/mutable_attributed_string.rs index a993106ac..da16f4ae8 100644 --- a/crates/icrate/src/Foundation/additions/mutable_attributed_string.rs +++ b/crates/icrate/src/Foundation/additions/mutable_attributed_string.rs @@ -1,5 +1,5 @@ #![cfg(feature = "Foundation_NSMutableAttributedString")] -use objc2::rc::{DefaultId, Id, Owned, Shared}; +use objc2::rc::{DefaultId, Id, Owned}; use objc2::{extern_methods, msg_send_id, ClassType}; use crate::Foundation::{self, NSAttributedString, NSMutableAttributedString}; diff --git a/crates/icrate/src/Foundation/additions/mutable_data.rs b/crates/icrate/src/Foundation/additions/mutable_data.rs index efa290946..2f10920bb 100644 --- a/crates/icrate/src/Foundation/additions/mutable_data.rs +++ b/crates/icrate/src/Foundation/additions/mutable_data.rs @@ -7,7 +7,7 @@ use core::ptr::NonNull; use core::slice::{self, SliceIndex}; use std::io; -use objc2::rc::{DefaultId, Id, Owned, Shared}; +use objc2::rc::{DefaultId, Id, Owned}; use objc2::{extern_methods, ClassType}; use super::data::with_slice; diff --git a/crates/icrate/src/Foundation/additions/number.rs b/crates/icrate/src/Foundation/additions/number.rs index ff4131b22..ac99d430e 100644 --- a/crates/icrate/src/Foundation/additions/number.rs +++ b/crates/icrate/src/Foundation/additions/number.rs @@ -34,7 +34,7 @@ macro_rules! def_new_fn { ($fn_name:ident($fn_inp:ty); $method_name:ident), )*} => {$( $(#[$($m)*])* - pub fn $fn_name(val: $fn_inp) -> Id { + pub fn $fn_name(val: $fn_inp) -> Id { Self::$method_name(val as _) } )*} @@ -59,7 +59,7 @@ impl NSNumber { } #[inline] - pub fn new_cgfloat(val: CGFloat) -> Id { + pub fn new_cgfloat(val: CGFloat) -> Id { #[cfg(target_pointer_width = "64")] { Self::new_f64(val) @@ -138,7 +138,7 @@ impl NSNumber { /// ``` /// use icrate::Foundation::NSNumber; /// use icrate::objc2::Encoding; - /// use icrate::objc2::rc::{Id, Shared}; + /// use icrate::objc2::rc::Id; /// /// // Note: `bool` would convert to either `Signed` or `Unsigned`, /// // depending on platform @@ -150,7 +150,7 @@ impl NSNumber { /// } /// /// impl Number { - /// fn into_nsnumber(self) -> Id { + /// fn into_nsnumber(self) -> Id { /// match self { /// Self::Signed(val) => NSNumber::new_i64(val), /// Self::Unsigned(val) => NSNumber::new_u64(val), diff --git a/crates/icrate/src/Foundation/additions/string.rs b/crates/icrate/src/Foundation/additions/string.rs index a17c1aa25..cec84728c 100644 --- a/crates/icrate/src/Foundation/additions/string.rs +++ b/crates/icrate/src/Foundation/additions/string.rs @@ -32,7 +32,7 @@ impl RefUnwindSafe for NSString {} impl NSString { /// Construct an empty NSString. - pub fn new() -> Id { + pub fn new() -> Id { Self::init(Self::alloc()) } @@ -125,7 +125,7 @@ impl NSString { #[doc(alias = "initWithBytes")] #[doc(alias = "initWithBytes:length:encoding:")] #[allow(clippy::should_implement_trait)] // Not really sure of a better name - pub fn from_str(string: &str) -> Id { + pub fn from_str(string: &str) -> Id { unsafe { let obj = from_str(Self::class(), string); Id::new(obj.cast()).unwrap() diff --git a/crates/icrate/src/Foundation/additions/thread.rs b/crates/icrate/src/Foundation/additions/thread.rs index 3705770b3..a20da7235 100644 --- a/crates/icrate/src/Foundation/additions/thread.rs +++ b/crates/icrate/src/Foundation/additions/thread.rs @@ -16,7 +16,7 @@ impl RefUnwindSafe for NSThread {} extern_methods!( unsafe impl NSThread { #[method_id(new)] - unsafe fn new() -> Id; + unsafe fn new() -> Id; } ); diff --git a/crates/icrate/src/Foundation/additions/uuid.rs b/crates/icrate/src/Foundation/additions/uuid.rs index 3caa6605e..90050b440 100644 --- a/crates/icrate/src/Foundation/additions/uuid.rs +++ b/crates/icrate/src/Foundation/additions/uuid.rs @@ -16,7 +16,7 @@ impl RefUnwindSafe for NSUUID {} impl NSUUID { /// The 'nil UUID'. - pub fn nil() -> Id { + pub fn nil() -> Id { Self::from_bytes([0; 16]) } @@ -36,13 +36,13 @@ impl NSUUID { /// let obj = NSUUID::from_bytes(uuid.into_bytes()); /// assert_eq!(obj.as_bytes(), uuid.into_bytes()); /// ``` - pub fn from_bytes(bytes: [u8; 16]) -> Id { + pub fn from_bytes(bytes: [u8; 16]) -> Id { let bytes = UuidBytes(bytes); Self::initWithUUIDBytes(Self::alloc(), &bytes) } #[cfg(feature = "Foundation_NSString")] - pub fn from_string(string: &Foundation::NSString) -> Option> { + pub fn from_string(string: &Foundation::NSString) -> Option> { Self::initWithUUIDString(Self::alloc(), string) } diff --git a/crates/icrate/src/Foundation/additions/value.rs b/crates/icrate/src/Foundation/additions/value.rs index 00af0cf0f..5a312b70e 100644 --- a/crates/icrate/src/Foundation/additions/value.rs +++ b/crates/icrate/src/Foundation/additions/value.rs @@ -33,7 +33,7 @@ impl NSValue { /// ``` /// /// [`NSPoint`]: crate::Foundation::NSPoint - pub fn new(value: T) -> Id { + pub fn new(value: T) -> Id { let bytes: NonNull = NonNull::from(&value); let encoding = CString::new(T::ENCODING.to_string()).unwrap(); unsafe { diff --git a/crates/icrate/src/Foundation/fixes/NSUUID.rs b/crates/icrate/src/Foundation/fixes/NSUUID.rs index b472a5f8d..c08516fbb 100644 --- a/crates/icrate/src/Foundation/fixes/NSUUID.rs +++ b/crates/icrate/src/Foundation/fixes/NSUUID.rs @@ -22,7 +22,7 @@ extern_methods!( pub(crate) fn initWithUUIDBytes( this: Option>, bytes: &UuidBytes, - ) -> Id; + ) -> Id; #[method(getUUIDBytes:)] pub(crate) fn getUUIDBytes(&self, bytes: &mut UuidBytes); diff --git a/crates/icrate/src/Foundation/fixes/generic_return.rs b/crates/icrate/src/Foundation/fixes/generic_return.rs index 0f3620e2e..f212ad72f 100644 --- a/crates/icrate/src/Foundation/fixes/generic_return.rs +++ b/crates/icrate/src/Foundation/fixes/generic_return.rs @@ -12,7 +12,7 @@ extern_methods!( pub unsafe fn initWithContentsOfURL_error( this: Option>, url: &Foundation::NSURL, - ) -> Result, Id>; + ) -> Result, Id>; } ); @@ -27,14 +27,14 @@ extern_methods!( pub unsafe fn initWithContentsOfFile( this: Option>, path: &Foundation::NSString, - ) -> Option>; + ) -> Option>; #[cfg(feature = "Foundation_NSURL")] #[method_id(initWithContentsOfURL:)] pub unsafe fn initWithContentsOfURL( this: Option>, url: &Foundation::NSURL, - ) -> Option>; + ) -> Option>; } ); @@ -49,14 +49,14 @@ extern_methods!( pub unsafe fn initWithContentsOfFile( this: Option>, path: &Foundation::NSString, - ) -> Option>; + ) -> Option>; #[cfg(feature = "Foundation_NSURL")] #[method_id(initWithContentsOfURL:)] pub unsafe fn initWithContentsOfURL( this: Option>, url: &Foundation::NSURL, - ) -> Option>; + ) -> Option>; } ); @@ -75,14 +75,14 @@ extern_methods!( pub unsafe fn initWithContentsOfFile( this: Option>, path: &Foundation::NSString, - ) -> Option>; + ) -> Option>; #[cfg(feature = "Foundation_NSURL")] #[method_id(initWithContentsOfURL:)] pub unsafe fn initWithContentsOfURL( this: Option>, url: &Foundation::NSURL, - ) -> Option>; + ) -> Option>; } ); @@ -102,13 +102,13 @@ extern_methods!( pub unsafe fn initWithContentsOfFile( this: Option>, path: &Foundation::NSString, - ) -> Option>; + ) -> Option>; #[cfg(feature = "Foundation_NSURL")] #[method_id(initWithContentsOfURL:)] pub unsafe fn initWithContentsOfURL( this: Option>, url: &Foundation::NSURL, - ) -> Option>; + ) -> Option>; } ); diff --git a/crates/icrate/src/Metal/device.rs b/crates/icrate/src/Metal/device.rs index 45c32e195..ac7932e9b 100644 --- a/crates/icrate/src/Metal/device.rs +++ b/crates/icrate/src/Metal/device.rs @@ -6,7 +6,7 @@ impl Metal::MTLDevice { // MTLCreateSystemDefaultDevice() // } // - // pub fn all() -> Id, Shared> { + // pub fn all() -> Id> { // #[cfg(target_os = "macos")] // MTLCopyAllDevices() // #[cfg(not(target_os = "macos"))] diff --git a/crates/icrate/src/Metal/private.rs b/crates/icrate/src/Metal/private.rs index 94a32d526..a27590843 100644 --- a/crates/icrate/src/Metal/private.rs +++ b/crates/icrate/src/Metal/private.rs @@ -13,11 +13,11 @@ extern_methods!( unsafe impl Metal::MTLDevice { #[method_id(vendorName)] #[cfg(feature = "Foundation_NSString")] - pub unsafe fn vendorName(&self) -> Id; + pub unsafe fn vendorName(&self) -> Id; #[method_id(familyName)] #[cfg(feature = "Foundation_NSString")] - pub unsafe fn familyName(&self) -> Id; + pub unsafe fn familyName(&self) -> Id; } ); @@ -34,14 +34,14 @@ extern_methods!( device: &Metal::MTLDevice, options: u64, flags: u64, - ) -> Option>; + ) -> Option>; #[cfg(feature = "Foundation_NSError")] #[method_id(newSerializedVertexDataWithFlags:error:_)] pub unsafe fn newSerializedVertexDataWithFlags_error( &self, flags: u64, - ) -> Result, Id>; + ) -> Result, Id>; #[method(serializeFragmentData)] pub unsafe fn serializeFragmentData(&self) -> *mut c_void; @@ -60,6 +60,6 @@ extern_methods!( #[cfg(feature = "Metal_MTLVertexDescriptor")] unsafe impl Metal::MTLVertexDescriptor { #[method_id(newSerializedDescriptor)] - pub unsafe fn newSerializedDescriptor(&self) -> Option>; + pub unsafe fn newSerializedDescriptor(&self) -> Option>; } ); diff --git a/crates/icrate/src/WebKit/fixes.rs b/crates/icrate/src/WebKit/fixes.rs index 85e351279..0eabbfd04 100644 --- a/crates/icrate/src/WebKit/fixes.rs +++ b/crates/icrate/src/WebKit/fixes.rs @@ -7,6 +7,6 @@ extern_methods!( unsafe impl WKNavigationAction { #[cfg(feature = "WebKit_WKFrameInfo")] #[method_id(@__retain_semantics Other sourceFrame)] - pub unsafe fn sourceFrame(&self) -> Option>; + pub unsafe fn sourceFrame(&self) -> Option>; } ); diff --git a/crates/icrate/src/generated b/crates/icrate/src/generated index 33587b88b..4335b8e03 160000 --- a/crates/icrate/src/generated +++ b/crates/icrate/src/generated @@ -1 +1 @@ -Subproject commit 33587b88b1d03e21580cf249892be0dd55e3561b +Subproject commit 4335b8e0333c5923bbcd2a451eea1ebc9a0388a5 diff --git a/crates/icrate/tests/array.rs b/crates/icrate/tests/array.rs index 5f686a2ac..2d5738d4b 100644 --- a/crates/icrate/tests/array.rs +++ b/crates/icrate/tests/array.rs @@ -12,7 +12,7 @@ fn sample_array(len: usize) -> Id, Owned> { NSArray::from_vec(vec) } -fn sample_number_array(len: u8) -> Id, Shared> { +fn sample_number_array(len: u8) -> Id> { let mut vec = Vec::with_capacity(len as usize); for i in 0..len { vec.push(NSNumber::new_u8(i)); diff --git a/crates/icrate/tests/dictionary.rs b/crates/icrate/tests/dictionary.rs index 354d973a0..2de37cebb 100644 --- a/crates/icrate/tests/dictionary.rs +++ b/crates/icrate/tests/dictionary.rs @@ -1,10 +1,10 @@ #![cfg(feature = "Foundation_NSDictionary")] #![cfg(feature = "Foundation_NSString")] -use objc2::rc::{autoreleasepool, Id, Shared}; +use objc2::rc::{autoreleasepool, Id}; use icrate::Foundation::{NSDictionary, NSObject, NSString}; -fn sample_dict(key: &str) -> Id, Shared> { +fn sample_dict(key: &str) -> Id> { let string = NSString::from_str(key); let obj = NSObject::new(); NSDictionary::from_keys_and_objects(&[&*string], vec![obj]) diff --git a/crates/objc2/CHANGELOG.md b/crates/objc2/CHANGELOG.md index f084dee7a..1c0d2875a 100644 --- a/crates/objc2/CHANGELOG.md +++ b/crates/objc2/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased - YYYY-MM-DD +### Changed +* Made the default ownership in `Id` be `Shared`. This means that you can now + write `Id`, and it'll mean `Id`. + ## 0.3.0-beta.5 - 2023-02-07 diff --git a/crates/objc2/README.md b/crates/objc2/README.md index 2f186ba39..f6b8a8b7c 100644 --- a/crates/objc2/README.md +++ b/crates/objc2/README.md @@ -19,11 +19,11 @@ more thorough overview. ```rust use objc2::ffi::NSUInteger; -use objc2::rc::{Id, Owned}; +use objc2::rc::Id; use objc2::runtime::NSObject; use objc2::{msg_send, msg_send_id, ClassType}; -let obj: Id = unsafe { msg_send_id![NSObject::class(), new] }; +let obj: Id = unsafe { msg_send_id![NSObject::class(), new] }; let hash: NSUInteger = unsafe { msg_send![&obj, hash] }; println!("NSObject hash: {}", hash); diff --git a/crates/objc2/benches/autorelease.rs b/crates/objc2/benches/autorelease.rs index fc69662fa..8050be5b8 100644 --- a/crates/objc2/benches/autorelease.rs +++ b/crates/objc2/benches/autorelease.rs @@ -1,7 +1,7 @@ use core::ffi::c_void; use std::mem::ManuallyDrop; -use objc2::rc::{autoreleasepool, Id, Shared}; +use objc2::rc::{autoreleasepool, Id}; use objc2::runtime::{Class, Object, Sel}; use objc2::{class, msg_send, sel}; @@ -29,13 +29,13 @@ fn alloc_nsobject() -> *mut Object { unsafe { msg_send![class!(NSObject), alloc] } } -fn new_nsobject() -> Id { +fn new_nsobject() -> Id { let obj = alloc_nsobject(); let obj: *mut Object = unsafe { msg_send![obj, init] }; unsafe { Id::new(obj).unwrap_unchecked() } } -fn new_nsdata() -> Id { +fn new_nsdata() -> Id { let bytes_ptr = BYTES.as_ptr() as *const c_void; let obj: *mut Object = unsafe { msg_send![class!(NSData), alloc] }; let obj: *mut Object = unsafe { @@ -64,7 +64,7 @@ fn autoreleased_nsdata() -> *const Object { unsafe { msg_send![new_leaked_nsdata(), autorelease] } } -fn new_nsstring() -> Id { +fn new_nsstring() -> Id { let obj: *mut Object = unsafe { msg_send![class!(NSString), alloc] }; let obj: *mut Object = unsafe { msg_send![obj, init] }; unsafe { Id::new(obj).unwrap_unchecked() } @@ -79,7 +79,7 @@ fn autoreleased_nsstring() -> *const Object { unsafe { msg_send![new_leaked_nsstring(), autorelease] } } -fn retain_autoreleased(obj: *const Object) -> Id { +fn retain_autoreleased(obj: *const Object) -> Id { unsafe { Id::retain_autoreleased((obj as *mut Object).cast()).unwrap_unchecked() } } @@ -87,11 +87,11 @@ fn autoreleased_nsdata_pool_cleanup() -> *const Object { autoreleasepool(|_| autoreleased_nsdata()) } -fn autoreleased_nsdata_fast_caller_cleanup() -> Id { +fn autoreleased_nsdata_fast_caller_cleanup() -> Id { retain_autoreleased(autoreleased_nsdata()) } -fn autoreleased_nsdata_fast_caller_cleanup_pool_cleanup() -> Id { +fn autoreleased_nsdata_fast_caller_cleanup_pool_cleanup() -> Id { autoreleasepool(|_| retain_autoreleased(autoreleased_nsdata())) } @@ -99,11 +99,11 @@ fn autoreleased_nsstring_pool_cleanup() -> *const Object { autoreleasepool(|_| autoreleased_nsstring()) } -fn autoreleased_nsstring_fast_caller_cleanup() -> Id { +fn autoreleased_nsstring_fast_caller_cleanup() -> Id { retain_autoreleased(autoreleased_nsstring()) } -fn autoreleased_nsstring_fast_caller_cleanup_pool_cleanup() -> Id { +fn autoreleased_nsstring_fast_caller_cleanup_pool_cleanup() -> Id { autoreleasepool(|_| retain_autoreleased(autoreleased_nsstring())) } diff --git a/crates/objc2/src/__macro_helpers.rs b/crates/objc2/src/__macro_helpers.rs index 0b9119012..c11c0503f 100644 --- a/crates/objc2/src/__macro_helpers.rs +++ b/crates/objc2/src/__macro_helpers.rs @@ -8,7 +8,7 @@ use crate::declare::ClassBuilder; use crate::declare::MethodImplementation; use crate::encode::Encode; use crate::message::__TupleExtender; -use crate::rc::{Allocated, Id, Ownership, Shared}; +use crate::rc::{Allocated, Id, Ownership}; #[cfg(all(debug_assertions, feature = "verify"))] use crate::runtime::MethodDescription; use crate::runtime::{Class, Object, Protocol, Sel}; @@ -116,7 +116,7 @@ pub trait MsgSendId { /// `send_message_id` with that, and return an error if one occurred. #[inline] #[track_caller] - unsafe fn send_message_id_error(obj: T, sel: Sel, args: A) -> Result> + unsafe fn send_message_id_error(obj: T, sel: Sel, args: A) -> Result> where *mut *mut E: Encode, A: __TupleExtender<*mut *mut E>, @@ -158,7 +158,7 @@ pub trait MsgSendId { // And intentionally not inlined, for much the same reason. #[cold] #[track_caller] -unsafe fn encountered_error(err: *mut E) -> Id { +unsafe fn encountered_error(err: *mut E) -> Id { // SAFETY: Ensured by caller unsafe { Id::retain(err) }.expect("error parameter should be set if the method returns NULL") } @@ -639,14 +639,14 @@ mod tests { #[cfg(feature = "objc2-proc-macros")] use crate::__hash_idents; - use crate::rc::{Owned, Shared, __RcTestObject, __ThreadTestData}; + use crate::rc::{__RcTestObject, __ThreadTestData}; use crate::runtime::{NSObject, NSZone, Object}; use crate::{class, msg_send_id, ClassType}; #[test] fn test_new() { - let _obj: Id = unsafe { msg_send_id![NSObject::class(), new] }; - let _obj: Option> = unsafe { msg_send_id![NSObject::class(), new] }; + let _obj: Id = unsafe { msg_send_id![NSObject::class(), new] }; + let _obj: Option> = unsafe { msg_send_id![NSObject::class(), new] }; } #[test] @@ -654,8 +654,8 @@ mod tests { let mut expected = __ThreadTestData::current(); let obj = __RcTestObject::new(); - let _obj: Id = unsafe { msg_send_id![&obj, newMethodOnInstance] }; - let _obj: Option> = unsafe { msg_send_id![&obj, newMethodOnInstance] }; + let _obj: Id = unsafe { msg_send_id![&obj, newMethodOnInstance] }; + let _obj: Option> = unsafe { msg_send_id![&obj, newMethodOnInstance] }; expected.alloc += 3; expected.init += 3; expected.assert_current(); @@ -668,11 +668,11 @@ mod tests { let mut expected = __ThreadTestData::current(); let object_class = __RcTestObject::class(); - let key: Id = unsafe { msg_send_id![class!(NSString), new] }; + let key: Id = unsafe { msg_send_id![class!(NSString), new] }; let contents_value: *const Object = ptr::null(); - let properties: Id = unsafe { msg_send_id![class!(NSDictionary), new] }; + let properties: Id = unsafe { msg_send_id![class!(NSDictionary), new] }; - let _obj: Option> = unsafe { + let _obj: Option> = unsafe { msg_send_id![ NSObject::class(), newScriptingObjectOfClass: object_class, @@ -720,7 +720,7 @@ mod tests { let obj: Option> = unsafe { msg_send_id![cls, alloc] }; expected.alloc += 1; // Don't check allocation error - let _obj: Id<__RcTestObject, Shared> = unsafe { msg_send_id![obj, init] }; + let _obj: Id<__RcTestObject> = unsafe { msg_send_id![obj, init] }; expected.init += 1; expected.assert_current(); @@ -728,7 +728,7 @@ mod tests { expected.alloc += 1; // Check allocation error before init let obj = obj.unwrap(); - let _obj: Id<__RcTestObject, Shared> = unsafe { msg_send_id![Some(obj), init] }; + let _obj: Id<__RcTestObject> = unsafe { msg_send_id![Some(obj), init] }; expected.init += 1; expected.assert_current(); } @@ -738,7 +738,7 @@ mod tests { let mut expected = __ThreadTestData::current(); let cls = __RcTestObject::class(); crate::rc::autoreleasepool(|_| { - let _obj: Id<__RcTestObject, Owned> = unsafe { msg_send_id![cls, new] }; + let _obj: Id<__RcTestObject> = unsafe { msg_send_id![cls, new] }; expected.alloc += 1; expected.init += 1; expected.assert_current(); @@ -747,29 +747,27 @@ mod tests { expected.alloc += 1; expected.assert_current(); - let obj: Id<__RcTestObject, Owned> = unsafe { msg_send_id![obj, init] }; + let obj: Id<__RcTestObject> = unsafe { msg_send_id![obj, init] }; expected.init += 1; expected.assert_current(); - let _copy: Id<__RcTestObject, Shared> = unsafe { msg_send_id![&obj, copy] }; + let _copy: Id<__RcTestObject> = unsafe { msg_send_id![&obj, copy] }; expected.copy += 1; expected.alloc += 1; expected.init += 1; expected.assert_current(); - let _mutable_copy: Id<__RcTestObject, Shared> = - unsafe { msg_send_id![&obj, mutableCopy] }; + let _mutable_copy: Id<__RcTestObject> = unsafe { msg_send_id![&obj, mutableCopy] }; expected.mutable_copy += 1; expected.alloc += 1; expected.init += 1; expected.assert_current(); - let _self: Id<__RcTestObject, Shared> = unsafe { msg_send_id![&obj, self] }; + let _self: Id<__RcTestObject> = unsafe { msg_send_id![&obj, self] }; expected.retain += 1; expected.assert_current(); - let _desc: Option> = - unsafe { msg_send_id![&obj, description] }; + let _desc: Option> = unsafe { msg_send_id![&obj, description] }; expected.assert_current(); }); expected.release += 5; @@ -782,13 +780,13 @@ mod tests { // GNUStep instead returns an invalid instance that panics on accesses #[cfg_attr(feature = "gnustep-1-7", ignore)] fn new_nsvalue_fails() { - let _val: Id = unsafe { msg_send_id![class!(NSValue), new] }; + let _val: Id = unsafe { msg_send_id![class!(NSValue), new] }; } #[test] #[should_panic = "failed creating new instance using +[__RcTestObject newReturningNull]"] fn test_new_with_null() { - let _obj: Id<__RcTestObject, Owned> = + let _obj: Id<__RcTestObject> = unsafe { msg_send_id![__RcTestObject::class(), newReturningNull] }; } @@ -796,7 +794,7 @@ mod tests { #[should_panic = "unexpected NULL returned from -[__RcTestObject newMethodOnInstanceNull]"] fn test_new_any_with_null() { let obj = __RcTestObject::new(); - let _obj: Id = unsafe { msg_send_id![&obj, newMethodOnInstanceNull] }; + let _obj: Id = unsafe { msg_send_id![&obj, newMethodOnInstanceNull] }; } #[test] @@ -804,7 +802,7 @@ mod tests { #[cfg(not(debug_assertions))] // Does NULL receiver checks fn test_new_any_with_null_receiver() { let obj: *const NSObject = ptr::null(); - let _obj: Id = unsafe { msg_send_id![obj, newMethodOnInstance] }; + let _obj: Id = unsafe { msg_send_id![obj, newMethodOnInstance] }; } #[test] @@ -819,7 +817,7 @@ mod tests { fn test_init_with_null() { let obj: Option> = unsafe { msg_send_id![__RcTestObject::class(), alloc] }; - let _obj: Id<__RcTestObject, Owned> = unsafe { msg_send_id![obj, initReturningNull] }; + let _obj: Id<__RcTestObject> = unsafe { msg_send_id![obj, initReturningNull] }; } #[test] @@ -827,28 +825,28 @@ mod tests { #[cfg(not(debug_assertions))] // Does NULL receiver checks fn test_init_with_null_receiver() { let obj: Option> = None; - let _obj: Id<__RcTestObject, Owned> = unsafe { msg_send_id![obj, init] }; + let _obj: Id<__RcTestObject> = unsafe { msg_send_id![obj, init] }; } #[test] #[should_panic = "failed copying object"] fn test_copy_with_null() { let obj = Id::into_shared(__RcTestObject::new()); - let _obj: Id<__RcTestObject, Shared> = unsafe { msg_send_id![&obj, copyReturningNull] }; + let _obj: Id<__RcTestObject> = unsafe { msg_send_id![&obj, copyReturningNull] }; } #[test] #[should_panic = "unexpected NULL returned from -[__RcTestObject methodReturningNull]"] fn test_normal_with_null() { let obj = Id::into_shared(__RcTestObject::new()); - let _obj: Id<__RcTestObject, Shared> = unsafe { msg_send_id![&obj, methodReturningNull] }; + let _obj: Id<__RcTestObject> = unsafe { msg_send_id![&obj, methodReturningNull] }; } #[test] #[should_panic = "unexpected NULL returned from -[__RcTestObject aMethod:]"] fn test_normal_with_param_and_null() { let obj = Id::into_shared(__RcTestObject::new()); - let _obj: Id<__RcTestObject, Shared> = unsafe { msg_send_id![&obj, aMethod: false] }; + let _obj: Id<__RcTestObject> = unsafe { msg_send_id![&obj, aMethod: false] }; } #[test] @@ -856,7 +854,7 @@ mod tests { #[cfg(not(debug_assertions))] // Does NULL receiver checks fn test_normal_with_null_receiver() { let obj: *const NSObject = ptr::null(); - let _obj: Id = unsafe { msg_send_id![obj, description] }; + let _obj: Id = unsafe { msg_send_id![obj, description] }; } #[test] @@ -970,7 +968,7 @@ mod tests { #[test] fn test_macro_still_works() { let cls = class!(NSObject); - let _obj: Id = unsafe { msg_send_id![cls, new] }; + let _obj: Id = unsafe { msg_send_id![cls, new] }; } } diff --git a/crates/objc2/src/declare.rs b/crates/objc2/src/declare.rs index ffb35d484..ed87acd5a 100644 --- a/crates/objc2/src/declare.rs +++ b/crates/objc2/src/declare.rs @@ -96,14 +96,14 @@ //! // with `std::sync::Once` or the `once_cell` crate. //! let cls = register_class(); //! -//! let obj: Id = unsafe { +//! let mut obj: Id = unsafe { //! msg_send_id![cls, withNumber: 42u32] //! }; //! //! let n: u32 = unsafe { msg_send![&obj, number] }; //! assert_eq!(n, 42); //! -//! let _: () = unsafe { msg_send![&obj, setNumber: 12u32] }; +//! let _: () = unsafe { msg_send![&mut obj, setNumber: 12u32] }; //! let n: u32 = unsafe { msg_send![&obj, number] }; //! assert_eq!(n, 12); //! ``` @@ -692,7 +692,7 @@ impl ProtocolBuilder { #[cfg(test)] mod tests { use super::*; - use crate::rc::{Id, Shared}; + use crate::rc::Id; use crate::runtime::{NSObject, NSZone}; use crate::test_utils; use crate::{declare_class, extern_protocol, msg_send, ClassType, ProtocolType}; @@ -701,7 +701,7 @@ mod tests { #[allow(clippy::missing_safety_doc)] unsafe trait NSCopying { #[method_id(copyWithZone:)] - fn copy_with_zone(&self, _zone: *const NSZone) -> Id; + fn copy_with_zone(&self, _zone: *const NSZone) -> Id; } unsafe impl ProtocolType for dyn NSCopying { @@ -878,7 +878,7 @@ mod tests { unsafe impl NSCopying for Custom { #[method_id(copyWithZone:)] - fn copy_with_zone(&self, _zone: *const NSZone) -> Id { + fn copy_with_zone(&self, _zone: *const NSZone) -> Id { unimplemented!() } } @@ -973,7 +973,7 @@ mod tests { unsafe impl NSCopying for Custom { #[method_id(copyWithZone:)] - fn copy_with_zone(&self, _zone: *const NSZone) -> Id { + fn copy_with_zone(&self, _zone: *const NSZone) -> Id { unimplemented!() } diff --git a/crates/objc2/src/declare/declare_class_tests.rs b/crates/objc2/src/declare/declare_class_tests.rs index 6a3668f2b..971f0dca8 100644 --- a/crates/objc2/src/declare/declare_class_tests.rs +++ b/crates/objc2/src/declare/declare_class_tests.rs @@ -2,7 +2,7 @@ use core::ptr; use crate::declare::IvarEncode; -use crate::rc::{Id, Owned, Shared}; +use crate::rc::{Id, Owned}; use crate::runtime::NSObject; use crate::{declare_class, extern_methods, sel, ClassType}; @@ -106,7 +106,7 @@ declare_class!( extern_methods!( unsafe impl DeclareClassCfg { #[method_id(new)] - fn new() -> Id; + fn new() -> Id; } unsafe impl DeclareClassCfg { @@ -211,7 +211,7 @@ declare_class!( _arg2: i32, _arg3: i32, _obj: *const Self, - ) -> Option> { + ) -> Option> { None } } @@ -220,7 +220,7 @@ declare_class!( extern_methods!( unsafe impl TestMultipleColonSelector { #[method_id(new)] - fn new() -> Id; + fn new() -> Id; #[method(test::arg3:)] fn test_class(arg1: i32, arg2: i32, arg3: i32) -> i32; @@ -229,7 +229,7 @@ extern_methods!( fn test_instance(&self, arg1: i32, arg2: i32, arg3: i32) -> i32; #[method(test::error:_)] - fn test_error(&self, arg1: i32, arg2: i32) -> Result<(), Id>; + fn test_error(&self, arg1: i32, arg2: i32) -> Result<(), Id>; #[method_id(test:::withObject:)] fn test_object( @@ -238,7 +238,7 @@ extern_methods!( arg2: i32, arg3: i32, obj: *const Self, - ) -> Option>; + ) -> Option>; } ); @@ -298,12 +298,12 @@ declare_class!( } #[method_id(idTakesBool:)] - fn id_takes_bool(_b: bool) -> Option> { + fn id_takes_bool(_b: bool) -> Option> { None } #[method_id(idTakesBoolInstance:)] - fn id_takes_bool_instance(&self, _b: bool) -> Option> { + fn id_takes_bool_instance(&self, _b: bool) -> Option> { None } } @@ -345,12 +345,12 @@ declare_class!( } #[method_id(unreachableId)] - fn unreachable_id(&self) -> Id { + fn unreachable_id(&self) -> Id { unreachable!() } #[method_id(unreachableClassId)] - fn unreachable_class_id() -> Id { + fn unreachable_class_id() -> Id { unreachable!() } } @@ -455,16 +455,16 @@ declare_class!( unsafe impl OutParam { #[method(unsupported1:)] - fn _unsupported1(_param: &mut Id) {} + fn _unsupported1(_param: &mut Id) {} #[method(unsupported2:)] - fn _unsupported2(_param: Option<&mut Id>) {} + fn _unsupported2(_param: Option<&mut Id>) {} #[method(unsupported3:)] - fn _unsupported3(_param: &mut Option>) {} + fn _unsupported3(_param: &mut Option>) {} #[method(unsupported4:)] - fn _unsupported4(_param: Option<&mut Option>>) {} + fn _unsupported4(_param: Option<&mut Option>>) {} } ); @@ -475,19 +475,19 @@ mod out_param { extern_methods!( unsafe impl OutParam { #[method_id(new)] - fn new() -> Id; + fn new() -> Id; #[method(unsupported1:)] - fn unsupported1(_param: &mut Id); + fn unsupported1(_param: &mut Id); #[method(unsupported2:)] - fn unsupported2(_param: Option<&mut Id>); + fn unsupported2(_param: Option<&mut Id>); #[method(unsupported3:)] - fn unsupported3(_param: &mut Option>); + fn unsupported3(_param: &mut Option>); #[method(unsupported4:)] - fn unsupported4(_param: Option<&mut Option>>); + fn unsupported4(_param: Option<&mut Option>>); } ); diff --git a/crates/objc2/src/declare/ivar.rs b/crates/objc2/src/declare/ivar.rs index a39785bfb..34865ed9e 100644 --- a/crates/objc2/src/declare/ivar.rs +++ b/crates/objc2/src/declare/ivar.rs @@ -318,7 +318,7 @@ mod tests { use super::*; use crate::declare::{IvarBool, IvarEncode}; - use crate::rc::{Id, Owned}; + use crate::rc::Id; use crate::runtime::NSObject; use crate::{declare_class, msg_send, msg_send_id, test_utils, ClassType, MessageReceiver}; @@ -384,7 +384,7 @@ mod tests { } } - let _: Id = unsafe { msg_send_id![CustomDrop::class(), new] }; + let _: Id = unsafe { msg_send_id![CustomDrop::class(), new] }; assert!(HAS_RUN_DEALLOC.load(Ordering::Relaxed)); } diff --git a/crates/objc2/src/declare/ivar_drop.rs b/crates/objc2/src/declare/ivar_drop.rs index 5c1ded74d..af030c383 100644 --- a/crates/objc2/src/declare/ivar_drop.rs +++ b/crates/objc2/src/declare/ivar_drop.rs @@ -204,7 +204,7 @@ unsafe fn box_unreachable() -> ! { mod tests { use super::*; use crate::declare::{Ivar, IvarType}; - use crate::rc::{Allocated, Owned, Shared, __RcTestObject, __ThreadTestData}; + use crate::rc::{Allocated, Owned, __RcTestObject, __ThreadTestData}; use crate::runtime::NSObject; use crate::runtime::Object; use crate::{declare_class, msg_send, msg_send_id, ClassType}; @@ -223,7 +223,7 @@ mod tests { struct TestIvar3; unsafe impl IvarType for TestIvar3 { - type Type = IvarDrop>; + type Type = IvarDrop>; const NAME: &'static str = "_abc"; } @@ -236,7 +236,7 @@ mod tests { declare_class!( #[derive(Debug, PartialEq, Eq)] struct IvarTester { - ivar1: IvarDrop, "_ivar1">, + ivar1: IvarDrop, "_ivar1">, ivar2: IvarDrop>, "_ivar2">, ivar3: IvarDrop>, "_ivar3">, ivar4: IvarDrop>>, "_ivar4">, @@ -275,7 +275,7 @@ mod tests { declare_class!( #[derive(Debug, PartialEq, Eq)] struct IvarTesterSubclass { - ivar5: IvarDrop, "_ivar5">, + ivar5: IvarDrop, "_ivar5">, } mod ivartestersubclass; diff --git a/crates/objc2/src/exception.rs b/crates/objc2/src/exception.rs index c1d931cf6..584679641 100644 --- a/crates/objc2/src/exception.rs +++ b/crates/objc2/src/exception.rs @@ -35,7 +35,7 @@ use std::error::Error; use crate::encode::{Encoding, RefEncode}; #[cfg(feature = "exception")] use crate::ffi; -use crate::rc::{autoreleasepool, Id, Shared}; +use crate::rc::{autoreleasepool, Id}; use crate::runtime::__nsstring::nsstring_to_str; use crate::runtime::{Class, NSObject, NSObjectProtocol, Object}; use crate::{extern_methods, sel, Message}; @@ -91,12 +91,12 @@ extern_methods!( // Only safe on NSException // Returns NSString #[method_id(name)] - unsafe fn name(&self) -> Option>; + unsafe fn name(&self) -> Option>; // Only safe on NSException // Returns NSString #[method_id(reason)] - unsafe fn reason(&self) -> Option>; + unsafe fn reason(&self) -> Option>; } ); @@ -185,7 +185,7 @@ impl RefUnwindSafe for Exception {} /// [RFC-2945]: https://rust-lang.github.io/rfcs/2945-c-unwind-abi.html #[inline] #[cfg(feature = "exception")] // For consistency, not strictly required -pub unsafe fn throw(exception: Id) -> ! { +pub unsafe fn throw(exception: Id) -> ! { let ptr = exception.0.as_ptr() as *mut ffi::objc_object; // SAFETY: Object is valid and non-null (nil exceptions are not valid in // the old runtime). @@ -193,7 +193,7 @@ pub unsafe fn throw(exception: Id) -> ! { } #[cfg(feature = "exception")] -unsafe fn try_no_ret(closure: F) -> Result<(), Option>> { +unsafe fn try_no_ret(closure: F) -> Result<(), Option>> { #[cfg(not(feature = "unstable-c-unwind"))] let f = { extern "C" fn try_objc_execute_closure(closure: &mut Option) @@ -280,7 +280,7 @@ unsafe fn try_no_ret(closure: F) -> Result<(), Option( closure: impl FnOnce() -> R + UnwindSafe, -) -> Result>> { +) -> Result>> { let mut value = None; let value_ref = &mut value; let closure = move || { @@ -333,7 +333,7 @@ mod tests { #[test] fn test_throw_catch_object() { - let obj: Id = unsafe { msg_send_id![NSObject::class(), new] }; + let obj: Id = unsafe { msg_send_id![NSObject::class(), new] }; // TODO: Investigate why this is required on GNUStep! let _obj2 = obj.clone(); let ptr: *const Exception = &*obj; diff --git a/crates/objc2/src/lib.rs b/crates/objc2/src/lib.rs index 10b4e224a..c7a62ee36 100644 --- a/crates/objc2/src/lib.rs +++ b/crates/objc2/src/lib.rs @@ -36,12 +36,12 @@ #![cfg_attr(not(feature = "apple"), doc = "```no_run")] //! use objc2::{msg_send, msg_send_id, ClassType}; //! use objc2::ffi::NSUInteger; -//! use objc2::rc::{Id, Owned, Shared}; +//! use objc2::rc::Id; //! use objc2::runtime::{NSObject, NSObjectProtocol}; //! //! // Creation //! -//! let obj1: Id = unsafe { +//! let obj1: Id = unsafe { //! msg_send_id![NSObject::alloc(), init] //! }; //! // Or we can simply do @@ -58,10 +58,7 @@ //! }; //! assert!(is_kind); //! -//! // We're going to create a new reference to the first object, so -//! // relinquish mutable ownership. -//! let obj1: Id = obj1.into(); -//! let obj1_self: Id = unsafe { msg_send_id![&obj1, self] }; +//! let obj1_self: Id = unsafe { msg_send_id![&obj1, self] }; //! assert_eq!(obj1, obj1_self); //! //! // Deallocation on drop diff --git a/crates/objc2/src/macros.rs b/crates/objc2/src/macros.rs index 69a7b12b9..8366233ef 100644 --- a/crates/objc2/src/macros.rs +++ b/crates/objc2/src/macros.rs @@ -725,7 +725,7 @@ macro_rules! __class_inner { /// All arguments, and the return type, must implement [`Encode`]. /// /// If the last argument is the special marker `_`, the macro will return a -/// `Result<(), Id>`, see below. +/// `Result<(), Id>`, see below. /// /// This macro translates into a call to [`sel!`], and afterwards a fully /// qualified call to [`MessageReceiver::send_message`]. Note that this means @@ -794,8 +794,8 @@ macro_rules! __class_inner { /// returns `BOOL`, into the Rust equivalent, the [`Result`] type. /// /// In particular, if you make the last argument the special marker `_`, then -/// the macro will return a `Result<(), Id>` (where you must -/// specify `E` yourself, usually you'd use `icrate::Foundation::NSError`). +/// the macro will return a `Result<(), Id>` (where you must specify `E` +/// yourself, usually you'd use `icrate::Foundation::NSError`). /// /// At runtime, we create the temporary error variable for you on the stack /// and send it as the out-parameter to the method. If the method then returns @@ -924,14 +924,14 @@ macro_rules! __class_inner { /// /// ```no_run /// use objc2::msg_send; -/// use objc2::rc::{Id, Shared}; +/// use objc2::rc::Id; /// /// # type NSBundle = objc2::runtime::Object; /// # type NSError = objc2::runtime::Object; /// let obj: &NSBundle; /// # obj = todo!(); /// // The `_` tells the macro that the return type should be `Result`. -/// let res: Result<(), Id> = unsafe { +/// let res: Result<(), Id> = unsafe { /// msg_send![obj, preflightAndReturnError: _] /// }; /// ``` @@ -940,7 +940,7 @@ macro_rules! __class_inner { /// /// ```no_run /// use objc2::msg_send; -/// use objc2::rc::{Id, Shared}; +/// use objc2::rc::Id; /// /// # type NSFileManager = objc2::runtime::Object; /// # type NSURL = objc2::runtime::Object; @@ -949,7 +949,7 @@ macro_rules! __class_inner { /// # obj = todo!(); /// let url: &NSURL; /// # url = todo!(); -/// let mut result_url: Option> = None; +/// let mut result_url: Option> = None; /// unsafe { /// msg_send![ /// obj, @@ -962,7 +962,7 @@ macro_rules! __class_inner { /// /// // Use `result_url` here /// -/// # Ok::<(), Id>(()) +/// # Ok::<(), Id>(()) /// ``` #[macro_export] macro_rules! msg_send { @@ -1126,7 +1126,7 @@ macro_rules! msg_send_bool { /// with an error message if it couldn't be retrieved. /// /// Though as a special case, if the last argument is the marker `_`, the -/// macro will return a `Result, Id>`, see below. +/// macro will return a `Result, Id>`, see below. /// /// This macro doesn't support super methods yet, see [#173]. /// The `retain`, `release` and `autorelease` selectors are not supported, use @@ -1149,9 +1149,8 @@ macro_rules! msg_send_bool { /// equivalent, the [`Result`] type. /// /// In particular, you can make the last argument the special marker `_`, and -/// then the macro will return a `Result, Id>` (where you -/// must specify `E` yourself, usually you'd use -/// `icrate::Foundation::NSError`). +/// then the macro will return a `Result, Id>` (where you must +/// specify `E` yourself, usually you'd use `icrate::Foundation::NSError`). /// /// /// # Panics @@ -1189,17 +1188,17 @@ macro_rules! msg_send_bool { /// ```no_run /// use objc2::{class, msg_send_id}; /// use objc2::ffi::NSUInteger; -/// use objc2::rc::{Id, Shared}; +/// use objc2::rc::Id; /// use objc2::runtime::Object; /// // Allocate new object /// let obj = unsafe { msg_send_id![class!(NSObject), alloc] }; /// // Consume the allocated object, return initialized object -/// let obj: Id = unsafe { msg_send_id![obj, init] }; +/// let obj: Id = unsafe { msg_send_id![obj, init] }; /// // Copy the object -/// let copy: Id = unsafe { msg_send_id![&obj, copy] }; +/// let copy: Id = unsafe { msg_send_id![&obj, copy] }; /// // Call ordinary selector that returns an object /// // This time, we handle failures ourselves -/// let s: Option> = unsafe { msg_send_id![&obj, description] }; +/// let s: Option> = unsafe { msg_send_id![&obj, description] }; /// let s = s.expect("description was NULL"); /// ``` #[macro_export] diff --git a/crates/objc2/src/macros/declare_class.rs b/crates/objc2/src/macros/declare_class.rs index bdd50d264..d4392a85c 100644 --- a/crates/objc2/src/macros/declare_class.rs +++ b/crates/objc2/src/macros/declare_class.rs @@ -155,7 +155,7 @@ /// ``` /// use std::os::raw::c_int; /// use objc2::declare::{Ivar, IvarDrop, IvarEncode}; -/// use objc2::rc::{Id, Owned, Shared}; +/// use objc2::rc::{Id, Owned}; /// use objc2::runtime::{NSObject, NSObjectProtocol, NSZone}; /// use objc2::{ /// declare_class, extern_protocol, msg_send, msg_send_id, ClassType, @@ -182,7 +182,7 @@ /// struct MyCustomObject { /// foo: IvarEncode, /// pub bar: IvarEncode, -/// object: IvarDrop, "_object">, +/// object: IvarDrop, "_object">, /// } /// /// mod ivars; @@ -224,7 +224,7 @@ /// } /// /// #[method_id(object)] -/// fn __get_object(&self) -> Id { +/// fn __get_object(&self) -> Id { /// self.object.clone() /// } /// @@ -257,7 +257,7 @@ /// unsafe { msg_send![self, foo] } /// } /// -/// pub fn get_object(&self) -> Id { +/// pub fn get_object(&self) -> Id { /// unsafe { msg_send_id![self, object] } /// } /// @@ -278,7 +278,7 @@ /// assert_eq!(*obj.bar, 42); /// assert!(obj.object.is_kind_of::()); /// -/// let obj: Id = unsafe { +/// let obj: Id = unsafe { /// msg_send_id![&obj, copy] /// }; // Or obj.copy() with `icrate` /// diff --git a/crates/objc2/src/macros/extern_class.rs b/crates/objc2/src/macros/extern_class.rs index a02a18631..6e7f39bf5 100644 --- a/crates/objc2/src/macros/extern_class.rs +++ b/crates/objc2/src/macros/extern_class.rs @@ -64,7 +64,7 @@ /// /// ``` /// use objc2::runtime::NSObject; -/// use objc2::rc::{Id, Shared}; +/// use objc2::rc::Id; /// use objc2::{ClassType, extern_class, msg_send_id}; /// /// extern_class!( @@ -92,7 +92,7 @@ /// let cls = NSFormatter::class(); /// /// // `NSFormatter` implements `Message`: -/// let obj: Id = unsafe { msg_send_id![cls, new] }; +/// let obj: Id = unsafe { msg_send_id![cls, new] }; /// ``` /// /// Represent the `NSDateFormatter` class, using the `NSFormatter` type we diff --git a/crates/objc2/src/macros/extern_methods.rs b/crates/objc2/src/macros/extern_methods.rs index 91dabc89b..aefd7e3df 100644 --- a/crates/objc2/src/macros/extern_methods.rs +++ b/crates/objc2/src/macros/extern_methods.rs @@ -60,7 +60,7 @@ /// ``` /// use objc2::encode::{Encode, Encoding}; /// use objc2::ffi::NSUInteger; -/// use objc2::rc::{Allocated, Id, Shared}; +/// use objc2::rc::{Allocated, Id}; /// use objc2::runtime::NSObject; /// use objc2::{declare_class, extern_methods, ClassType}; /// @@ -84,12 +84,12 @@ /// /// Creation methods. /// unsafe impl MyObject { /// #[method_id(new)] -/// pub fn new() -> Id; +/// pub fn new() -> Id; /// /// #[method_id(initWithVal:)] /// // Arbitary self types are not stable, but we can work around it /// // with the special name `this`. -/// pub fn init(this: Option>, val: usize) -> Id; +/// pub fn init(this: Option>, val: usize) -> Id; /// } /// /// /// Instance accessor methods. @@ -98,12 +98,12 @@ /// pub fn foo(&self) -> NSUInteger; /// /// #[method_id(fooObject)] -/// pub fn foo_object(&self) -> Id; +/// pub fn foo_object(&self) -> Id; /// /// #[method(withError:_)] /// // Since the selector specifies "_", the return type is assumed to /// // be `Result`. -/// pub fn with_error(&self) -> Result<(), Id>; +/// pub fn with_error(&self) -> Result<(), Id>; /// } /// ); /// ``` @@ -113,7 +113,7 @@ /// ``` /// # use objc2::encode::{Encode, Encoding}; /// # use objc2::ffi::NSUInteger; -/// # use objc2::rc::{Allocated, Id, Shared}; +/// # use objc2::rc::{Allocated, Id}; /// # use objc2::runtime::NSObject; /// # use objc2::{declare_class, extern_methods, ClassType}; /// # @@ -137,11 +137,11 @@ /// /// /// Creation methods. /// impl MyObject { -/// pub fn new() -> Id { +/// pub fn new() -> Id { /// unsafe { msg_send_id![Self::class(), new] } /// } /// -/// pub fn init(this: Option>, val: usize) -> Id { +/// pub fn init(this: Option>, val: usize) -> Id { /// unsafe { msg_send_id![this, initWithVal: val] } /// } /// } @@ -152,13 +152,13 @@ /// unsafe { msg_send![self, foo] } /// } /// -/// pub fn foo_object(&self) -> Id { +/// pub fn foo_object(&self) -> Id { /// unsafe { msg_send_id![self, fooObject] } /// } /// /// // Since the selector specifies one more argument than we /// // have, the return type is assumed to be `Result`. -/// pub fn with_error(&self) -> Result<(), Id> { +/// pub fn with_error(&self) -> Result<(), Id> { /// unsafe { msg_send![self, withError: _] } /// } /// } diff --git a/crates/objc2/src/macros/extern_protocol.rs b/crates/objc2/src/macros/extern_protocol.rs index e2db096b5..e40e54dfb 100644 --- a/crates/objc2/src/macros/extern_protocol.rs +++ b/crates/objc2/src/macros/extern_protocol.rs @@ -73,7 +73,7 @@ /// ``` /// use std::ffi::c_void; /// use objc2::ffi::NSInteger; -/// use objc2::rc::{Id, Shared}; +/// use objc2::rc::Id; /// use objc2::runtime::{NSObject, NSObjectProtocol}; /// use objc2::{extern_protocol, ProtocolType}; /// @@ -96,11 +96,11 @@ /// &self, /// type_identifier: &NSString, /// completion_handler: *mut c_void, -/// ) -> Option>; +/// ) -> Option>; /// /// #[method_id(writableTypeIdentifiersForItemProvider)] /// fn writableTypeIdentifiersForItemProvider_class() -/// -> Id, Shared>; +/// -> Id>; /// /// // The rest of these are optional, which means that a user of /// // `declare_class!` would not need to implement them. @@ -108,7 +108,7 @@ /// #[optional] /// #[method_id(writableTypeIdentifiersForItemProvider)] /// fn writableTypeIdentifiersForItemProvider(&self) -/// -> Id, Shared>; +/// -> Id>; /// /// #[optional] /// #[method(itemProviderVisibilityForRepresentationWithTypeIdentifier:)] diff --git a/crates/objc2/src/message/mod.rs b/crates/objc2/src/message/mod.rs index b38442967..4bef34edf 100644 --- a/crates/objc2/src/message/mod.rs +++ b/crates/objc2/src/message/mod.rs @@ -6,7 +6,7 @@ use crate::encode::__unstable::{ EncodeArguments, EncodeConvertArgument, EncodeConvertReturn, EncodeReturn, }; use crate::encode::{Encode, RefEncode}; -use crate::rc::{Id, Owned, Ownership, Shared}; +use crate::rc::{Id, Owned, Ownership}; use crate::runtime::{Class, Imp, Object, Sel}; use crate::ClassType; @@ -298,7 +298,7 @@ pub unsafe trait MessageReceiver: private::Sealed + Sized { #[inline] #[track_caller] #[doc(hidden)] - unsafe fn __send_message_error(self, sel: Sel, args: A) -> Result<(), Id> + unsafe fn __send_message_error(self, sel: Sel, args: A) -> Result<(), Id> where *mut *mut E: Encode, A: __TupleExtender<*mut *mut E>, @@ -323,7 +323,7 @@ pub unsafe trait MessageReceiver: private::Sealed + Sized { superclass: &Class, sel: Sel, args: A, - ) -> Result<(), Id> + ) -> Result<(), Id> where *mut *mut E: Encode, A: __TupleExtender<*mut *mut E>, @@ -343,11 +343,7 @@ pub unsafe trait MessageReceiver: private::Sealed + Sized { #[inline] #[track_caller] #[doc(hidden)] - unsafe fn __send_super_message_static_error( - self, - sel: Sel, - args: A, - ) -> Result<(), Id> + unsafe fn __send_super_message_static_error(self, sel: Sel, args: A) -> Result<(), Id> where Self::__Inner: ClassType, ::Super: ClassType, @@ -369,7 +365,7 @@ pub unsafe trait MessageReceiver: private::Sealed + Sized { #[cold] #[track_caller] -unsafe fn encountered_error(err: *mut E) -> Id { +unsafe fn encountered_error(err: *mut E) -> Id { // SAFETY: Ensured by caller unsafe { Id::retain(err) }.expect("error parameter should be set if the method returns NO") } @@ -701,12 +697,10 @@ mod tests { #[test] #[cfg_attr(debug_assertions, should_panic = "messsaging description to nil")] fn test_send_message_nil() { - use crate::rc::Shared; - let nil: *mut Object = ::core::ptr::null_mut(); // This result should not be relied on - let result: Option> = unsafe { msg_send_id![nil, description] }; + let result: Option> = unsafe { msg_send_id![nil, description] }; assert!(result.is_none()); // This result should not be relied on @@ -723,12 +717,12 @@ mod tests { assert_eq!(result, 0.0); // This result should not be relied on - let result: Option> = + let result: Option> = unsafe { msg_send_id![nil, multiple: 1u32, arguments: 2i8] }; assert!(result.is_none()); // This result should not be relied on - let result: Option> = unsafe { msg_send_id![None, init] }; + let result: Option> = unsafe { msg_send_id![None, init] }; assert!(result.is_none()); } diff --git a/crates/objc2/src/protocol.rs b/crates/objc2/src/protocol.rs index 9bfdc713c..028af5ab2 100644 --- a/crates/objc2/src/protocol.rs +++ b/crates/objc2/src/protocol.rs @@ -118,12 +118,12 @@ pub unsafe trait ImplementedBy { /// /// ```rust,ignore /// use objc2::ProtocolObject; -/// use objc2::rc::{Id, Shared}; +/// use objc2::rc::Id; /// -/// let obj: Id; +/// let obj: Id; /// # obj = unimplemented!(); /// let obj: &ProtocolObject = ProtocolObject::from_ref(&*obj); -/// let obj: Id, Shared> = ProtocolObject::from_id(obj); +/// let obj: Id> = ProtocolObject::from_id(obj); /// ``` #[doc(alias = "id")] #[repr(C)] diff --git a/crates/objc2/src/rc/id.rs b/crates/objc2/src/rc/id.rs index 47f76cb53..0c02774ea 100644 --- a/crates/objc2/src/rc/id.rs +++ b/crates/objc2/src/rc/id.rs @@ -17,7 +17,7 @@ use crate::Message; /// at the right time. /// /// An [`Id`] can either be [`Owned`] or [`Shared`], represented with the `O` -/// type parameter. +/// type parameter. The default is [`Shared`]. /// /// If owned, it is guaranteed that there are no other references to the /// object, and the [`Id`] can therefore be mutably dereferenced. @@ -99,7 +99,7 @@ use crate::Message; // TODO: Figure out if `Message` bound on `T` would be better here? // TODO: Add `ptr::Thin` bound on `T` to allow for only extern types // TODO: Consider changing the name of Id -> Retain -pub struct Id { +pub struct Id { /// A pointer to the contained object. The pointer is always retained. /// /// It is important that this is `NonNull`, since we want to dereference diff --git a/crates/objc2/src/rc/mod.rs b/crates/objc2/src/rc/mod.rs index 91df64a73..ee08b8ec3 100644 --- a/crates/objc2/src/rc/mod.rs +++ b/crates/objc2/src/rc/mod.rs @@ -33,11 +33,11 @@ #![cfg_attr(feature = "apple", doc = "```")] #![cfg_attr(not(feature = "apple"), doc = "```no_run")] //! use objc2::{class, msg_send_id}; -//! use objc2::rc::{autoreleasepool, Id, Shared, WeakId}; +//! use objc2::rc::{autoreleasepool, Id, WeakId}; //! use objc2::runtime::Object; //! //! // Id will release the object when dropped -//! let obj: Id = unsafe { +//! let obj: Id = unsafe { //! msg_send_id![class!(NSObject), new] //! }; //! diff --git a/crates/objc2/src/rc/test_object.rs b/crates/objc2/src/rc/test_object.rs index aeb0dfacc..5372692b4 100644 --- a/crates/objc2/src/rc/test_object.rs +++ b/crates/objc2/src/rc/test_object.rs @@ -312,7 +312,7 @@ impl RcTestObjectSubclass { #[cfg(test)] mod tests { use super::*; - use crate::rc::{autoreleasepool, Allocated, Shared}; + use crate::rc::{autoreleasepool, Allocated}; #[test] fn ensure_declared_name() { @@ -322,7 +322,7 @@ mod tests { macro_rules! test_error_bool { ($expected:expr, $($obj:tt)*) => { // Succeeds - let res: Result<(), Id<__RcTestObject, Shared>> = unsafe { + let res: Result<(), Id<__RcTestObject>> = unsafe { msg_send![$($obj)*, boolAndShouldError: false, error: _] }; assert_eq!(res, Ok(())); @@ -331,7 +331,7 @@ mod tests { // Errors let res = autoreleasepool(|_pool| { // `Ok` type is inferred to be `()` - let res: Id<__RcTestObject, Shared> = unsafe { + let res: Id<__RcTestObject> = unsafe { msg_send![$($obj)*, boolAndShouldError: true, error: _] }.expect_err("not err"); $expected.alloc += 1; @@ -392,7 +392,7 @@ mod tests { ($expected:expr, $if_autorelease_not_skipped:expr, $sel:ident, $($obj:tt)*) => { // Succeeds let res = autoreleasepool(|_pool| { - let res: Result, Id<__RcTestObject, Shared>> = unsafe { + let res: Result, Id<__RcTestObject>> = unsafe { msg_send_id![$($obj)*, $sel: false, error: _] }; let res = res.expect("not ok"); @@ -413,7 +413,7 @@ mod tests { // Errors let res = autoreleasepool(|_pool| { - let res: Result, Id<__RcTestObject, Shared>> = unsafe { + let res: Result, Id<__RcTestObject>> = unsafe { msg_send_id![$($obj)*, $sel: true, error: _] }; $expected.alloc += 1; @@ -462,7 +462,7 @@ mod tests { let mut expected = __ThreadTestData::current(); // Succeeds - let res: Result, Id<__RcTestObject, Shared>> = + let res: Result, Id<__RcTestObject>> = unsafe { msg_send_id![__RcTestObject::class(), allocAndShouldError: false, error: _] }; let res = res.expect("not ok"); expected.alloc += 1; @@ -475,7 +475,7 @@ mod tests { // Errors let res = autoreleasepool(|_pool| { - let res: Result, Id<__RcTestObject, Shared>> = unsafe { + let res: Result, Id<__RcTestObject>> = unsafe { msg_send_id![__RcTestObject::class(), allocAndShouldError: true, error: _] }; expected.alloc += 1; diff --git a/crates/objc2/src/rc/writeback.rs b/crates/objc2/src/rc/writeback.rs index e34802433..4af176626 100644 --- a/crates/objc2/src/rc/writeback.rs +++ b/crates/objc2/src/rc/writeback.rs @@ -57,7 +57,7 @@ impl EncodeConvertArgument for &mut Id unsafe fn __process_after_message_send((ptr, old): Self::__StoredBeforeMessage) { // In terms of provenance, we roughly just want to do the following: // ``` - // fn do(value: &mut Id) { + // fn do(value: &mut Id) { // let old = value.clone(); // msg_send![... value ...]; // let _ = value.clone(); diff --git a/crates/objc2/src/runtime/nsobject.rs b/crates/objc2/src/runtime/nsobject.rs index 48bf89b57..1ea6111a4 100644 --- a/crates/objc2/src/runtime/nsobject.rs +++ b/crates/objc2/src/runtime/nsobject.rs @@ -1,7 +1,7 @@ use core::fmt; use core::hash; -use crate::rc::{DefaultId, Id, Owned, Shared}; +use crate::rc::{DefaultId, Id, Owned}; use crate::runtime::{Class, Object, Protocol}; use crate::{ extern_methods, msg_send, msg_send_id, ClassType, ImplementedBy, Message, ProtocolObject, @@ -109,7 +109,7 @@ pub unsafe trait NSObjectProtocol { } #[doc(hidden)] - fn __description(&self) -> Option> + fn __description(&self) -> Option> where Self: Sized + Message, { diff --git a/crates/objc2/tests/declare_class_self.rs b/crates/objc2/tests/declare_class_self.rs index 580c9781d..0104d843d 100644 --- a/crates/objc2/tests/declare_class_self.rs +++ b/crates/objc2/tests/declare_class_self.rs @@ -2,7 +2,7 @@ //! and hence we _must_ implement things by changing the generated method, we //! can't just create an internal helper function (since we can't name the //! types of such a function)! -use objc2::rc::{Allocated, Id, Shared}; +use objc2::rc::{Allocated, Id}; use objc2::runtime::NSObject; use objc2::{declare_class, ClassType}; @@ -33,7 +33,7 @@ declare_class!( fn init( _this: Allocated<::SameType>, _param: <*const Self as GetSameType>::SameType, - ) -> Id<::SameType, Shared> { + ) -> Id<::SameType> { unimplemented!() } @@ -44,7 +44,7 @@ declare_class!( #[method_id(test4)] #[allow(unused_parens)] - fn test4(_this: &<(Self) as GetSameType>::SameType) -> Id { + fn test4(_this: &<(Self) as GetSameType>::SameType) -> Id { unimplemented!() } } diff --git a/crates/objc2/tests/id_retain_autoreleased.rs b/crates/objc2/tests/id_retain_autoreleased.rs index 46eaefba4..fcde7c05e 100644 --- a/crates/objc2/tests/id_retain_autoreleased.rs +++ b/crates/objc2/tests/id_retain_autoreleased.rs @@ -1,14 +1,14 @@ use core::mem::ManuallyDrop; use objc2::msg_send; -use objc2::rc::{autoreleasepool, Id, Shared}; +use objc2::rc::{autoreleasepool, Id}; use objc2::runtime::NSObject; fn retain_count(obj: &NSObject) -> usize { unsafe { msg_send![obj, retainCount] } } -fn create_obj() -> Id { +fn create_obj() -> Id { let obj = ManuallyDrop::new(NSObject::new()); unsafe { let obj: *mut NSObject = msg_send![&*obj, autorelease]; diff --git a/crates/objc2/tests/track_caller.rs b/crates/objc2/tests/track_caller.rs index 8644ada99..aacb20f71 100644 --- a/crates/objc2/tests/track_caller.rs +++ b/crates/objc2/tests/track_caller.rs @@ -7,7 +7,7 @@ use std::ptr; use std::sync::Mutex; use objc2::encode::Encode; -use objc2::rc::{Allocated, Id, Shared, __RcTestObject}; +use objc2::rc::{Allocated, Id, __RcTestObject}; use objc2::runtime::{NSObject, Object}; use objc2::{class, declare_class, msg_send, msg_send_id, ClassType}; @@ -98,7 +98,7 @@ pub fn test_nil(checker: &PanicChecker) { let _: *mut Object = unsafe { msg_send![super(nil, NSObject::class()), description] }; }); checker.assert_panics(msg, line!() + 1, || { - let _: Option> = unsafe { msg_send_id![nil, description] }; + let _: Option> = unsafe { msg_send_id![nil, description] }; }); } @@ -112,7 +112,7 @@ pub fn test_verify(checker: &PanicChecker) { let msg = format!("invalid message send to -[NSObject hash]: expected return to have type code '{}', but found '@'", usize::ENCODING); checker.assert_panics(&msg, line!() + 1, || { - let _: Option> = unsafe { msg_send_id![&obj, hash] }; + let _: Option> = unsafe { msg_send_id![&obj, hash] }; }); } @@ -120,23 +120,22 @@ pub fn test_error_methods(checker: &PanicChecker) { let nil: *mut Object = ptr::null_mut(); let msg = "messsaging someSelectorWithError: to nil"; - checker.assert_panics(msg, line!() + 2, || { - let _: Result<(), Id> = - unsafe { msg_send![nil, someSelectorWithError: _] }; + checker.assert_panics(msg, line!() + 1, || { + let _: Result<(), Id> = unsafe { msg_send![nil, someSelectorWithError: _] }; }); checker.assert_panics(msg, line!() + 2, || { - let _: Result<(), Id> = + let _: Result<(), Id> = unsafe { msg_send![super(nil, NSObject::class()), someSelectorWithError: _] }; }); checker.assert_panics(msg, line!() + 2, || { - let _: Result, Id> = + let _: Result, Id> = unsafe { msg_send_id![nil, someSelectorWithError: _] }; }); let msg = "invalid message send to -[NSObject someSelectorWithError:]: method not found"; checker.assert_panics(msg, line!() + 3, || { let obj = __RcTestObject::new(); - let _: Result<(), Id> = + let _: Result<(), Id> = unsafe { msg_send![super(&obj), someSelectorWithError: _] }; }); } @@ -147,7 +146,7 @@ pub fn test_id_unwrap(checker: &PanicChecker) { let msg = "failed creating new instance using +[__RcTestObject newReturningNull]"; checker.assert_panics(msg, line!() + 1, || { - let _obj: Id<__RcTestObject, Shared> = unsafe { msg_send_id![cls, newReturningNull] }; + let _obj: Id<__RcTestObject> = unsafe { msg_send_id![cls, newReturningNull] }; }); let msg = "failed allocating with +[__RcTestObject allocReturningNull]"; @@ -157,23 +156,23 @@ pub fn test_id_unwrap(checker: &PanicChecker) { let msg = "failed initializing object with -initReturningNull"; checker.assert_panics(msg, line!() + 2, || { - let _obj: Id<__RcTestObject, Shared> = + let _obj: Id<__RcTestObject> = unsafe { msg_send_id![__RcTestObject::alloc(), initReturningNull] }; }); let msg = "failed copying object"; checker.assert_panics(msg, line!() + 1, || { - let _obj: Id<__RcTestObject, Shared> = unsafe { msg_send_id![&obj, copyReturningNull] }; + let _obj: Id<__RcTestObject> = unsafe { msg_send_id![&obj, copyReturningNull] }; }); let msg = "unexpected NULL returned from -[__RcTestObject methodReturningNull]"; checker.assert_panics(msg, line!() + 1, || { - let _obj: Id<__RcTestObject, Shared> = unsafe { msg_send_id![&obj, methodReturningNull] }; + let _obj: Id<__RcTestObject> = unsafe { msg_send_id![&obj, methodReturningNull] }; }); } pub fn test_catch_all(checker: &PanicChecker) { - let obj: Id = unsafe { msg_send_id![class!(NSArray), new] }; + let obj: Id = unsafe { msg_send_id![class!(NSArray), new] }; let msg = "NSRangeException"; checker.assert_panics(msg, line!() + 1, || { @@ -182,7 +181,7 @@ pub fn test_catch_all(checker: &PanicChecker) { let msg = "NSRangeException"; checker.assert_panics(msg, line!() + 1, || { - let _: Id = unsafe { msg_send_id![&obj, objectAtIndex: 0usize] }; + let _: Id = unsafe { msg_send_id![&obj, objectAtIndex: 0usize] }; }); } @@ -209,6 +208,6 @@ pub fn test_unwind(checker: &PanicChecker) { let _: *mut Object = unsafe { msg_send![PanickingClass::class(), panic] }; }); checker.assert_panics(msg, line, || { - let _: Id = unsafe { msg_send_id![PanickingClass::class(), panic] }; + let _: Id = unsafe { msg_send_id![PanickingClass::class(), panic] }; }); } diff --git a/crates/test-assembly/crates/test_extern_protocol/expected/apple-aarch64.s b/crates/test-assembly/crates/test_extern_protocol/expected/apple-aarch64.s index 798c90dd3..4f8c955b8 100644 --- a/crates/test-assembly/crates/test_extern_protocol/expected/apple-aarch64.s +++ b/crates/test-assembly/crates/test_extern_protocol/expected/apple-aarch64.s @@ -14,9 +14,9 @@ Lloh1: .p2align 2 _dyn_call: Lloh2: - adrp x8, L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961@PAGE + adrp x8, L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9@PAGE Lloh3: - ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961@PAGEOFF] + ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9@PAGEOFF] b _objc_msgSend .loh AdrpLdr Lloh2, Lloh3 @@ -28,9 +28,9 @@ _dyn_consume: add x29, sp, #16 mov x19, x0 Lloh4: - adrp x8, L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961@PAGE + adrp x8, L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9@PAGE Lloh5: - ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961@PAGEOFF] + ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9@PAGEOFF] bl _objc_msgSend mov x0, x19 ldp x29, x30, [sp, #16] @@ -43,20 +43,20 @@ l_anon.[ID].0: .ascii "MyProtocol" .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_016b57e4e6a36961 + .globl L_OBJC_IMAGE_INFO_36d5bd8a3470dcf9 .p2align 2 -L_OBJC_IMAGE_INFO_016b57e4e6a36961: +L_OBJC_IMAGE_INFO_36d5bd8a3470dcf9: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_016b57e4e6a36961 -L_OBJC_METH_VAR_NAME_016b57e4e6a36961: + .globl L_OBJC_METH_VAR_NAME_36d5bd8a3470dcf9 +L_OBJC_METH_VAR_NAME_36d5bd8a3470dcf9: .asciz "aMethod" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961 + .globl L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9 .p2align 3 -L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961: - .quad L_OBJC_METH_VAR_NAME_016b57e4e6a36961 +L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9: + .quad L_OBJC_METH_VAR_NAME_36d5bd8a3470dcf9 .subsections_via_symbols diff --git a/crates/test-assembly/crates/test_extern_protocol/expected/apple-armv7.s b/crates/test-assembly/crates/test_extern_protocol/expected/apple-armv7.s index ca838716f..ea0b9107a 100644 --- a/crates/test-assembly/crates/test_extern_protocol/expected/apple-armv7.s +++ b/crates/test-assembly/crates/test_extern_protocol/expected/apple-armv7.s @@ -15,8 +15,8 @@ LPC0_0: .p2align 2 .code 32 _dyn_call: - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961-(LPC1_0+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961-(LPC1_0+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9-(LPC1_0+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9-(LPC1_0+8)) LPC1_0: ldr r1, [pc, r1] b _objc_msgSend @@ -27,9 +27,9 @@ LPC1_0: _dyn_consume: push {r4, r7, lr} add r7, sp, #4 - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961-(LPC2_0+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9-(LPC2_0+8)) mov r4, r0 - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961-(LPC2_0+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9-(LPC2_0+8)) LPC2_0: ldr r1, [pc, r1] bl _objc_msgSend @@ -42,20 +42,20 @@ l_anon.[ID].0: .ascii "MyProtocol" .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_016b57e4e6a36961 + .globl L_OBJC_IMAGE_INFO_36d5bd8a3470dcf9 .p2align 2 -L_OBJC_IMAGE_INFO_016b57e4e6a36961: +L_OBJC_IMAGE_INFO_36d5bd8a3470dcf9: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_016b57e4e6a36961 -L_OBJC_METH_VAR_NAME_016b57e4e6a36961: + .globl L_OBJC_METH_VAR_NAME_36d5bd8a3470dcf9 +L_OBJC_METH_VAR_NAME_36d5bd8a3470dcf9: .asciz "aMethod" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961 + .globl L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9 .p2align 2 -L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961: - .long L_OBJC_METH_VAR_NAME_016b57e4e6a36961 +L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9: + .long L_OBJC_METH_VAR_NAME_36d5bd8a3470dcf9 .subsections_via_symbols diff --git a/crates/test-assembly/crates/test_extern_protocol/expected/apple-armv7s.s b/crates/test-assembly/crates/test_extern_protocol/expected/apple-armv7s.s index ba0cd8b98..54e661f6c 100644 --- a/crates/test-assembly/crates/test_extern_protocol/expected/apple-armv7s.s +++ b/crates/test-assembly/crates/test_extern_protocol/expected/apple-armv7s.s @@ -20,8 +20,8 @@ LPC0_0: _dyn_call: push {r7, lr} mov r7, sp - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961-(LPC1_0+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961-(LPC1_0+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9-(LPC1_0+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9-(LPC1_0+8)) LPC1_0: ldr r1, [pc, r1] bl _objc_msgSend @@ -33,9 +33,9 @@ LPC1_0: _dyn_consume: push {r4, r7, lr} add r7, sp, #4 - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961-(LPC2_0+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9-(LPC2_0+8)) mov r4, r0 - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961-(LPC2_0+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9-(LPC2_0+8)) LPC2_0: ldr r1, [pc, r1] bl _objc_msgSend @@ -48,20 +48,20 @@ l_anon.[ID].0: .ascii "MyProtocol" .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_016b57e4e6a36961 + .globl L_OBJC_IMAGE_INFO_36d5bd8a3470dcf9 .p2align 2 -L_OBJC_IMAGE_INFO_016b57e4e6a36961: +L_OBJC_IMAGE_INFO_36d5bd8a3470dcf9: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_016b57e4e6a36961 -L_OBJC_METH_VAR_NAME_016b57e4e6a36961: + .globl L_OBJC_METH_VAR_NAME_36d5bd8a3470dcf9 +L_OBJC_METH_VAR_NAME_36d5bd8a3470dcf9: .asciz "aMethod" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961 + .globl L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9 .p2align 2 -L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961: - .long L_OBJC_METH_VAR_NAME_016b57e4e6a36961 +L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9: + .long L_OBJC_METH_VAR_NAME_36d5bd8a3470dcf9 .subsections_via_symbols diff --git a/crates/test-assembly/crates/test_extern_protocol/expected/apple-old-x86.s b/crates/test-assembly/crates/test_extern_protocol/expected/apple-old-x86.s index 176a9fdec..400b69da2 100644 --- a/crates/test-assembly/crates/test_extern_protocol/expected/apple-old-x86.s +++ b/crates/test-assembly/crates/test_extern_protocol/expected/apple-old-x86.s @@ -28,7 +28,7 @@ _dyn_call: L1$pb: pop eax sub esp, 8 - push dword ptr [eax + L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961-L1$pb] + push dword ptr [eax + L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9-L1$pb] push dword ptr [ebp + 8] call _objc_msgSend add esp, 24 @@ -45,7 +45,7 @@ _dyn_consume: L2$pb: pop eax sub esp, 8 - push dword ptr [eax + L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961-L2$pb] + push dword ptr [eax + L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9-L2$pb] push dword ptr [ebp + 8] call _objc_msgSend add esp, 24 @@ -57,20 +57,20 @@ l_anon.[ID].0: .ascii "MyProtocol" .section __OBJC,__image_info - .globl L_OBJC_IMAGE_INFO_016b57e4e6a36961 + .globl L_OBJC_IMAGE_INFO_36d5bd8a3470dcf9 .p2align 2 -L_OBJC_IMAGE_INFO_016b57e4e6a36961: +L_OBJC_IMAGE_INFO_36d5bd8a3470dcf9: .asciz "\000\000\000\000@\000\000" .section __TEXT,__cstring,cstring_literals - .globl L_OBJC_METH_VAR_NAME_016b57e4e6a36961 -L_OBJC_METH_VAR_NAME_016b57e4e6a36961: + .globl L_OBJC_METH_VAR_NAME_36d5bd8a3470dcf9 +L_OBJC_METH_VAR_NAME_36d5bd8a3470dcf9: .asciz "aMethod" .section __OBJC,__message_refs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961 + .globl L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9 .p2align 2 -L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961: - .long L_OBJC_METH_VAR_NAME_016b57e4e6a36961 +L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9: + .long L_OBJC_METH_VAR_NAME_36d5bd8a3470dcf9 .subsections_via_symbols diff --git a/crates/test-assembly/crates/test_extern_protocol/expected/apple-x86.s b/crates/test-assembly/crates/test_extern_protocol/expected/apple-x86.s index e788849bb..0486549bd 100644 --- a/crates/test-assembly/crates/test_extern_protocol/expected/apple-x86.s +++ b/crates/test-assembly/crates/test_extern_protocol/expected/apple-x86.s @@ -28,7 +28,7 @@ _dyn_call: L1$pb: pop eax sub esp, 8 - push dword ptr [eax + L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961-L1$pb] + push dword ptr [eax + L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9-L1$pb] push dword ptr [ebp + 8] call _objc_msgSend add esp, 24 @@ -45,7 +45,7 @@ _dyn_consume: L2$pb: pop eax sub esp, 8 - push dword ptr [eax + L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961-L2$pb] + push dword ptr [eax + L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9-L2$pb] push dword ptr [ebp + 8] call _objc_msgSend add esp, 24 @@ -57,20 +57,20 @@ l_anon.[ID].0: .ascii "MyProtocol" .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_016b57e4e6a36961 + .globl L_OBJC_IMAGE_INFO_36d5bd8a3470dcf9 .p2align 2 -L_OBJC_IMAGE_INFO_016b57e4e6a36961: +L_OBJC_IMAGE_INFO_36d5bd8a3470dcf9: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_016b57e4e6a36961 -L_OBJC_METH_VAR_NAME_016b57e4e6a36961: + .globl L_OBJC_METH_VAR_NAME_36d5bd8a3470dcf9 +L_OBJC_METH_VAR_NAME_36d5bd8a3470dcf9: .asciz "aMethod" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961 + .globl L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9 .p2align 2 -L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961: - .long L_OBJC_METH_VAR_NAME_016b57e4e6a36961 +L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9: + .long L_OBJC_METH_VAR_NAME_36d5bd8a3470dcf9 .subsections_via_symbols diff --git a/crates/test-assembly/crates/test_extern_protocol/expected/apple-x86_64.s b/crates/test-assembly/crates/test_extern_protocol/expected/apple-x86_64.s index 92042f00a..fb6faf042 100644 --- a/crates/test-assembly/crates/test_extern_protocol/expected/apple-x86_64.s +++ b/crates/test-assembly/crates/test_extern_protocol/expected/apple-x86_64.s @@ -15,7 +15,7 @@ _get_protocol: _dyn_call: push rbp mov rbp, rsp - mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961] + mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9] pop rbp jmp _objc_msgSend @@ -27,7 +27,7 @@ _dyn_consume: push rbx push rax mov rbx, rdi - mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961] + mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9] call _objc_msgSend mov rdi, rbx add rsp, 8 @@ -40,20 +40,20 @@ l_anon.[ID].0: .ascii "MyProtocol" .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_016b57e4e6a36961 + .globl L_OBJC_IMAGE_INFO_36d5bd8a3470dcf9 .p2align 2 -L_OBJC_IMAGE_INFO_016b57e4e6a36961: +L_OBJC_IMAGE_INFO_36d5bd8a3470dcf9: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_016b57e4e6a36961 -L_OBJC_METH_VAR_NAME_016b57e4e6a36961: + .globl L_OBJC_METH_VAR_NAME_36d5bd8a3470dcf9 +L_OBJC_METH_VAR_NAME_36d5bd8a3470dcf9: .asciz "aMethod" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961 + .globl L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9 .p2align 3 -L_OBJC_SELECTOR_REFERENCES_016b57e4e6a36961: - .quad L_OBJC_METH_VAR_NAME_016b57e4e6a36961 +L_OBJC_SELECTOR_REFERENCES_36d5bd8a3470dcf9: + .quad L_OBJC_METH_VAR_NAME_36d5bd8a3470dcf9 .subsections_via_symbols diff --git a/crates/test-assembly/crates/test_extern_protocol/lib.rs b/crates/test-assembly/crates/test_extern_protocol/lib.rs index df3adeb00..099eca328 100644 --- a/crates/test-assembly/crates/test_extern_protocol/lib.rs +++ b/crates/test-assembly/crates/test_extern_protocol/lib.rs @@ -2,7 +2,7 @@ #![cfg(feature = "apple")] use core::mem::ManuallyDrop; -use objc2::rc::{Id, Shared}; +use objc2::rc::Id; use objc2::runtime::Protocol; use objc2::{extern_protocol, ProtocolObject, ProtocolType}; @@ -27,7 +27,7 @@ fn dyn_call(obj: &ProtocolObject) { } #[no_mangle] -fn dyn_consume(obj: ManuallyDrop, Shared>>) { +fn dyn_consume(obj: ManuallyDrop>>) { obj.aMethod(); // Use ManuallyDrop to prevent trying to handle the case where `aMethod` // unwinds. diff --git a/crates/test-assembly/crates/test_msg_send_error/lib.rs b/crates/test-assembly/crates/test_msg_send_error/lib.rs index ea2b2ddc7..d43d3ee95 100644 --- a/crates/test-assembly/crates/test_msg_send_error/lib.rs +++ b/crates/test-assembly/crates/test_msg_send_error/lib.rs @@ -1,10 +1,10 @@ //! Test that error parameters are handled correctly. -use objc2::rc::{Allocated, Id, Shared}; +use objc2::rc::{Allocated, Id}; use objc2::runtime::{Class, Object, Sel}; use objc2::MessageReceiver; use objc2::__macro_helpers::{Alloc, CopyOrMutCopy, Init, MsgSendId, New, Other}; -type Result = std::result::Result>; +type Result = std::result::Result>; #[no_mangle] unsafe fn error_bool(obj: &Object, sel: Sel, param: u32) -> Result<()> { @@ -12,7 +12,7 @@ unsafe fn error_bool(obj: &Object, sel: Sel, param: u32) -> Result<()> { } #[no_mangle] -unsafe fn error_new(cls: &Class, sel: Sel) -> Result> { +unsafe fn error_new(cls: &Class, sel: Sel) -> Result> { New::send_message_id_error(cls, sel, ()) } @@ -22,16 +22,16 @@ unsafe fn error_alloc(cls: &Class, sel: Sel) -> Result> { } #[no_mangle] -unsafe fn error_init(obj: Option>, sel: Sel) -> Result> { +unsafe fn error_init(obj: Option>, sel: Sel) -> Result> { Init::send_message_id_error(obj, sel, ()) } #[no_mangle] -unsafe fn error_copy(obj: &Object, sel: Sel) -> Result> { +unsafe fn error_copy(obj: &Object, sel: Sel) -> Result> { CopyOrMutCopy::send_message_id_error(obj, sel, ()) } #[no_mangle] -unsafe fn error_autoreleased(obj: &Object, sel: Sel) -> Result> { +unsafe fn error_autoreleased(obj: &Object, sel: Sel) -> Result> { Other::send_message_id_error(obj, sel, ()) } diff --git a/crates/test-assembly/crates/test_msg_send_id/lib.rs b/crates/test-assembly/crates/test_msg_send_id/lib.rs index 5d2db7497..56fa49e2e 100644 --- a/crates/test-assembly/crates/test_msg_send_id/lib.rs +++ b/crates/test-assembly/crates/test_msg_send_id/lib.rs @@ -1,15 +1,15 @@ //! Test assembly output of `msg_send_id!` internals. use objc2::__macro_helpers::{Alloc, CopyOrMutCopy, Init, MsgSendId, New, Other}; -use objc2::rc::{Allocated, Id, Shared}; +use objc2::rc::{Allocated, Id}; use objc2::runtime::{Class, Object, Sel}; #[no_mangle] -unsafe fn handle_new(cls: &Class, sel: Sel) -> Option> { +unsafe fn handle_new(cls: &Class, sel: Sel) -> Option> { New::send_message_id(cls, sel, ()) } #[no_mangle] -unsafe fn handle_new_fallible(cls: &Class, sel: Sel) -> Id { +unsafe fn handle_new_fallible(cls: &Class, sel: Sel) -> Id { New::send_message_id(cls, sel, ()) } @@ -24,17 +24,17 @@ unsafe fn handle_alloc_fallible(cls: &Class, sel: Sel) -> Allocated { } #[no_mangle] -unsafe fn handle_init(obj: Option>, sel: Sel) -> Option> { +unsafe fn handle_init(obj: Option>, sel: Sel) -> Option> { Init::send_message_id(obj, sel, ()) } #[no_mangle] -unsafe fn handle_init_fallible(obj: Option>, sel: Sel) -> Id { +unsafe fn handle_init_fallible(obj: Option>, sel: Sel) -> Id { Init::send_message_id(obj, sel, ()) } #[no_mangle] -unsafe fn handle_alloc_init(cls: &Class, sel1: Sel, sel2: Sel) -> Option> { +unsafe fn handle_alloc_init(cls: &Class, sel1: Sel, sel2: Sel) -> Option> { let obj = Alloc::send_message_id(cls, sel1, ()); Init::send_message_id(obj, sel2, ()) } @@ -48,27 +48,27 @@ unsafe fn handle_alloc_release(cls: &Class, sel: Sel) { #[no_mangle] unsafe fn handle_alloc_init_release(cls: &Class, sel1: Sel, sel2: Sel) { let obj = Alloc::send_message_id(cls, sel1, ()); - let obj: Option> = Init::send_message_id(obj, sel2, ()); + let obj: Option> = Init::send_message_id(obj, sel2, ()); let _obj = obj.unwrap_unchecked(); } #[no_mangle] -unsafe fn handle_copy(obj: &Object, sel: Sel) -> Option> { +unsafe fn handle_copy(obj: &Object, sel: Sel) -> Option> { CopyOrMutCopy::send_message_id(obj, sel, ()) } #[no_mangle] -unsafe fn handle_copy_fallible(obj: &Object, sel: Sel) -> Id { +unsafe fn handle_copy_fallible(obj: &Object, sel: Sel) -> Id { CopyOrMutCopy::send_message_id(obj, sel, ()) } #[no_mangle] -unsafe fn handle_autoreleased(obj: &Object, sel: Sel) -> Option> { +unsafe fn handle_autoreleased(obj: &Object, sel: Sel) -> Option> { Other::send_message_id(obj, sel, ()) } #[no_mangle] -unsafe fn handle_autoreleased_fallible(obj: &Object, sel: Sel) -> Id { +unsafe fn handle_autoreleased_fallible(obj: &Object, sel: Sel) -> Id { Other::send_message_id(obj, sel, ()) } @@ -77,7 +77,7 @@ unsafe fn handle_autoreleased_fallible(obj: &Object, sel: Sel) -> Id, -) -> Option> { + param: &mut Id, +) -> Option> { Other::send_message_id(obj, sel, (param,)) } 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 7e588b144..efaa19126 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 @@ -3,9 +3,9 @@ .p2align 2 _handle_with_sel: Lloh0: - adrp x8, L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc@PAGE + adrp x8, L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c@PAGE Lloh1: - ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc@PAGEOFF] + ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c@PAGEOFF] b _objc_msgSend .loh AdrpLdr Lloh0, Lloh1 @@ -55,24 +55,24 @@ _use_generic: add x29, sp, #16 mov x19, x0 Lloh10: - adrp x8, L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023@PAGE + adrp x8, L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da@PAGE Lloh11: - ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023@PAGEOFF] - adrp x20, L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05@PAGE - ldr x2, [x20, L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05@PAGEOFF] + ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da@PAGEOFF] + adrp x20, L_OBJC_SELECTOR_REFERENCES_379095321e06c060@PAGE + ldr x2, [x20, L_OBJC_SELECTOR_REFERENCES_379095321e06c060@PAGEOFF] bl _objc_msgSend Lloh12: - adrp x8, L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343@PAGE + adrp x8, L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1@PAGE Lloh13: - ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343@PAGEOFF] - ldr x2, [x20, L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05@PAGEOFF] + ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1@PAGEOFF] + ldr x2, [x20, L_OBJC_SELECTOR_REFERENCES_379095321e06c060@PAGEOFF] mov x0, x19 bl _objc_msgSend Lloh14: - adrp x8, L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4@PAGE + adrp x8, L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d@PAGE Lloh15: - ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4@PAGEOFF] - ldr x2, [x20, L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05@PAGEOFF] + ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d@PAGEOFF] + ldr x2, [x20, L_OBJC_SELECTOR_REFERENCES_379095321e06c060@PAGEOFF] mov x0, x19 ldp x29, x30, [sp, #16] ldp x20, x19, [sp], #32 @@ -92,88 +92,88 @@ l_anon.[ID].1: .asciz ";\000\000\000\000\000\000\000\016\000\000\000\005\000\000" .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_044375a4329d08dc + .globl L_OBJC_IMAGE_INFO_77d2b75bddfbef7c .p2align 2 -L_OBJC_IMAGE_INFO_044375a4329d08dc: +L_OBJC_IMAGE_INFO_77d2b75bddfbef7c: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_044375a4329d08dc -L_OBJC_METH_VAR_NAME_044375a4329d08dc: + .globl L_OBJC_METH_VAR_NAME_77d2b75bddfbef7c +L_OBJC_METH_VAR_NAME_77d2b75bddfbef7c: .asciz "someSelector" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc + .globl L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c .p2align 3 -L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc: - .quad L_OBJC_METH_VAR_NAME_044375a4329d08dc +L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c: + .quad L_OBJC_METH_VAR_NAME_77d2b75bddfbef7c .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_5ace898e385eba05 + .globl L_OBJC_IMAGE_INFO_379095321e06c060 .p2align 2 -L_OBJC_IMAGE_INFO_5ace898e385eba05: +L_OBJC_IMAGE_INFO_379095321e06c060: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_5ace898e385eba05 -L_OBJC_METH_VAR_NAME_5ace898e385eba05: + .globl L_OBJC_METH_VAR_NAME_379095321e06c060 +L_OBJC_METH_VAR_NAME_379095321e06c060: .asciz "generic:selector:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05 + .globl L_OBJC_SELECTOR_REFERENCES_379095321e06c060 .p2align 3 -L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05: - .quad L_OBJC_METH_VAR_NAME_5ace898e385eba05 +L_OBJC_SELECTOR_REFERENCES_379095321e06c060: + .quad L_OBJC_METH_VAR_NAME_379095321e06c060 .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_36a6e334f5aeb023 + .globl L_OBJC_IMAGE_INFO_038d21a6277de1da .p2align 2 -L_OBJC_IMAGE_INFO_36a6e334f5aeb023: +L_OBJC_IMAGE_INFO_038d21a6277de1da: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_36a6e334f5aeb023 -L_OBJC_METH_VAR_NAME_36a6e334f5aeb023: + .globl L_OBJC_METH_VAR_NAME_038d21a6277de1da +L_OBJC_METH_VAR_NAME_038d21a6277de1da: .asciz "performSelector:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023 + .globl L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da .p2align 3 -L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023: - .quad L_OBJC_METH_VAR_NAME_36a6e334f5aeb023 +L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da: + .quad L_OBJC_METH_VAR_NAME_038d21a6277de1da .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_2c3c38f6ea036343 + .globl L_OBJC_IMAGE_INFO_573c1e9c42ae1ea1 .p2align 2 -L_OBJC_IMAGE_INFO_2c3c38f6ea036343: +L_OBJC_IMAGE_INFO_573c1e9c42ae1ea1: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_2c3c38f6ea036343 -L_OBJC_METH_VAR_NAME_2c3c38f6ea036343: + .globl L_OBJC_METH_VAR_NAME_573c1e9c42ae1ea1 +L_OBJC_METH_VAR_NAME_573c1e9c42ae1ea1: .asciz "performSelector:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343 + .globl L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1 .p2align 3 -L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343: - .quad L_OBJC_METH_VAR_NAME_2c3c38f6ea036343 +L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1: + .quad L_OBJC_METH_VAR_NAME_573c1e9c42ae1ea1 .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_e1e97023e8bcf6a4 + .globl L_OBJC_IMAGE_INFO_9885c1be4d03110d .p2align 2 -L_OBJC_IMAGE_INFO_e1e97023e8bcf6a4: +L_OBJC_IMAGE_INFO_9885c1be4d03110d: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_e1e97023e8bcf6a4 -L_OBJC_METH_VAR_NAME_e1e97023e8bcf6a4: + .globl L_OBJC_METH_VAR_NAME_9885c1be4d03110d +L_OBJC_METH_VAR_NAME_9885c1be4d03110d: .asciz "performSelector:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4 + .globl L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d .p2align 3 -L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4: - .quad L_OBJC_METH_VAR_NAME_e1e97023e8bcf6a4 +L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d: + .quad L_OBJC_METH_VAR_NAME_9885c1be4d03110d .subsections_via_symbols diff --git a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7.s b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7.s index 9e2d370ca..7cc1904c4 100644 --- a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7.s +++ b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7.s @@ -4,8 +4,8 @@ .p2align 2 .code 32 _handle_with_sel: - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc-(LPC0_0+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc-(LPC0_0+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c-(LPC0_0+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c-(LPC0_0+8)) LPC0_0: ldr r1, [pc, r1] b _objc_msgSend @@ -48,33 +48,33 @@ LPC1_2: _use_generic: push {r4, r7, lr} add r7, sp, #4 - movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_0+8)) + movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_379095321e06c060-(LPC2_0+8)) mov r4, r0 - movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_0+8)) + movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_379095321e06c060-(LPC2_0+8)) LPC2_0: ldr r2, [pc, r2] - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023-(LPC2_1+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023-(LPC2_1+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da-(LPC2_1+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da-(LPC2_1+8)) LPC2_1: ldr r1, [pc, r1] bl _objc_msgSend - movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_2+8)) + movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_379095321e06c060-(LPC2_2+8)) mov r0, r4 - movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_2+8)) + movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_379095321e06c060-(LPC2_2+8)) LPC2_2: ldr r2, [pc, r2] - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343-(LPC2_3+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343-(LPC2_3+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1-(LPC2_3+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1-(LPC2_3+8)) LPC2_3: ldr r1, [pc, r1] bl _objc_msgSend - movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_4+8)) + movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_379095321e06c060-(LPC2_4+8)) mov r0, r4 - movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_4+8)) + movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_379095321e06c060-(LPC2_4+8)) LPC2_4: ldr r2, [pc, r2] - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4-(LPC2_5+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4-(LPC2_5+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d-(LPC2_5+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d-(LPC2_5+8)) LPC2_5: ldr r1, [pc, r1] pop {r4, r7, lr} @@ -91,89 +91,89 @@ l_anon.[ID].1: .asciz ";\000\000\000\016\000\000\000\005\000\000" .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_044375a4329d08dc + .globl L_OBJC_IMAGE_INFO_77d2b75bddfbef7c .p2align 2 -L_OBJC_IMAGE_INFO_044375a4329d08dc: +L_OBJC_IMAGE_INFO_77d2b75bddfbef7c: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_044375a4329d08dc -L_OBJC_METH_VAR_NAME_044375a4329d08dc: + .globl L_OBJC_METH_VAR_NAME_77d2b75bddfbef7c +L_OBJC_METH_VAR_NAME_77d2b75bddfbef7c: .asciz "someSelector" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc + .globl L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c .p2align 2 -L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc: - .long L_OBJC_METH_VAR_NAME_044375a4329d08dc +L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c: + .long L_OBJC_METH_VAR_NAME_77d2b75bddfbef7c .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_5ace898e385eba05 + .globl L_OBJC_IMAGE_INFO_379095321e06c060 .p2align 2 -L_OBJC_IMAGE_INFO_5ace898e385eba05: +L_OBJC_IMAGE_INFO_379095321e06c060: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_5ace898e385eba05 -L_OBJC_METH_VAR_NAME_5ace898e385eba05: + .globl L_OBJC_METH_VAR_NAME_379095321e06c060 +L_OBJC_METH_VAR_NAME_379095321e06c060: .asciz "generic:selector:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05 + .globl L_OBJC_SELECTOR_REFERENCES_379095321e06c060 .p2align 2 -L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05: - .long L_OBJC_METH_VAR_NAME_5ace898e385eba05 +L_OBJC_SELECTOR_REFERENCES_379095321e06c060: + .long L_OBJC_METH_VAR_NAME_379095321e06c060 .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_36a6e334f5aeb023 + .globl L_OBJC_IMAGE_INFO_038d21a6277de1da .p2align 2 -L_OBJC_IMAGE_INFO_36a6e334f5aeb023: +L_OBJC_IMAGE_INFO_038d21a6277de1da: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_36a6e334f5aeb023 -L_OBJC_METH_VAR_NAME_36a6e334f5aeb023: + .globl L_OBJC_METH_VAR_NAME_038d21a6277de1da +L_OBJC_METH_VAR_NAME_038d21a6277de1da: .asciz "performSelector:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023 + .globl L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da .p2align 2 -L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023: - .long L_OBJC_METH_VAR_NAME_36a6e334f5aeb023 +L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da: + .long L_OBJC_METH_VAR_NAME_038d21a6277de1da .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_2c3c38f6ea036343 + .globl L_OBJC_IMAGE_INFO_573c1e9c42ae1ea1 .p2align 2 -L_OBJC_IMAGE_INFO_2c3c38f6ea036343: +L_OBJC_IMAGE_INFO_573c1e9c42ae1ea1: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_2c3c38f6ea036343 -L_OBJC_METH_VAR_NAME_2c3c38f6ea036343: + .globl L_OBJC_METH_VAR_NAME_573c1e9c42ae1ea1 +L_OBJC_METH_VAR_NAME_573c1e9c42ae1ea1: .asciz "performSelector:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343 + .globl L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1 .p2align 2 -L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343: - .long L_OBJC_METH_VAR_NAME_2c3c38f6ea036343 +L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1: + .long L_OBJC_METH_VAR_NAME_573c1e9c42ae1ea1 .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_e1e97023e8bcf6a4 + .globl L_OBJC_IMAGE_INFO_9885c1be4d03110d .p2align 2 -L_OBJC_IMAGE_INFO_e1e97023e8bcf6a4: +L_OBJC_IMAGE_INFO_9885c1be4d03110d: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_e1e97023e8bcf6a4 -L_OBJC_METH_VAR_NAME_e1e97023e8bcf6a4: + .globl L_OBJC_METH_VAR_NAME_9885c1be4d03110d +L_OBJC_METH_VAR_NAME_9885c1be4d03110d: .asciz "performSelector:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4 + .globl L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d .p2align 2 -L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4: - .long L_OBJC_METH_VAR_NAME_e1e97023e8bcf6a4 +L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d: + .long L_OBJC_METH_VAR_NAME_9885c1be4d03110d .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers .p2align 2 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 f7db867f3..c3a123e95 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 @@ -6,8 +6,8 @@ _handle_with_sel: push {r7, lr} mov r7, sp - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc-(LPC0_0+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc-(LPC0_0+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c-(LPC0_0+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c-(LPC0_0+8)) LPC0_0: ldr r1, [pc, r1] bl _objc_msgSend @@ -51,33 +51,33 @@ LPC1_2: _use_generic: push {r4, r7, lr} add r7, sp, #4 - movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_0+8)) + movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_379095321e06c060-(LPC2_0+8)) mov r4, r0 - movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_0+8)) + movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_379095321e06c060-(LPC2_0+8)) LPC2_0: ldr r2, [pc, r2] - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023-(LPC2_1+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023-(LPC2_1+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da-(LPC2_1+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da-(LPC2_1+8)) LPC2_1: ldr r1, [pc, r1] bl _objc_msgSend - movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_2+8)) + movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_379095321e06c060-(LPC2_2+8)) mov r0, r4 - movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_2+8)) + movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_379095321e06c060-(LPC2_2+8)) LPC2_2: ldr r2, [pc, r2] - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343-(LPC2_3+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343-(LPC2_3+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1-(LPC2_3+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1-(LPC2_3+8)) LPC2_3: ldr r1, [pc, r1] bl _objc_msgSend - movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_4+8)) + movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_379095321e06c060-(LPC2_4+8)) mov r0, r4 - movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_4+8)) + movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_379095321e06c060-(LPC2_4+8)) LPC2_4: ldr r2, [pc, r2] - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4-(LPC2_5+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4-(LPC2_5+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d-(LPC2_5+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d-(LPC2_5+8)) LPC2_5: ldr r1, [pc, r1] bl _objc_msgSend @@ -94,89 +94,89 @@ l_anon.[ID].1: .asciz ";\000\000\000\016\000\000\000\005\000\000" .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_044375a4329d08dc + .globl L_OBJC_IMAGE_INFO_77d2b75bddfbef7c .p2align 2 -L_OBJC_IMAGE_INFO_044375a4329d08dc: +L_OBJC_IMAGE_INFO_77d2b75bddfbef7c: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_044375a4329d08dc -L_OBJC_METH_VAR_NAME_044375a4329d08dc: + .globl L_OBJC_METH_VAR_NAME_77d2b75bddfbef7c +L_OBJC_METH_VAR_NAME_77d2b75bddfbef7c: .asciz "someSelector" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc + .globl L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c .p2align 2 -L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc: - .long L_OBJC_METH_VAR_NAME_044375a4329d08dc +L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c: + .long L_OBJC_METH_VAR_NAME_77d2b75bddfbef7c .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_5ace898e385eba05 + .globl L_OBJC_IMAGE_INFO_379095321e06c060 .p2align 2 -L_OBJC_IMAGE_INFO_5ace898e385eba05: +L_OBJC_IMAGE_INFO_379095321e06c060: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_5ace898e385eba05 -L_OBJC_METH_VAR_NAME_5ace898e385eba05: + .globl L_OBJC_METH_VAR_NAME_379095321e06c060 +L_OBJC_METH_VAR_NAME_379095321e06c060: .asciz "generic:selector:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05 + .globl L_OBJC_SELECTOR_REFERENCES_379095321e06c060 .p2align 2 -L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05: - .long L_OBJC_METH_VAR_NAME_5ace898e385eba05 +L_OBJC_SELECTOR_REFERENCES_379095321e06c060: + .long L_OBJC_METH_VAR_NAME_379095321e06c060 .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_36a6e334f5aeb023 + .globl L_OBJC_IMAGE_INFO_038d21a6277de1da .p2align 2 -L_OBJC_IMAGE_INFO_36a6e334f5aeb023: +L_OBJC_IMAGE_INFO_038d21a6277de1da: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_36a6e334f5aeb023 -L_OBJC_METH_VAR_NAME_36a6e334f5aeb023: + .globl L_OBJC_METH_VAR_NAME_038d21a6277de1da +L_OBJC_METH_VAR_NAME_038d21a6277de1da: .asciz "performSelector:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023 + .globl L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da .p2align 2 -L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023: - .long L_OBJC_METH_VAR_NAME_36a6e334f5aeb023 +L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da: + .long L_OBJC_METH_VAR_NAME_038d21a6277de1da .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_2c3c38f6ea036343 + .globl L_OBJC_IMAGE_INFO_573c1e9c42ae1ea1 .p2align 2 -L_OBJC_IMAGE_INFO_2c3c38f6ea036343: +L_OBJC_IMAGE_INFO_573c1e9c42ae1ea1: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_2c3c38f6ea036343 -L_OBJC_METH_VAR_NAME_2c3c38f6ea036343: + .globl L_OBJC_METH_VAR_NAME_573c1e9c42ae1ea1 +L_OBJC_METH_VAR_NAME_573c1e9c42ae1ea1: .asciz "performSelector:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343 + .globl L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1 .p2align 2 -L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343: - .long L_OBJC_METH_VAR_NAME_2c3c38f6ea036343 +L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1: + .long L_OBJC_METH_VAR_NAME_573c1e9c42ae1ea1 .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_e1e97023e8bcf6a4 + .globl L_OBJC_IMAGE_INFO_9885c1be4d03110d .p2align 2 -L_OBJC_IMAGE_INFO_e1e97023e8bcf6a4: +L_OBJC_IMAGE_INFO_9885c1be4d03110d: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_e1e97023e8bcf6a4 -L_OBJC_METH_VAR_NAME_e1e97023e8bcf6a4: + .globl L_OBJC_METH_VAR_NAME_9885c1be4d03110d +L_OBJC_METH_VAR_NAME_9885c1be4d03110d: .asciz "performSelector:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4 + .globl L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d .p2align 2 -L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4: - .long L_OBJC_METH_VAR_NAME_e1e97023e8bcf6a4 +L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d: + .long L_OBJC_METH_VAR_NAME_9885c1be4d03110d .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers .p2align 2 diff --git a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-old-x86.s b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-old-x86.s index 259fc77a1..404e64207 100644 --- a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-old-x86.s +++ b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-old-x86.s @@ -10,7 +10,7 @@ _handle_with_sel: L0$pb: pop eax sub esp, 8 - push dword ptr [eax + L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc-L0$pb] + push dword ptr [eax + L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c-L0$pb] push dword ptr [ebp + 8] call _objc_msgSend add esp, 24 @@ -71,18 +71,18 @@ L2$pb: pop esi mov edi, dword ptr [ebp + 8] sub esp, 4 - push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-L2$pb] - push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023-L2$pb] + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_379095321e06c060-L2$pb] + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da-L2$pb] push edi call _objc_msgSend add esp, 12 - push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-L2$pb] - push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343-L2$pb] + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_379095321e06c060-L2$pb] + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1-L2$pb] push edi call _objc_msgSend add esp, 12 - push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-L2$pb] - push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4-L2$pb] + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_379095321e06c060-L2$pb] + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d-L2$pb] push edi call _objc_msgSend add esp, 16 @@ -102,89 +102,89 @@ l_anon.[ID].1: .asciz ";\000\000\000\016\000\000\000\005\000\000" .section __OBJC,__image_info - .globl L_OBJC_IMAGE_INFO_044375a4329d08dc + .globl L_OBJC_IMAGE_INFO_77d2b75bddfbef7c .p2align 2 -L_OBJC_IMAGE_INFO_044375a4329d08dc: +L_OBJC_IMAGE_INFO_77d2b75bddfbef7c: .asciz "\000\000\000\000@\000\000" .section __TEXT,__cstring,cstring_literals - .globl L_OBJC_METH_VAR_NAME_044375a4329d08dc -L_OBJC_METH_VAR_NAME_044375a4329d08dc: + .globl L_OBJC_METH_VAR_NAME_77d2b75bddfbef7c +L_OBJC_METH_VAR_NAME_77d2b75bddfbef7c: .asciz "someSelector" .section __OBJC,__message_refs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc + .globl L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c .p2align 2 -L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc: - .long L_OBJC_METH_VAR_NAME_044375a4329d08dc +L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c: + .long L_OBJC_METH_VAR_NAME_77d2b75bddfbef7c .section __OBJC,__image_info - .globl L_OBJC_IMAGE_INFO_5ace898e385eba05 + .globl L_OBJC_IMAGE_INFO_379095321e06c060 .p2align 2 -L_OBJC_IMAGE_INFO_5ace898e385eba05: +L_OBJC_IMAGE_INFO_379095321e06c060: .asciz "\000\000\000\000@\000\000" .section __TEXT,__cstring,cstring_literals - .globl L_OBJC_METH_VAR_NAME_5ace898e385eba05 -L_OBJC_METH_VAR_NAME_5ace898e385eba05: + .globl L_OBJC_METH_VAR_NAME_379095321e06c060 +L_OBJC_METH_VAR_NAME_379095321e06c060: .asciz "generic:selector:" .section __OBJC,__message_refs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05 + .globl L_OBJC_SELECTOR_REFERENCES_379095321e06c060 .p2align 2 -L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05: - .long L_OBJC_METH_VAR_NAME_5ace898e385eba05 +L_OBJC_SELECTOR_REFERENCES_379095321e06c060: + .long L_OBJC_METH_VAR_NAME_379095321e06c060 .section __OBJC,__image_info - .globl L_OBJC_IMAGE_INFO_36a6e334f5aeb023 + .globl L_OBJC_IMAGE_INFO_038d21a6277de1da .p2align 2 -L_OBJC_IMAGE_INFO_36a6e334f5aeb023: +L_OBJC_IMAGE_INFO_038d21a6277de1da: .asciz "\000\000\000\000@\000\000" .section __TEXT,__cstring,cstring_literals - .globl L_OBJC_METH_VAR_NAME_36a6e334f5aeb023 -L_OBJC_METH_VAR_NAME_36a6e334f5aeb023: + .globl L_OBJC_METH_VAR_NAME_038d21a6277de1da +L_OBJC_METH_VAR_NAME_038d21a6277de1da: .asciz "performSelector:" .section __OBJC,__message_refs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023 + .globl L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da .p2align 2 -L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023: - .long L_OBJC_METH_VAR_NAME_36a6e334f5aeb023 +L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da: + .long L_OBJC_METH_VAR_NAME_038d21a6277de1da .section __OBJC,__image_info - .globl L_OBJC_IMAGE_INFO_2c3c38f6ea036343 + .globl L_OBJC_IMAGE_INFO_573c1e9c42ae1ea1 .p2align 2 -L_OBJC_IMAGE_INFO_2c3c38f6ea036343: +L_OBJC_IMAGE_INFO_573c1e9c42ae1ea1: .asciz "\000\000\000\000@\000\000" .section __TEXT,__cstring,cstring_literals - .globl L_OBJC_METH_VAR_NAME_2c3c38f6ea036343 -L_OBJC_METH_VAR_NAME_2c3c38f6ea036343: + .globl L_OBJC_METH_VAR_NAME_573c1e9c42ae1ea1 +L_OBJC_METH_VAR_NAME_573c1e9c42ae1ea1: .asciz "performSelector:" .section __OBJC,__message_refs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343 + .globl L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1 .p2align 2 -L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343: - .long L_OBJC_METH_VAR_NAME_2c3c38f6ea036343 +L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1: + .long L_OBJC_METH_VAR_NAME_573c1e9c42ae1ea1 .section __OBJC,__image_info - .globl L_OBJC_IMAGE_INFO_e1e97023e8bcf6a4 + .globl L_OBJC_IMAGE_INFO_9885c1be4d03110d .p2align 2 -L_OBJC_IMAGE_INFO_e1e97023e8bcf6a4: +L_OBJC_IMAGE_INFO_9885c1be4d03110d: .asciz "\000\000\000\000@\000\000" .section __TEXT,__cstring,cstring_literals - .globl L_OBJC_METH_VAR_NAME_e1e97023e8bcf6a4 -L_OBJC_METH_VAR_NAME_e1e97023e8bcf6a4: + .globl L_OBJC_METH_VAR_NAME_9885c1be4d03110d +L_OBJC_METH_VAR_NAME_9885c1be4d03110d: .asciz "performSelector:" .section __OBJC,__message_refs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4 + .globl L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d .p2align 2 -L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4: - .long L_OBJC_METH_VAR_NAME_e1e97023e8bcf6a4 +L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d: + .long L_OBJC_METH_VAR_NAME_9885c1be4d03110d .section __IMPORT,__pointers,non_lazy_symbol_pointers LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr: 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 3ce47d26b..79b24760c 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 @@ -10,7 +10,7 @@ _handle_with_sel: L0$pb: pop eax sub esp, 8 - push dword ptr [eax + L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc-L0$pb] + push dword ptr [eax + L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c-L0$pb] push dword ptr [ebp + 8] call _objc_msgSend add esp, 24 @@ -71,18 +71,18 @@ L2$pb: pop esi mov edi, dword ptr [ebp + 8] sub esp, 4 - push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-L2$pb] - push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023-L2$pb] + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_379095321e06c060-L2$pb] + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da-L2$pb] push edi call _objc_msgSend add esp, 12 - push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-L2$pb] - push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343-L2$pb] + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_379095321e06c060-L2$pb] + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1-L2$pb] push edi call _objc_msgSend add esp, 12 - push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-L2$pb] - push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4-L2$pb] + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_379095321e06c060-L2$pb] + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d-L2$pb] push edi call _objc_msgSend add esp, 16 @@ -102,89 +102,89 @@ l_anon.[ID].1: .asciz ";\000\000\000\016\000\000\000\005\000\000" .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_044375a4329d08dc + .globl L_OBJC_IMAGE_INFO_77d2b75bddfbef7c .p2align 2 -L_OBJC_IMAGE_INFO_044375a4329d08dc: +L_OBJC_IMAGE_INFO_77d2b75bddfbef7c: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_044375a4329d08dc -L_OBJC_METH_VAR_NAME_044375a4329d08dc: + .globl L_OBJC_METH_VAR_NAME_77d2b75bddfbef7c +L_OBJC_METH_VAR_NAME_77d2b75bddfbef7c: .asciz "someSelector" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc + .globl L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c .p2align 2 -L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc: - .long L_OBJC_METH_VAR_NAME_044375a4329d08dc +L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c: + .long L_OBJC_METH_VAR_NAME_77d2b75bddfbef7c .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_5ace898e385eba05 + .globl L_OBJC_IMAGE_INFO_379095321e06c060 .p2align 2 -L_OBJC_IMAGE_INFO_5ace898e385eba05: +L_OBJC_IMAGE_INFO_379095321e06c060: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_5ace898e385eba05 -L_OBJC_METH_VAR_NAME_5ace898e385eba05: + .globl L_OBJC_METH_VAR_NAME_379095321e06c060 +L_OBJC_METH_VAR_NAME_379095321e06c060: .asciz "generic:selector:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05 + .globl L_OBJC_SELECTOR_REFERENCES_379095321e06c060 .p2align 2 -L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05: - .long L_OBJC_METH_VAR_NAME_5ace898e385eba05 +L_OBJC_SELECTOR_REFERENCES_379095321e06c060: + .long L_OBJC_METH_VAR_NAME_379095321e06c060 .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_36a6e334f5aeb023 + .globl L_OBJC_IMAGE_INFO_038d21a6277de1da .p2align 2 -L_OBJC_IMAGE_INFO_36a6e334f5aeb023: +L_OBJC_IMAGE_INFO_038d21a6277de1da: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_36a6e334f5aeb023 -L_OBJC_METH_VAR_NAME_36a6e334f5aeb023: + .globl L_OBJC_METH_VAR_NAME_038d21a6277de1da +L_OBJC_METH_VAR_NAME_038d21a6277de1da: .asciz "performSelector:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023 + .globl L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da .p2align 2 -L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023: - .long L_OBJC_METH_VAR_NAME_36a6e334f5aeb023 +L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da: + .long L_OBJC_METH_VAR_NAME_038d21a6277de1da .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_2c3c38f6ea036343 + .globl L_OBJC_IMAGE_INFO_573c1e9c42ae1ea1 .p2align 2 -L_OBJC_IMAGE_INFO_2c3c38f6ea036343: +L_OBJC_IMAGE_INFO_573c1e9c42ae1ea1: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_2c3c38f6ea036343 -L_OBJC_METH_VAR_NAME_2c3c38f6ea036343: + .globl L_OBJC_METH_VAR_NAME_573c1e9c42ae1ea1 +L_OBJC_METH_VAR_NAME_573c1e9c42ae1ea1: .asciz "performSelector:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343 + .globl L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1 .p2align 2 -L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343: - .long L_OBJC_METH_VAR_NAME_2c3c38f6ea036343 +L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1: + .long L_OBJC_METH_VAR_NAME_573c1e9c42ae1ea1 .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_e1e97023e8bcf6a4 + .globl L_OBJC_IMAGE_INFO_9885c1be4d03110d .p2align 2 -L_OBJC_IMAGE_INFO_e1e97023e8bcf6a4: +L_OBJC_IMAGE_INFO_9885c1be4d03110d: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_e1e97023e8bcf6a4 -L_OBJC_METH_VAR_NAME_e1e97023e8bcf6a4: + .globl L_OBJC_METH_VAR_NAME_9885c1be4d03110d +L_OBJC_METH_VAR_NAME_9885c1be4d03110d: .asciz "performSelector:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4 + .globl L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d .p2align 2 -L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4: - .long L_OBJC_METH_VAR_NAME_e1e97023e8bcf6a4 +L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d: + .long L_OBJC_METH_VAR_NAME_9885c1be4d03110d .section __IMPORT,__pointers,non_lazy_symbol_pointers LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr: 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 9639353fe..38ccd1f5e 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 @@ -5,7 +5,7 @@ _handle_with_sel: push rbp mov rbp, rsp - mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc] + mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c] pop rbp jmp _objc_msgSend @@ -45,15 +45,15 @@ _use_generic: push rbx push rax mov rbx, rdi - mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023] - mov rdx, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05] + mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da] + mov rdx, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_379095321e06c060] call _objc_msgSend - mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343] - mov rdx, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05] + mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1] + mov rdx, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_379095321e06c060] mov rdi, rbx call _objc_msgSend - mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4] - mov rdx, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05] + mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d] + mov rdx, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_379095321e06c060] mov rdi, rbx add rsp, 8 pop rbx @@ -71,88 +71,88 @@ l_anon.[ID].1: .asciz ";\000\000\000\000\000\000\000\016\000\000\000\005\000\000" .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_044375a4329d08dc + .globl L_OBJC_IMAGE_INFO_77d2b75bddfbef7c .p2align 2 -L_OBJC_IMAGE_INFO_044375a4329d08dc: +L_OBJC_IMAGE_INFO_77d2b75bddfbef7c: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_044375a4329d08dc -L_OBJC_METH_VAR_NAME_044375a4329d08dc: + .globl L_OBJC_METH_VAR_NAME_77d2b75bddfbef7c +L_OBJC_METH_VAR_NAME_77d2b75bddfbef7c: .asciz "someSelector" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc + .globl L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c .p2align 3 -L_OBJC_SELECTOR_REFERENCES_044375a4329d08dc: - .quad L_OBJC_METH_VAR_NAME_044375a4329d08dc +L_OBJC_SELECTOR_REFERENCES_77d2b75bddfbef7c: + .quad L_OBJC_METH_VAR_NAME_77d2b75bddfbef7c .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_5ace898e385eba05 + .globl L_OBJC_IMAGE_INFO_379095321e06c060 .p2align 2 -L_OBJC_IMAGE_INFO_5ace898e385eba05: +L_OBJC_IMAGE_INFO_379095321e06c060: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_5ace898e385eba05 -L_OBJC_METH_VAR_NAME_5ace898e385eba05: + .globl L_OBJC_METH_VAR_NAME_379095321e06c060 +L_OBJC_METH_VAR_NAME_379095321e06c060: .asciz "generic:selector:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05 + .globl L_OBJC_SELECTOR_REFERENCES_379095321e06c060 .p2align 3 -L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05: - .quad L_OBJC_METH_VAR_NAME_5ace898e385eba05 +L_OBJC_SELECTOR_REFERENCES_379095321e06c060: + .quad L_OBJC_METH_VAR_NAME_379095321e06c060 .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_36a6e334f5aeb023 + .globl L_OBJC_IMAGE_INFO_038d21a6277de1da .p2align 2 -L_OBJC_IMAGE_INFO_36a6e334f5aeb023: +L_OBJC_IMAGE_INFO_038d21a6277de1da: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_36a6e334f5aeb023 -L_OBJC_METH_VAR_NAME_36a6e334f5aeb023: + .globl L_OBJC_METH_VAR_NAME_038d21a6277de1da +L_OBJC_METH_VAR_NAME_038d21a6277de1da: .asciz "performSelector:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023 + .globl L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da .p2align 3 -L_OBJC_SELECTOR_REFERENCES_36a6e334f5aeb023: - .quad L_OBJC_METH_VAR_NAME_36a6e334f5aeb023 +L_OBJC_SELECTOR_REFERENCES_038d21a6277de1da: + .quad L_OBJC_METH_VAR_NAME_038d21a6277de1da .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_2c3c38f6ea036343 + .globl L_OBJC_IMAGE_INFO_573c1e9c42ae1ea1 .p2align 2 -L_OBJC_IMAGE_INFO_2c3c38f6ea036343: +L_OBJC_IMAGE_INFO_573c1e9c42ae1ea1: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_2c3c38f6ea036343 -L_OBJC_METH_VAR_NAME_2c3c38f6ea036343: + .globl L_OBJC_METH_VAR_NAME_573c1e9c42ae1ea1 +L_OBJC_METH_VAR_NAME_573c1e9c42ae1ea1: .asciz "performSelector:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343 + .globl L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1 .p2align 3 -L_OBJC_SELECTOR_REFERENCES_2c3c38f6ea036343: - .quad L_OBJC_METH_VAR_NAME_2c3c38f6ea036343 +L_OBJC_SELECTOR_REFERENCES_573c1e9c42ae1ea1: + .quad L_OBJC_METH_VAR_NAME_573c1e9c42ae1ea1 .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_e1e97023e8bcf6a4 + .globl L_OBJC_IMAGE_INFO_9885c1be4d03110d .p2align 2 -L_OBJC_IMAGE_INFO_e1e97023e8bcf6a4: +L_OBJC_IMAGE_INFO_9885c1be4d03110d: .asciz "\000\000\000\000@\000\000" .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_e1e97023e8bcf6a4 -L_OBJC_METH_VAR_NAME_e1e97023e8bcf6a4: + .globl L_OBJC_METH_VAR_NAME_9885c1be4d03110d +L_OBJC_METH_VAR_NAME_9885c1be4d03110d: .asciz "performSelector:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4 + .globl L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d .p2align 3 -L_OBJC_SELECTOR_REFERENCES_e1e97023e8bcf6a4: - .quad L_OBJC_METH_VAR_NAME_e1e97023e8bcf6a4 +L_OBJC_SELECTOR_REFERENCES_9885c1be4d03110d: + .quad L_OBJC_METH_VAR_NAME_9885c1be4d03110d .subsections_via_symbols diff --git a/crates/test-assembly/crates/test_msg_send_static_sel/lib.rs b/crates/test-assembly/crates/test_msg_send_static_sel/lib.rs index 0fdb10e9f..d72964d1f 100644 --- a/crates/test-assembly/crates/test_msg_send_static_sel/lib.rs +++ b/crates/test-assembly/crates/test_msg_send_static_sel/lib.rs @@ -1,6 +1,6 @@ //! Test how static selectors work in relation to `msg_send!` and `msg_send_id!` #![cfg(feature = "apple")] -use objc2::rc::{Id, Shared}; +use objc2::rc::Id; use objc2::runtime::{Class, Object, Sel}; use objc2::{msg_send, msg_send_id, sel}; @@ -10,7 +10,7 @@ unsafe fn handle_with_sel(obj: &Object) -> *mut Object { } #[no_mangle] -unsafe fn handle_alloc_init(cls: &Class) -> Id { +unsafe fn handle_alloc_init(cls: &Class) -> Id { msg_send_id![msg_send_id![cls, alloc], init] } diff --git a/crates/test-assembly/crates/test_retain_autoreleased/lib.rs b/crates/test-assembly/crates/test_retain_autoreleased/lib.rs index eafcf6bf7..6d771f860 100644 --- a/crates/test-assembly/crates/test_retain_autoreleased/lib.rs +++ b/crates/test-assembly/crates/test_retain_autoreleased/lib.rs @@ -1,11 +1,11 @@ //! Test that `Id::retain_autoreleased` is inlined properly. -use objc2::rc::{Id, Shared}; +use objc2::rc::Id; use objc2::runtime::{Object, Sel}; use objc2::MessageReceiver; #[no_mangle] -unsafe fn handle(obj: &Object, sel: Sel) -> Option> { +unsafe fn handle(obj: &Object, sel: Sel) -> Option> { let ptr: *mut Object = MessageReceiver::send_message(obj, sel, ()); Id::retain_autoreleased(ptr) } diff --git a/crates/test-ui/ui/declare_add_bad_method.rs b/crates/test-ui/ui/declare_add_bad_method.rs index 028f4245f..258a9d938 100644 --- a/crates/test-ui/ui/declare_add_bad_method.rs +++ b/crates/test-ui/ui/declare_add_bad_method.rs @@ -1,5 +1,5 @@ use objc2::declare::ClassBuilder; -use objc2::rc::{Allocated, Id, Shared}; +use objc2::rc::{Allocated, Id}; use objc2::runtime::{Sel, NSObject}; use objc2::{sel, ClassType}; @@ -24,7 +24,7 @@ fn main() { builder.add_method(sel!(foo), foo as fn(_, _) -> _); } unsafe { - fn foo(_obj: &NSObject, _sel: Sel) -> Id { + fn foo(_obj: &NSObject, _sel: Sel) -> Id { unimplemented!() } builder.add_method(sel!(foo), foo as fn(_, _) -> _); diff --git a/crates/test-ui/ui/declare_class_invalid_receiver.rs b/crates/test-ui/ui/declare_class_invalid_receiver.rs index 085ccc233..e6c781363 100644 --- a/crates/test-ui/ui/declare_class_invalid_receiver.rs +++ b/crates/test-ui/ui/declare_class_invalid_receiver.rs @@ -1,5 +1,5 @@ -use objc2::rc::{Allocated, Id, Shared}; use objc2::{declare_class, ClassType}; +use objc2::rc::{Allocated, Id}; use objc2::runtime::NSObject; declare_class!( @@ -17,7 +17,7 @@ declare_class!( } #[method(test2)] - fn test2(this: Id) { + fn test2(this: Id) { unimplemented!() } @@ -29,29 +29,29 @@ declare_class!( unsafe impl CustomObject { #[method_id(test4)] - fn test4(self: Box) -> Id { + fn test4(self: Box) -> Id { unimplemented!() } #[method_id(test5)] - fn test5(this: Id) -> Id { + fn test5(this: Id) -> Id { unimplemented!() } #[method_id(test6)] - fn test6(this: Self) -> Id { + fn test6(this: Self) -> Id { unimplemented!() } } unsafe impl CustomObject { #[method_id(test7)] - fn test7(this: Allocated) -> Id { + fn test7(this: Allocated) -> Id { unimplemented!() } #[method_id(initTest8)] - fn test8(&self) -> Id { + fn test8(&self) -> Id { unimplemented!() } } diff --git a/crates/test-ui/ui/declare_class_invalid_receiver.stderr b/crates/test-ui/ui/declare_class_invalid_receiver.stderr index 77b16a0a5..f4e191143 100644 --- a/crates/test-ui/ui/declare_class_invalid_receiver.stderr +++ b/crates/test-ui/ui/declare_class_invalid_receiver.stderr @@ -30,7 +30,7 @@ note: required by a bound in `ClassBuilder::add_method` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ClassBuilder::add_method` = note: this error originates in the macro `$crate::__declare_class_register_out` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `extern "C" fn(Id, objc2::runtime::Sel): MethodImplementation` is not satisfied +error[E0277]: the trait bound `extern "C" fn(Id, objc2::runtime::Sel): MethodImplementation` is not satisfied --> ui/declare_class_invalid_receiver.rs | | / declare_class!( @@ -42,7 +42,7 @@ error[E0277]: the trait bound `extern "C" fn(Id, objc2::ru | | ); | | ^ | | | - | |_the trait `MethodImplementation` is not implemented for `extern "C" fn(Id, objc2::runtime::Sel)` + | |_the trait `MethodImplementation` is not implemented for `extern "C" fn(Id, objc2::runtime::Sel)` | required by a bound introduced by this call | = help: the following other types implement trait `MethodImplementation`: @@ -126,7 +126,7 @@ note: required by a bound in `ClassBuilder::add_method` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ClassBuilder::add_method` = note: this error originates in the macro `$crate::__declare_class_register_out` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `extern "C" fn(Id, objc2::runtime::Sel) -> __IdReturnValue: MethodImplementation` is not satisfied +error[E0277]: the trait bound `extern "C" fn(Id, objc2::runtime::Sel) -> __IdReturnValue: MethodImplementation` is not satisfied --> ui/declare_class_invalid_receiver.rs | | / declare_class!( @@ -138,7 +138,7 @@ error[E0277]: the trait bound `extern "C" fn(Id, objc2::ru | | ); | | ^ | | | - | |_the trait `MethodImplementation` is not implemented for `extern "C" fn(Id, objc2::runtime::Sel) -> __IdReturnValue` + | |_the trait `MethodImplementation` is not implemented for `extern "C" fn(Id, objc2::runtime::Sel) -> __IdReturnValue` | required by a bound introduced by this call | = help: the following other types implement trait `MethodImplementation`: @@ -212,10 +212,10 @@ error[E0277]: the trait bound `Box: MessageReceiver` is not satisf *const objc2::runtime::Class *mut T and $N others - = note: required for `RetainSemantics<5>` to implement `MessageRecieveId, Id>` + = note: required for `RetainSemantics<5>` to implement `MessageRecieveId, Id>` = note: this error originates in the macro `$crate::__declare_class_method_out_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `Id: MessageReceiver` is not satisfied +error[E0277]: the trait bound `Id: MessageReceiver` is not satisfied --> ui/declare_class_invalid_receiver.rs | | / declare_class!( @@ -225,12 +225,12 @@ error[E0277]: the trait bound `Id: MessageReceiver` is not ... | | | } | | ); - | |_^ the trait `MessageReceiver` is not implemented for `Id` + | |_^ the trait `MessageReceiver` is not implemented for `Id` | = help: the following other types implement trait `MessageReceiver`: &'a Id &'a mut Id - = note: required for `RetainSemantics<5>` to implement `MessageRecieveId, Id>` + = note: required for `RetainSemantics<5>` to implement `MessageRecieveId, Id>` = note: this error originates in the macro `$crate::__declare_class_method_out_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `CustomObject: MessageReceiver` is not satisfied @@ -255,7 +255,7 @@ error[E0277]: the trait bound `CustomObject: MessageReceiver` is not satisfied *const objc2::runtime::Class *mut T and $N others - = note: required for `RetainSemantics<5>` to implement `MessageRecieveId>` + = note: required for `RetainSemantics<5>` to implement `MessageRecieveId>` = note: this error originates in the macro `$crate::__declare_class_method_out_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Allocated: MessageReceiver` is not satisfied @@ -280,10 +280,10 @@ error[E0277]: the trait bound `Allocated: MessageReceiver` is not *const objc2::runtime::Class *mut T and $N others - = note: required for `RetainSemantics<5>` to implement `MessageRecieveId, Id>` + = note: required for `RetainSemantics<5>` to implement `MessageRecieveId, Id>` = note: this error originates in the macro `$crate::__declare_class_method_out_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `RetainSemantics<3>: MessageRecieveId<&CustomObject, Id>` is not satisfied +error[E0277]: the trait bound `RetainSemantics<3>: MessageRecieveId<&CustomObject, Id>` is not satisfied --> ui/declare_class_invalid_receiver.rs | | / declare_class!( @@ -293,7 +293,7 @@ error[E0277]: the trait bound `RetainSemantics<3>: MessageRecieveId<&CustomObjec ... | | | } | | ); - | |_^ the trait `MessageRecieveId<&CustomObject, Id>` is not implemented for `RetainSemantics<3>` + | |_^ the trait `MessageRecieveId<&CustomObject, Id>` is not implemented for `RetainSemantics<3>` | = help: the trait `MessageRecieveId, Ret>` is implemented for `RetainSemantics<3>` = note: this error originates in the macro `$crate::__declare_class_method_out_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/test-ui/ui/declare_class_invalid_syntax.rs b/crates/test-ui/ui/declare_class_invalid_syntax.rs index 8b5bbe9e3..87d6229cb 100644 --- a/crates/test-ui/ui/declare_class_invalid_syntax.rs +++ b/crates/test-ui/ui/declare_class_invalid_syntax.rs @@ -1,7 +1,7 @@ use std::marker::PhantomData; use objc2::declare::IvarEncode; -use objc2::rc::{Id, Shared}; +use objc2::rc::Id; use objc2::runtime::NSObject; use objc2::{declare_class, ClassType}; @@ -51,27 +51,27 @@ declare_class!( unsafe impl CustomObject { #[method_id(alloc)] - fn test_method_id_bad_selector1() -> Id { + fn test_method_id_bad_selector1() -> Id { unimplemented!() } #[method_id(retain)] - fn test_method_id_bad_selector2() -> Id { + fn test_method_id_bad_selector2() -> Id { unimplemented!() } #[method_id(release)] - fn test_method_id_bad_selector3() -> Id { + fn test_method_id_bad_selector3() -> Id { unimplemented!() } #[method_id(autorelease)] - fn test_method_id_bad_selector4() -> Id { + fn test_method_id_bad_selector4() -> Id { unimplemented!() } #[method_id(dealloc)] - fn test_method_id_bad_selector5() -> Id { + fn test_method_id_bad_selector5() -> Id { unimplemented!() } } diff --git a/crates/test-ui/ui/declare_class_invalid_syntax.stderr b/crates/test-ui/ui/declare_class_invalid_syntax.stderr index 219ddc343..642a63985 100644 --- a/crates/test-ui/ui/declare_class_invalid_syntax.stderr +++ b/crates/test-ui/ui/declare_class_invalid_syntax.stderr @@ -301,7 +301,7 @@ error[E0599]: no function or associated item named `test_self` found for struct | | ); | |_- function or associated item `test_self` not found for this struct -error[E0277]: the trait bound `RetainSemantics<2>: MessageRecieveId<&objc2::runtime::Class, Id>` is not satisfied +error[E0277]: the trait bound `RetainSemantics<2>: MessageRecieveId<&objc2::runtime::Class, Id>` is not satisfied --> ui/declare_class_invalid_syntax.rs | | / declare_class!( @@ -311,7 +311,7 @@ error[E0277]: the trait bound `RetainSemantics<2>: MessageRecieveId<&objc2::runt ... | | | } | | ); - | |_^ the trait `MessageRecieveId<&objc2::runtime::Class, Id>` is not implemented for `RetainSemantics<2>` + | |_^ the trait `MessageRecieveId<&objc2::runtime::Class, Id>` is not implemented for `RetainSemantics<2>` | = help: the following other types implement trait `MessageRecieveId`: as MessageRecieveId> diff --git a/crates/test-ui/ui/declare_class_invalid_type.rs b/crates/test-ui/ui/declare_class_invalid_type.rs index 894f3694c..95ec10e8f 100644 --- a/crates/test-ui/ui/declare_class_invalid_type.rs +++ b/crates/test-ui/ui/declare_class_invalid_type.rs @@ -1,5 +1,5 @@ -use objc2::rc::{Id, Shared}; use objc2::{declare_class, ClassType}; +use objc2::rc::Id; use objc2::runtime::NSObject; declare_class!( @@ -12,7 +12,7 @@ declare_class!( unsafe impl CustomObject { #[method(test1)] - fn test1() -> Id { + fn test1() -> Id { unimplemented!() } diff --git a/crates/test-ui/ui/declare_class_invalid_type.stderr b/crates/test-ui/ui/declare_class_invalid_type.stderr index d5c5efdf5..2d86c0a5c 100644 --- a/crates/test-ui/ui/declare_class_invalid_type.stderr +++ b/crates/test-ui/ui/declare_class_invalid_type.stderr @@ -1,4 +1,4 @@ -error[E0277]: the trait bound `Id: Encode` is not satisfied +error[E0277]: the trait bound `Id: Encode` is not satisfied --> ui/declare_class_invalid_type.rs | | / declare_class!( @@ -8,7 +8,7 @@ error[E0277]: the trait bound `Id: Encode` is not satisfie ... | | | } | | ); - | |_^ the trait `Encode` is not implemented for `Id` + | |_^ the trait `Encode` is not implemented for `Id` | = help: the following other types implement trait `Encode`: &'a T @@ -20,8 +20,8 @@ error[E0277]: the trait bound `Id: Encode` is not satisfie AtomicI16 AtomicI32 and $N others - = note: required for `Id` to implement `EncodeReturn` - = note: required for `Id` to implement `__unstable::convert_private::Sealed` + = note: required for `Id` to implement `EncodeReturn` + = note: required for `Id` to implement `__unstable::convert_private::Sealed` note: required by a bound in `EncodeConvertReturn` --> $WORKSPACE/crates/objc2/src/encode/__unstable.rs | diff --git a/crates/test-ui/ui/declare_class_invalid_type2.rs b/crates/test-ui/ui/declare_class_invalid_type2.rs index 781521a05..908b1b312 100644 --- a/crates/test-ui/ui/declare_class_invalid_type2.rs +++ b/crates/test-ui/ui/declare_class_invalid_type2.rs @@ -1,4 +1,4 @@ -use objc2::rc::{Allocated, Id, Shared}; +use objc2::rc::{Allocated, Id}; use objc2::{declare_class, ClassType}; use objc2::runtime::NSObject; @@ -12,7 +12,7 @@ declare_class!( unsafe impl CustomObject { #[method_id(initNotSameGenerics)] - fn test_init_not_same_generics(this: Allocated) -> Id { + fn test_init_not_same_generics(this: Allocated) -> Id { unimplemented!() } diff --git a/crates/test-ui/ui/declare_class_invalid_type2.stderr b/crates/test-ui/ui/declare_class_invalid_type2.stderr index d0d8051e5..a0fe66ee9 100644 --- a/crates/test-ui/ui/declare_class_invalid_type2.stderr +++ b/crates/test-ui/ui/declare_class_invalid_type2.stderr @@ -1,4 +1,4 @@ -error[E0271]: type mismatch resolving ` as MaybeUnwrap>::Input == Id` +error[E0271]: type mismatch resolving ` as MaybeUnwrap>::Input == Id` --> ui/declare_class_invalid_type2.rs | | / declare_class!( @@ -8,11 +8,11 @@ error[E0271]: type mismatch resolving ` as MaybeUnwrap>::In ... | | | } | | ); - | |_^ expected `Id`, found `Id` + | |_^ expected `Id`, found `Id` | = note: expected struct `Id` found struct `Id` - = note: required for `RetainSemantics<3>` to implement `MessageRecieveId, Id>` + = note: required for `RetainSemantics<3>` to implement `MessageRecieveId, Id>` = note: this error originates in the macro `$crate::__declare_class_method_out_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `i32: MaybeOptionId` is not satisfied diff --git a/crates/test-ui/ui/extern_methods_invalid_type.rs b/crates/test-ui/ui/extern_methods_invalid_type.rs index 6ee124436..cb45498d5 100644 --- a/crates/test-ui/ui/extern_methods_invalid_type.rs +++ b/crates/test-ui/ui/extern_methods_invalid_type.rs @@ -1,6 +1,6 @@ use objc2::{extern_class, extern_methods, ClassType}; +use objc2::rc::Id; use objc2::runtime::NSObject; -use objc2::rc::{Id, Owned, Shared}; extern_class!( pub struct MyObject; @@ -13,7 +13,7 @@ extern_class!( extern_methods!( unsafe impl MyObject { #[method(a)] - fn a(&self) -> Id; + fn a(&self) -> Id; } ); @@ -27,21 +27,21 @@ extern_methods!( extern_methods!( unsafe impl MyObject { #[method_id(init)] - fn init(&mut self) -> Option>; + fn init(&mut self) -> Option>; } ); extern_methods!( unsafe impl MyObject { #[method(error:)] - fn error(arg: i32) -> Result<(), Id>; + fn error(arg: i32) -> Result<(), Id>; } ); extern_methods!( unsafe impl MyObject { #[method_id(error:)] - fn error_id(arg: i32) -> Result, Id>; + fn error_id(arg: i32) -> Result, Id>; } ); diff --git a/crates/test-ui/ui/extern_methods_invalid_type.stderr b/crates/test-ui/ui/extern_methods_invalid_type.stderr index e435c6f98..40681dd5d 100644 --- a/crates/test-ui/ui/extern_methods_invalid_type.stderr +++ b/crates/test-ui/ui/extern_methods_invalid_type.stderr @@ -1,13 +1,13 @@ -error[E0277]: the trait bound `Id: Encode` is not satisfied +error[E0277]: the trait bound `Id: Encode` is not satisfied --> ui/extern_methods_invalid_type.rs | | / extern_methods!( | | unsafe impl MyObject { | | #[method(a)] - | | fn a(&self) -> Id; + | | fn a(&self) -> Id; | | } | | ); - | |_^ the trait `Encode` is not implemented for `Id` + | |_^ the trait `Encode` is not implemented for `Id` | = help: the following other types implement trait `Encode`: &'a T @@ -19,8 +19,8 @@ error[E0277]: the trait bound `Id: Encode` is not sa AtomicI16 AtomicI32 and $N others - = note: required for `Id` to implement `EncodeReturn` - = note: required for `Id` to implement `EncodeConvertReturn` + = note: required for `Id` to implement `EncodeReturn` + = note: required for `Id` to implement `EncodeConvertReturn` note: required by a bound in `send_message` --> $WORKSPACE/crates/objc2/src/message/mod.rs | @@ -57,7 +57,7 @@ error[E0308]: mismatched types | / extern_methods!( | | unsafe impl MyObject { | | #[method_id(init)] - | | fn init(&mut self) -> Option>; + | | fn init(&mut self) -> Option>; | | } | | ); | | ^ @@ -74,16 +74,16 @@ note: associated function defined here | ^^^^^^^^^^^^^^^ = note: this error originates in the macro `$crate::__rewrite_self_arg_inner` which comes from the expansion of the macro `extern_methods` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `Result<(), Id>: Encode` is not satisfied +error[E0277]: the trait bound `Result<(), Id>: Encode` is not satisfied --> ui/extern_methods_invalid_type.rs | | / extern_methods!( | | unsafe impl MyObject { | | #[method(error:)] - | | fn error(arg: i32) -> Result<(), Id>; + | | fn error(arg: i32) -> Result<(), Id>; | | } | | ); - | |_^ the trait `Encode` is not implemented for `Result<(), Id>` + | |_^ the trait `Encode` is not implemented for `Result<(), Id>` | = help: the following other types implement trait `Encode`: &'a T @@ -95,8 +95,8 @@ error[E0277]: the trait bound `Result<(), Id>: Encode` is not AtomicI16 AtomicI32 and $N others - = note: required for `Result<(), Id>` to implement `EncodeReturn` - = note: required for `Result<(), Id>` to implement `EncodeConvertReturn` + = note: required for `Result<(), Id>` to implement `EncodeReturn` + = note: required for `Result<(), Id>` to implement `EncodeConvertReturn` note: required by a bound in `send_message` --> $WORKSPACE/crates/objc2/src/message/mod.rs | @@ -104,16 +104,16 @@ note: required by a bound in `send_message` | ^^^^^^^^^^^^^^^^^^^ required by this bound in `MessageReceiver::send_message` = note: this error originates in the macro `$crate::__msg_send_helper` which comes from the expansion of the macro `extern_methods` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `Result, Id>: MaybeUnwrap` is not satisfied +error[E0277]: the trait bound `Result, Id>: MaybeUnwrap` is not satisfied --> ui/extern_methods_invalid_type.rs | | / extern_methods!( | | unsafe impl MyObject { | | #[method_id(error:)] - | | fn error_id(arg: i32) -> Result, Id>; + | | fn error_id(arg: i32) -> Result, Id>; | | } | | ); - | |_^ the trait `MaybeUnwrap` is not implemented for `Result, Id>` + | |_^ the trait `MaybeUnwrap` is not implemented for `Result, Id>` | = help: the following other types implement trait `MaybeUnwrap`: Allocated diff --git a/crates/test-ui/ui/extern_methods_variadic.rs b/crates/test-ui/ui/extern_methods_variadic.rs index dc41b8630..c4963af3c 100644 --- a/crates/test-ui/ui/extern_methods_variadic.rs +++ b/crates/test-ui/ui/extern_methods_variadic.rs @@ -1,5 +1,5 @@ use objc2::{extern_class, extern_methods, ClassType}; -use objc2::rc::{Id, Shared}; +use objc2::rc::Id; use objc2::runtime::NSObject; extern_class!( @@ -27,14 +27,14 @@ extern_methods!( extern_methods!( unsafe impl MyObject { #[method_id(a:)] - fn variadic_id(arg: i32, arg2: ...) -> Id; + fn variadic_id(arg: i32, arg2: ...) -> Id; } ); extern_methods!( unsafe impl MyObject { #[method(a:_)] - fn variadic_error(arg2: ...) -> Result<(), Id>; + fn variadic_error(arg2: ...) -> Result<(), Id>; } ); diff --git a/crates/test-ui/ui/extern_methods_variadic.stderr b/crates/test-ui/ui/extern_methods_variadic.stderr index e580f0f79..6f796f642 100644 --- a/crates/test-ui/ui/extern_methods_variadic.stderr +++ b/crates/test-ui/ui/extern_methods_variadic.stderr @@ -30,7 +30,7 @@ error: variadic methods are not yet supported | / extern_methods!( | | unsafe impl MyObject { | | #[method_id(a:)] - | | fn variadic_id(arg: i32, arg2: ...) -> Id; + | | fn variadic_id(arg: i32, arg2: ...) -> Id; | | } | | ); | |_^ @@ -43,7 +43,7 @@ error: variadic methods are not yet supported | / extern_methods!( | | unsafe impl MyObject { | | #[method(a:_)] - | | fn variadic_error(arg2: ...) -> Result<(), Id>; + | | fn variadic_error(arg2: ...) -> Result<(), Id>; | | } | | ); | |_^ @@ -65,19 +65,19 @@ error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign or `unsafe extern "C"` functions may be C-variadic --> ui/extern_methods_variadic.rs | - | fn variadic_id(arg: i32, arg2: ...) -> Id; + | fn variadic_id(arg: i32, arg2: ...) -> Id; | ^^^^^^^^^ error: C-variadic function must be declared with at least one named argument --> ui/extern_methods_variadic.rs | - | fn variadic_error(arg2: ...) -> Result<(), Id>; + | fn variadic_error(arg2: ...) -> Result<(), Id>; | ^^^^^^^^^ error: only foreign or `unsafe extern "C"` functions may be C-variadic --> ui/extern_methods_variadic.rs | - | fn variadic_error(arg2: ...) -> Result<(), Id>; + | fn variadic_error(arg2: ...) -> Result<(), Id>; | ^^^^^^^^^ error[E0658]: C-variadic functions are unstable @@ -116,7 +116,7 @@ error[E0658]: C-variadic functions are unstable | / extern_methods!( | | unsafe impl MyObject { | | #[method_id(a:)] - | | fn variadic_id(arg: i32, arg2: ...) -> Id; + | | fn variadic_id(arg: i32, arg2: ...) -> Id; | | } | | ); | |_^ @@ -131,7 +131,7 @@ error[E0658]: C-variadic functions are unstable | / extern_methods!( | | unsafe impl MyObject { | | #[method(a:_)] - | | fn variadic_error(arg2: ...) -> Result<(), Id>; + | | fn variadic_error(arg2: ...) -> Result<(), Id>; | | } | | ); | |_^ diff --git a/crates/test-ui/ui/extern_methods_wrong_arguments_error.rs b/crates/test-ui/ui/extern_methods_wrong_arguments_error.rs index ed072a12a..8e8776857 100644 --- a/crates/test-ui/ui/extern_methods_wrong_arguments_error.rs +++ b/crates/test-ui/ui/extern_methods_wrong_arguments_error.rs @@ -1,6 +1,6 @@ use objc2::{extern_class, extern_methods, ClassType}; +use objc2::rc::Id; use objc2::runtime::NSObject; -use objc2::rc::{Id, Shared}; extern_class!( pub struct MyObject; @@ -13,28 +13,28 @@ extern_class!( extern_methods!( unsafe impl MyObject { #[method(too:few:_)] - fn class_too_few() -> Result<(), Id>; + fn class_too_few() -> Result<(), Id>; } ); extern_methods!( unsafe impl MyObject { #[method(tooMany:_)] - fn class_too_many(arg: i32) -> Result<(), Id>; + fn class_too_many(arg: i32) -> Result<(), Id>; } ); extern_methods!( unsafe impl MyObject { #[method(too:few:_)] - fn too_few(&self) -> Result<(), Id>; + fn too_few(&self) -> Result<(), Id>; } ); extern_methods!( unsafe impl MyObject { #[method(tooMany:_)] - fn too_many(&self, arg: i32) -> Result<(), Id>; + fn too_many(&self, arg: i32) -> Result<(), Id>; } ); diff --git a/crates/test-ui/ui/extern_methods_wrong_arguments_error.stderr b/crates/test-ui/ui/extern_methods_wrong_arguments_error.stderr index 859b61580..86cf2f0b7 100644 --- a/crates/test-ui/ui/extern_methods_wrong_arguments_error.stderr +++ b/crates/test-ui/ui/extern_methods_wrong_arguments_error.stderr @@ -4,7 +4,7 @@ error: number of arguments in function and selector did not match | / extern_methods!( | | unsafe impl MyObject { | | #[method(too:few:_)] - | | fn class_too_few() -> Result<(), Id>; + | | fn class_too_few() -> Result<(), Id>; | | } | | ); | |_^ @@ -17,7 +17,7 @@ error: number of arguments in function and selector did not match | / extern_methods!( | | unsafe impl MyObject { | | #[method(tooMany:_)] - | | fn class_too_many(arg: i32) -> Result<(), Id>; + | | fn class_too_many(arg: i32) -> Result<(), Id>; | | } | | ); | |_^ @@ -30,7 +30,7 @@ error: number of arguments in function and selector did not match | / extern_methods!( | | unsafe impl MyObject { | | #[method(too:few:_)] - | | fn too_few(&self) -> Result<(), Id>; + | | fn too_few(&self) -> Result<(), Id>; | | } | | ); | |_^ @@ -43,7 +43,7 @@ error: number of arguments in function and selector did not match | / extern_methods!( | | unsafe impl MyObject { | | #[method(tooMany:_)] - | | fn too_many(&self, arg: i32) -> Result<(), Id>; + | | fn too_many(&self, arg: i32) -> Result<(), Id>; | | } | | ); | |_^ diff --git a/crates/test-ui/ui/invalid_msg_send.rs b/crates/test-ui/ui/invalid_msg_send.rs index 7cb244783..6c7aa8616 100644 --- a/crates/test-ui/ui/invalid_msg_send.rs +++ b/crates/test-ui/ui/invalid_msg_send.rs @@ -1,6 +1,6 @@ //! Test invalid msg_send syntax use objc2::msg_send; -use objc2::rc::{Id, Shared}; +use objc2::rc::Id; use objc2::runtime::Object; fn main() { @@ -16,5 +16,5 @@ fn main() { let _: () = unsafe { msg_send![obj, a: b: c] }; let _: () = unsafe { msg_send![obj, a: b c: d,] }; - let _: Result<(), Id> = unsafe { msg_send![obj, a: _, b: _] }; + let _: Result<(), Id> = unsafe { msg_send![obj, a: _, b: _] }; } diff --git a/crates/test-ui/ui/invalid_msg_send.stderr b/crates/test-ui/ui/invalid_msg_send.stderr index b1af9373e..f88d8337a 100644 --- a/crates/test-ui/ui/invalid_msg_send.stderr +++ b/crates/test-ui/ui/invalid_msg_send.stderr @@ -75,8 +75,8 @@ note: while trying to match `)` error: no rules expected the token `b` --> ui/invalid_msg_send.rs | - | let _: Result<(), Id> = unsafe { msg_send![obj, a: _, b: _] }; - | ^ no rules expected this token in macro call + | let _: Result<(), Id> = unsafe { msg_send![obj, a: _, b: _] }; + | ^ no rules expected this token in macro call | note: while trying to match `)` --> $WORKSPACE/crates/objc2/src/macros/__msg_send_parse.rs diff --git a/crates/test-ui/ui/msg_send_id_alloc_init_different.rs b/crates/test-ui/ui/msg_send_id_alloc_init_different.rs index 6c196c444..9e2572f10 100644 --- a/crates/test-ui/ui/msg_send_id_alloc_init_different.rs +++ b/crates/test-ui/ui/msg_send_id_alloc_init_different.rs @@ -1,11 +1,11 @@ //! Ensure that `init` returns the same type as given from `alloc`. use objc2::{class, msg_send_id}; -use objc2::rc::{Allocated, Id, Shared}; +use objc2::rc::{Allocated, Id}; use objc2::runtime::{Object, NSObject}; fn main() { let cls = class!(NSObject); let obj: Option> = unsafe { msg_send_id![cls, alloc] }; - let _: Id = unsafe { msg_send_id![obj, init] }; + let _: Id = unsafe { msg_send_id![obj, init] }; } diff --git a/crates/test-ui/ui/msg_send_id_alloc_init_different.stderr b/crates/test-ui/ui/msg_send_id_alloc_init_different.stderr index cae0f3455..f8223d7a9 100644 --- a/crates/test-ui/ui/msg_send_id_alloc_init_different.stderr +++ b/crates/test-ui/ui/msg_send_id_alloc_init_different.stderr @@ -1,8 +1,8 @@ -error[E0271]: type mismatch resolving ` as MaybeUnwrap>::Input == Id` +error[E0271]: type mismatch resolving ` as MaybeUnwrap>::Input == Id` --> ui/msg_send_id_alloc_init_different.rs | - | let _: Id = unsafe { msg_send_id![obj, init] }; - | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Id`, found `Id` + | let _: Id = unsafe { msg_send_id![obj, init] }; + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Id`, found `Id` | = note: expected struct `Id` found struct `Id` diff --git a/crates/test-ui/ui/msg_send_id_invalid_receiver.rs b/crates/test-ui/ui/msg_send_id_invalid_receiver.rs index 12cec21a8..27eaca44b 100644 --- a/crates/test-ui/ui/msg_send_id_invalid_receiver.rs +++ b/crates/test-ui/ui/msg_send_id_invalid_receiver.rs @@ -1,22 +1,22 @@ //! Test compiler output with invalid msg_send_id receivers. use objc2::msg_send_id; -use objc2::rc::{Allocated, Id, Shared}; +use objc2::rc::{Allocated, Id}; use objc2::runtime::{Class, Object}; fn main() { let obj: &Object; let _: Allocated = unsafe { msg_send_id![obj, alloc] }; - let _: Id = unsafe { msg_send_id![obj, init] }; + let _: Id = unsafe { msg_send_id![obj, init] }; let cls: &Class; - let _: Id = unsafe { msg_send_id![cls, init] }; - let obj: Id; - let _: Id = unsafe { msg_send_id![obj, init] }; - let obj: Option>; - let _: Id = unsafe { msg_send_id![obj, init] }; + let _: Id = unsafe { msg_send_id![cls, init] }; + let obj: Id; + let _: Id = unsafe { msg_send_id![obj, init] }; + let obj: Option>; + let _: Id = unsafe { msg_send_id![obj, init] }; - let obj: Id; - let _: Id = unsafe { msg_send_id![obj, new] }; - let obj: Id; - let _: Id = unsafe { msg_send_id![obj, copy] }; + let obj: Id; + let _: Id = unsafe { msg_send_id![obj, new] }; + let obj: Id; + let _: Id = unsafe { msg_send_id![obj, copy] }; } diff --git a/crates/test-ui/ui/msg_send_id_invalid_receiver.stderr b/crates/test-ui/ui/msg_send_id_invalid_receiver.stderr index 322adae30..101b75af4 100644 --- a/crates/test-ui/ui/msg_send_id_invalid_receiver.stderr +++ b/crates/test-ui/ui/msg_send_id_invalid_receiver.stderr @@ -18,11 +18,11 @@ note: associated function defined here error[E0308]: mismatched types --> ui/msg_send_id_invalid_receiver.rs | - | let _: Id = unsafe { msg_send_id![obj, init] }; - | -------------^^^------- - | | | - | | expected `Option>`, found `&Object` - | arguments to this function are incorrect + | let _: Id = unsafe { msg_send_id![obj, init] }; + | -------------^^^------- + | | | + | | expected `Option>`, found `&Object` + | arguments to this function are incorrect | = note: expected enum `Option>` found reference `&objc2::runtime::Object` @@ -35,11 +35,11 @@ note: associated function defined here error[E0308]: mismatched types --> ui/msg_send_id_invalid_receiver.rs | - | let _: Id = unsafe { msg_send_id![cls, init] }; - | -------------^^^------- - | | | - | | expected `Option>`, found `&Class` - | arguments to this function are incorrect + | let _: Id = unsafe { msg_send_id![cls, init] }; + | -------------^^^------- + | | | + | | expected `Option>`, found `&Class` + | arguments to this function are incorrect | = note: expected enum `Option>` found reference `&objc2::runtime::Class` @@ -52,14 +52,14 @@ note: associated function defined here error[E0308]: mismatched types --> ui/msg_send_id_invalid_receiver.rs | - | let _: Id = unsafe { msg_send_id![obj, init] }; - | -------------^^^------- - | | | - | | expected `Option>`, found `Id` - | arguments to this function are incorrect + | let _: Id = unsafe { msg_send_id![obj, init] }; + | -------------^^^------- + | | | + | | expected `Option>`, found `Id` + | arguments to this function are incorrect | = note: expected enum `Option>` - found struct `Id` + found struct `Id` note: associated function defined here --> $WORKSPACE/crates/objc2/src/__macro_helpers.rs | @@ -69,44 +69,44 @@ note: associated function defined here error[E0308]: mismatched types --> ui/msg_send_id_invalid_receiver.rs | - | let _: Id = unsafe { msg_send_id![obj, init] }; - | -------------^^^------- - | | | - | | expected `Option>`, found `Option>` - | arguments to this function are incorrect + | let _: Id = unsafe { msg_send_id![obj, init] }; + | -------------^^^------- + | | | + | | expected `Option>`, found `Option>` + | arguments to this function are incorrect | = note: expected enum `Option>` - found enum `Option>` + found enum `Option>` note: associated function defined here --> $WORKSPACE/crates/objc2/src/__macro_helpers.rs | | unsafe fn send_message_id>( | ^^^^^^^^^^^^^^^ -error[E0277]: the trait bound `Id: MessageReceiver` is not satisfied +error[E0277]: the trait bound `Id: MessageReceiver` is not satisfied --> ui/msg_send_id_invalid_receiver.rs | - | let _: Id = unsafe { msg_send_id![obj, new] }; - | -------------^^^------ - | | | - | | the trait `MessageReceiver` is not implemented for `Id` - | required by a bound introduced by this call + | let _: Id = unsafe { msg_send_id![obj, new] }; + | -------------^^^------ + | | | + | | the trait `MessageReceiver` is not implemented for `Id` + | required by a bound introduced by this call | = help: the following other types implement trait `MessageReceiver`: &'a Id &'a mut Id - = note: required for `RetainSemantics<1>` to implement `MsgSendId, Id<_, _>>` + = note: required for `RetainSemantics<1>` to implement `MsgSendId, Id<_, _>>` -error[E0277]: the trait bound `Id: MessageReceiver` is not satisfied +error[E0277]: the trait bound `Id: MessageReceiver` is not satisfied --> ui/msg_send_id_invalid_receiver.rs | - | let _: Id = unsafe { msg_send_id![obj, copy] }; - | -------------^^^------- - | | | - | | the trait `MessageReceiver` is not implemented for `Id` - | required by a bound introduced by this call + | let _: Id = unsafe { msg_send_id![obj, copy] }; + | -------------^^^------- + | | | + | | the trait `MessageReceiver` is not implemented for `Id` + | required by a bound introduced by this call | = help: the following other types implement trait `MessageReceiver`: &'a Id &'a mut Id - = note: required for `RetainSemantics<4>` to implement `MsgSendId, Id<_, _>>` + = note: required for `RetainSemantics<4>` to implement `MsgSendId, Id<_, _>>` diff --git a/crates/test-ui/ui/msg_send_id_invalid_return.rs b/crates/test-ui/ui/msg_send_id_invalid_return.rs index 664590d15..26c90b7cb 100644 --- a/crates/test-ui/ui/msg_send_id_invalid_return.rs +++ b/crates/test-ui/ui/msg_send_id_invalid_return.rs @@ -1,26 +1,26 @@ //! Test compiler output with invalid msg_send_id return values. use objc2::msg_send_id; -use objc2::rc::{Allocated, Id, Shared}; +use objc2::rc::{Allocated, Id}; use objc2::runtime::{Class, Object, NSObject}; fn main() { let cls: &Class; let _: &Object = unsafe { msg_send_id![cls, new] }; - let _: Id = unsafe { msg_send_id![cls, new] }; - let _: Option> = unsafe { msg_send_id![cls, new] }; + let _: Id = unsafe { msg_send_id![cls, new] }; + let _: Option> = unsafe { msg_send_id![cls, new] }; let _: &Object = unsafe { msg_send_id![cls, alloc] }; let _: Allocated = unsafe { msg_send_id![cls, alloc] }; - let _: Id = unsafe { msg_send_id![cls, alloc] }; + let _: Id = unsafe { msg_send_id![cls, alloc] }; // Earlier design worked like this - let _: Id, Shared> = unsafe { msg_send_id![cls, alloc] }; + let _: Id> = unsafe { msg_send_id![cls, alloc] }; let obj: Option>; let _: &Object = unsafe { msg_send_id![obj, init] }; let obj: Option>; - let _: Id = unsafe { msg_send_id![obj, init] }; + let _: Id = unsafe { msg_send_id![obj, init] }; let obj: Option>; - let _: Id = unsafe { msg_send_id![obj, init] }; + let _: Id = unsafe { msg_send_id![obj, init] }; let obj: &Object; let _: &Object = unsafe { msg_send_id![obj, copy] }; diff --git a/crates/test-ui/ui/msg_send_id_invalid_return.stderr b/crates/test-ui/ui/msg_send_id_invalid_return.stderr index e51ec90d7..96fe77eaf 100644 --- a/crates/test-ui/ui/msg_send_id_invalid_return.stderr +++ b/crates/test-ui/ui/msg_send_id_invalid_return.stderr @@ -19,11 +19,11 @@ note: required by a bound in `send_message_id` error[E0277]: the trait bound `objc2::runtime::Class: Message` is not satisfied --> ui/msg_send_id_invalid_return.rs | - | let _: Id = unsafe { msg_send_id![cls, new] }; - | -------------^^^------ - | | | - | | the trait `Message` is not implemented for `objc2::runtime::Class` - | required by a bound introduced by this call + | let _: Id = unsafe { msg_send_id![cls, new] }; + | -------------^^^------ + | | | + | | the trait `Message` is not implemented for `objc2::runtime::Class` + | required by a bound introduced by this call | = help: the following other types implement trait `Message`: Exception @@ -31,16 +31,16 @@ error[E0277]: the trait bound `objc2::runtime::Class: Message` is not satisfied ProtocolObject

__RcTestObject objc2::runtime::Object - = note: required for `RetainSemantics<1>` to implement `MsgSendId<&objc2::runtime::Class, Id>` + = note: required for `RetainSemantics<1>` to implement `MsgSendId<&objc2::runtime::Class, Id>` error[E0277]: the trait bound `objc2::runtime::Class: Message` is not satisfied --> ui/msg_send_id_invalid_return.rs | - | let _: Option> = unsafe { msg_send_id![cls, new] }; - | -------------^^^------ - | | | - | | the trait `Message` is not implemented for `objc2::runtime::Class` - | required by a bound introduced by this call + | let _: Option> = unsafe { msg_send_id![cls, new] }; + | -------------^^^------ + | | | + | | the trait `Message` is not implemented for `objc2::runtime::Class` + | required by a bound introduced by this call | = help: the following other types implement trait `Message`: Exception @@ -48,7 +48,7 @@ error[E0277]: the trait bound `objc2::runtime::Class: Message` is not satisfied ProtocolObject

__RcTestObject objc2::runtime::Object - = note: required for `RetainSemantics<1>` to implement `MsgSendId<&objc2::runtime::Class, Id>` + = note: required for `RetainSemantics<1>` to implement `MsgSendId<&objc2::runtime::Class, Id>` error[E0277]: the trait bound `&objc2::runtime::Object: MaybeUnwrap` is not satisfied --> ui/msg_send_id_invalid_return.rs @@ -85,14 +85,14 @@ error[E0277]: the trait bound `objc2::runtime::Class: Message` is not satisfied objc2::runtime::Object = note: required for `RetainSemantics<2>` to implement `MsgSendId<&objc2::runtime::Class, Allocated>` -error[E0271]: type mismatch resolving ` as MaybeUnwrap>::Input == Allocated<_>` +error[E0271]: type mismatch resolving ` as MaybeUnwrap>::Input == Allocated<_>` --> ui/msg_send_id_invalid_return.rs | - | let _: Id = unsafe { msg_send_id![cls, alloc] }; - | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `Allocated<_>`, found `Id` + | let _: Id = unsafe { msg_send_id![cls, alloc] }; + | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `Allocated<_>`, found `Id` | = note: expected struct `Allocated<_>` - found struct `Id` + found struct `Id` note: required by a bound in `send_message_id` --> $WORKSPACE/crates/objc2/src/__macro_helpers.rs | @@ -100,14 +100,14 @@ note: required by a bound in `send_message_id` | ^^^^^^^^^ required by this bound in `MsgSendId::send_message_id` = note: this error originates in the macro `msg_send_id` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0271]: type mismatch resolving `, Shared> as MaybeUnwrap>::Input == Allocated<_>` +error[E0271]: type mismatch resolving `> as MaybeUnwrap>::Input == Allocated<_>` --> ui/msg_send_id_invalid_return.rs | - | let _: Id, Shared> = unsafe { msg_send_id![cls, alloc] }; - | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `Allocated<_>`, found `Id, Shared>` + | let _: Id> = unsafe { msg_send_id![cls, alloc] }; + | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `Allocated<_>`, found `Id>` | = note: expected struct `Allocated<_>` - found struct `Id, Shared>` + found struct `Id>` note: required by a bound in `send_message_id` --> $WORKSPACE/crates/objc2/src/__macro_helpers.rs | @@ -133,11 +133,11 @@ note: required by a bound in `send_message_id` | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `MsgSendId::send_message_id` = note: this error originates in the macro `msg_send_id` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0271]: type mismatch resolving ` as MaybeUnwrap>::Input == Id` +error[E0271]: type mismatch resolving ` as MaybeUnwrap>::Input == Id` --> ui/msg_send_id_invalid_return.rs | - | let _: Id = unsafe { msg_send_id![obj, init] }; - | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Id`, found `Id` + | let _: Id = unsafe { msg_send_id![obj, init] }; + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Id`, found `Id` | = note: expected struct `Id` found struct `Id` @@ -148,11 +148,11 @@ note: required by a bound in `send_message_id` | ^^^^^^^^^ required by this bound in `MsgSendId::send_message_id` = note: this error originates in the macro `msg_send_id` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0271]: type mismatch resolving ` as MaybeUnwrap>::Input == Id` +error[E0271]: type mismatch resolving ` as MaybeUnwrap>::Input == Id` --> ui/msg_send_id_invalid_return.rs | - | let _: Id = unsafe { msg_send_id![obj, init] }; - | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Id`, found `Id` + | let _: Id = unsafe { msg_send_id![obj, init] }; + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Id`, found `Id` | = note: expected struct `Id` found struct `Id` diff --git a/crates/test-ui/ui/msg_send_id_unwrap.rs b/crates/test-ui/ui/msg_send_id_unwrap.rs index a4499b972..6f1a38eae 100644 --- a/crates/test-ui/ui/msg_send_id_unwrap.rs +++ b/crates/test-ui/ui/msg_send_id_unwrap.rs @@ -1,9 +1,9 @@ //! Test calling something on return from msg_send_id!. -use objc2::rc::{Id, Owned}; +use objc2::rc::Id; use objc2::runtime::Object; use objc2::{class, msg_send_id}; fn main() { let cls = class!(NSObject); - let _: Id = unsafe { msg_send_id![cls, new].unwrap() }; + let _: Id = unsafe { msg_send_id![cls, new].unwrap() }; } diff --git a/crates/test-ui/ui/msg_send_id_unwrap.stderr b/crates/test-ui/ui/msg_send_id_unwrap.stderr index 01e601178..575b084b5 100644 --- a/crates/test-ui/ui/msg_send_id_unwrap.stderr +++ b/crates/test-ui/ui/msg_send_id_unwrap.stderr @@ -1,8 +1,8 @@ error[E0282]: type annotations needed --> ui/msg_send_id_unwrap.rs | - | let _: Id = unsafe { msg_send_id![cls, new].unwrap() }; - | ^^^^^^^^^^^^^^^^^^^^^^ + | let _: Id = unsafe { msg_send_id![cls, new].unwrap() }; + | ^^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in the macro `msg_send_id` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider giving `result` an explicit type diff --git a/crates/test-ui/ui/msg_send_invalid_error.rs b/crates/test-ui/ui/msg_send_invalid_error.rs index e4cec65d4..d56c448ca 100644 --- a/crates/test-ui/ui/msg_send_invalid_error.rs +++ b/crates/test-ui/ui/msg_send_invalid_error.rs @@ -1,6 +1,6 @@ //! Test that msg_send! error handling works correctly. use objc2::{ClassType, msg_send, msg_send_id}; -use objc2::rc::{Id, Shared}; +use objc2::rc::Id; use icrate::Foundation::NSString; fn main() { @@ -10,7 +10,7 @@ fn main() { let _: () = unsafe { msg_send![obj, a: _] }; let _: Result = unsafe { msg_send![obj, b: _] }; let _: Result<(), i32> = unsafe { msg_send![obj, c: _] }; - let _: Result<(), Id> = unsafe { msg_send![obj, d: _] }; + let _: Result<(), Id> = unsafe { msg_send![obj, d: _] }; // Different calls let _: () = unsafe { msg_send![obj, e: obj, f: _] }; diff --git a/crates/test-ui/ui/msg_send_invalid_error.stderr b/crates/test-ui/ui/msg_send_invalid_error.stderr index da1d1226c..bd195b82b 100644 --- a/crates/test-ui/ui/msg_send_invalid_error.stderr +++ b/crates/test-ui/ui/msg_send_invalid_error.stderr @@ -2,20 +2,20 @@ error[E0308]: mismatched types --> ui/msg_send_invalid_error.rs | | let _: () = unsafe { msg_send![obj, a: _] }; - | ^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Result<(), Id<_, Shared>>` + | ^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Result<(), Id<_>>` | = note: expected unit type `()` - found enum `Result<(), Id<_, Shared>>` + found enum `Result<(), Id<_>>` = note: this error originates in the macro `$crate::__msg_send_helper` which comes from the expansion of the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types --> ui/msg_send_invalid_error.rs | | let _: Result = unsafe { msg_send![obj, b: _] }; - | ^^^^^^^^^^^^^^^^^^^^ expected `Result`, found `Result<(), Id<_, Shared>>` + | ^^^^^^^^^^^^^^^^^^^^ expected `Result`, found `Result<(), Id<_>>` | = note: expected enum `Result` - found enum `Result<(), Id<_, Shared>>` + found enum `Result<(), Id<_>>` = note: this error originates in the macro `$crate::__msg_send_helper` which comes from the expansion of the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) help: try wrapping the expression in `Err` --> $WORKSPACE/crates/objc2/src/macros.rs @@ -27,17 +27,17 @@ error[E0308]: mismatched types --> ui/msg_send_invalid_error.rs | | let _: Result<(), i32> = unsafe { msg_send![obj, c: _] }; - | ^^^^^^^^^^^^^^^^^^^^ expected `Result<(), i32>`, found `Result<(), Id<_, Shared>>` + | ^^^^^^^^^^^^^^^^^^^^ expected `Result<(), i32>`, found `Result<(), Id<_>>` | = note: expected enum `Result<_, i32>` - found enum `Result<_, Id<_, Shared>>` + found enum `Result<_, Id<_>>` = note: this error originates in the macro `$crate::__msg_send_helper` which comes from the expansion of the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `i32: Message` is not satisfied --> ui/msg_send_invalid_error.rs | - | let _: Result<(), Id> = unsafe { msg_send![obj, d: _] }; - | ^^^^^^^^^^^^^^^^^^^^ the trait `Message` is not implemented for `i32` + | let _: Result<(), Id> = unsafe { msg_send![obj, d: _] }; + | ^^^^^^^^^^^^^^^^^^^^ the trait `Message` is not implemented for `i32` | = help: the following other types implement trait `Message`: Exception @@ -60,38 +60,38 @@ error[E0308]: mismatched types --> ui/msg_send_invalid_error.rs | | let _: () = unsafe { msg_send![obj, e: obj, f: _] }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Result<(), Id<_, Shared>>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Result<(), Id<_>>` | = note: expected unit type `()` - found enum `Result<(), Id<_, Shared>>` + found enum `Result<(), Id<_>>` = note: this error originates in the macro `$crate::__msg_send_helper` which comes from the expansion of the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types --> ui/msg_send_invalid_error.rs | | let _: () = unsafe { msg_send![super(obj), g: _] }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Result<(), Id<_, Shared>>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Result<(), Id<_>>` | = note: expected unit type `()` - found enum `Result<(), Id<_, Shared>>` + found enum `Result<(), Id<_>>` = note: this error originates in the macro `$crate::__msg_send_helper` which comes from the expansion of the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types --> ui/msg_send_invalid_error.rs | | let _: () = unsafe { msg_send![super(obj, NSString::class()), h: _] }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Result<(), Id<_, Shared>>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Result<(), Id<_>>` | = note: expected unit type `()` - found enum `Result<(), Id<_, Shared>>` + found enum `Result<(), Id<_>>` = note: this error originates in the macro `$crate::__msg_send_helper` which comes from the expansion of the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types --> ui/msg_send_invalid_error.rs | | let _: () = unsafe { msg_send_id![obj, i: _] }; - | ^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Result, Id<_, Shared>>` + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Result, Id<_>>` | = note: expected unit type `()` - found enum `Result, Id<_, Shared>>` + found enum `Result, Id<_>>` = note: this error originates in the macro `$crate::__msg_send_id_helper` which comes from the expansion of the macro `msg_send_id` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/test-ui/ui/msg_send_underspecified_error.rs b/crates/test-ui/ui/msg_send_underspecified_error.rs index fef0603c6..adf54f3a2 100644 --- a/crates/test-ui/ui/msg_send_underspecified_error.rs +++ b/crates/test-ui/ui/msg_send_underspecified_error.rs @@ -1,6 +1,6 @@ //! Test underspecified msg_send! errors. use objc2::{msg_send, msg_send_id}; -use objc2::rc::{Id, Shared}; +use objc2::rc::Id; use icrate::Foundation::NSString; fn main() { @@ -8,6 +8,6 @@ fn main() { let _: Result<(), _> = unsafe { msg_send![obj, a: _] }; let _: Result<_, _> = unsafe { msg_send_id![obj, b: _] }; - let _: Result, _> = unsafe { msg_send_id![obj, c: _] }; - let _: Result, Id<_, Shared>> = unsafe { msg_send_id![obj, d: _] }; + let _: Result, _> = unsafe { msg_send_id![obj, c: _] }; + let _: Result, Id<_>> = unsafe { msg_send_id![obj, d: _] }; } diff --git a/crates/test-ui/ui/msg_send_underspecified_error.stderr b/crates/test-ui/ui/msg_send_underspecified_error.stderr index 06ae09e4e..b22e82270 100644 --- a/crates/test-ui/ui/msg_send_underspecified_error.stderr +++ b/crates/test-ui/ui/msg_send_underspecified_error.stderr @@ -1,8 +1,8 @@ error[E0282]: type annotations needed --> ui/msg_send_underspecified_error.rs | - | let _: Result, Id<_, Shared>> = unsafe { msg_send_id![obj, d: _] }; - | ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `E` declared on the associated function `send_message_id_error` + | let _: Result, Id<_>> = unsafe { msg_send_id![obj, d: _] }; + | ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `E` declared on the associated function `send_message_id_error` | = note: this error originates in the macro `$crate::__msg_send_id_helper` which comes from the expansion of the macro `msg_send_id` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -45,8 +45,8 @@ note: required by a bound in `send_message_id_error` error[E0283]: type annotations needed --> ui/msg_send_underspecified_error.rs | - | let _: Result, _> = unsafe { msg_send_id![obj, c: _] }; - | ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for raw pointer `*mut _` + | let _: Result, _> = unsafe { msg_send_id![obj, c: _] }; + | ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for raw pointer `*mut _` | = note: multiple `impl`s satisfying `*mut _: RefEncode` found in the `objc2` crate: - impl RefEncode for *mut c_void; @@ -63,8 +63,8 @@ note: required by a bound in `send_message_id_error` error[E0283]: type annotations needed --> ui/msg_send_underspecified_error.rs | - | let _: Result, Id<_, Shared>> = unsafe { msg_send_id![obj, d: _] }; - | ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for raw pointer `*mut _` + | let _: Result, Id<_>> = unsafe { msg_send_id![obj, d: _] }; + | ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for raw pointer `*mut _` | = note: multiple `impl`s satisfying `*mut _: RefEncode` found in the `objc2` crate: - impl RefEncode for *mut c_void; diff --git a/crates/test-ui/ui/msg_send_underspecified_error2.rs b/crates/test-ui/ui/msg_send_underspecified_error2.rs index a6d460944..948ad4a96 100644 --- a/crates/test-ui/ui/msg_send_underspecified_error2.rs +++ b/crates/test-ui/ui/msg_send_underspecified_error2.rs @@ -1,9 +1,9 @@ //! Test underspecified msg_send! errors. use objc2::msg_send_id; -use objc2::rc::{Id, Shared}; +use objc2::rc::Id; use icrate::Foundation::{NSError, NSString}; fn main() { let obj: &NSString; - let _: Result, Id> = unsafe { msg_send_id![obj, a: _] }; + let _: Result, Id> = unsafe { msg_send_id![obj, a: _] }; } diff --git a/crates/test-ui/ui/msg_send_underspecified_error2.stderr b/crates/test-ui/ui/msg_send_underspecified_error2.stderr index 5f0134a80..e5d537fc1 100644 --- a/crates/test-ui/ui/msg_send_underspecified_error2.stderr +++ b/crates/test-ui/ui/msg_send_underspecified_error2.stderr @@ -1,7 +1,12 @@ -error[E0282]: type annotations needed +error[E0282]: type annotations needed for `Result, Id>` --> ui/msg_send_underspecified_error2.rs | - | let _: Result, Id> = unsafe { msg_send_id![obj, a: _] }; - | ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the trait `MsgSendId` + | let _: Result, Id> = unsafe { msg_send_id![obj, a: _] }; + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in the macro `$crate::__msg_send_id_helper` which comes from the expansion of the macro `msg_send_id` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider giving `result` an explicit type, where the placeholders `_` are specified + --> $WORKSPACE/crates/objc2/src/macros.rs + | + | let result: Result, Id>; + | ++++++++++++++++++++++++++++ diff --git a/crates/test-ui/ui/not_writeback.rs b/crates/test-ui/ui/not_writeback.rs index cecbaaea1..d9bc04dae 100644 --- a/crates/test-ui/ui/not_writeback.rs +++ b/crates/test-ui/ui/not_writeback.rs @@ -1,11 +1,11 @@ -use objc2::rc::{Id, Shared, Owned}; +use objc2::rc::{Id, Owned}; use objc2::runtime::NSObject; use objc2::msg_send; fn main() { let obj = &NSObject::new(); - let _: &mut Id = unsafe { msg_send![obj, a] }; + let _: &mut Id = unsafe { msg_send![obj, a] }; let param: Id = NSObject::new(); let _: () = unsafe { msg_send![obj, a: param] }; @@ -16,7 +16,7 @@ fn main() { let param: Id = NSObject::new(); let _: () = unsafe { msg_send![obj, a: Some(¶m)] }; - let param: *mut Id = std::ptr::null_mut(); + let param: *mut Id = std::ptr::null_mut(); let _: () = unsafe { msg_send![obj, a: param] }; let mut param = NSObject::new(); diff --git a/crates/test-ui/ui/not_writeback.stderr b/crates/test-ui/ui/not_writeback.stderr index 667de20d5..9707ec04e 100644 --- a/crates/test-ui/ui/not_writeback.stderr +++ b/crates/test-ui/ui/not_writeback.stderr @@ -1,8 +1,8 @@ -error[E0277]: the trait bound `Id: RefEncode` is not satisfied +error[E0277]: the trait bound `Id: RefEncode` is not satisfied --> ui/not_writeback.rs | - | let _: &mut Id = unsafe { msg_send![obj, a] }; - | ^^^^^^^^^^^^^^^^^ the trait `RefEncode` is not implemented for `Id` + | let _: &mut Id = unsafe { msg_send![obj, a] }; + | ^^^^^^^^^^^^^^^^^ the trait `RefEncode` is not implemented for `Id` | = help: the following other types implement trait `RefEncode`: &'a T @@ -14,9 +14,9 @@ error[E0277]: the trait bound `Id: RefEncode` is not satisfied AtomicI16 AtomicI32 and $N others - = note: required for `&mut Id` to implement `Encode` - = note: required for `&mut Id` to implement `EncodeReturn` - = note: required for `&mut Id` to implement `EncodeConvertReturn` + = note: required for `&mut Id` to implement `Encode` + = note: required for `&mut Id` to implement `EncodeReturn` + = note: required for `&mut Id` to implement `EncodeConvertReturn` note: required by a bound in `send_message` --> $WORKSPACE/crates/objc2/src/message/mod.rs | @@ -112,13 +112,13 @@ note: required by a bound in `send_message` | ^^^^^^^^^^^^^^^^ required by this bound in `MessageReceiver::send_message` = note: this error originates in the macro `$crate::__msg_send_helper` which comes from the expansion of the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `Id: RefEncode` is not satisfied +error[E0277]: the trait bound `Id: RefEncode` is not satisfied --> ui/not_writeback.rs | | let _: () = unsafe { msg_send![obj, a: param] }; | ^^^^^^^^^^^^^^^^^^^^^^^^ | | - | the trait `RefEncode` is not implemented for `Id` + | the trait `RefEncode` is not implemented for `Id` | required by a bound introduced by this call | = help: the following other types implement trait `RefEncode`: @@ -131,9 +131,9 @@ error[E0277]: the trait bound `Id: RefEncode` is not AtomicI16 AtomicI32 and $N others - = note: required for `*mut Id` to implement `Encode` - = note: required for `*mut Id` to implement `EncodeConvertArgument` - = note: required for `(*mut Id,)` to implement `MessageArguments` + = note: required for `*mut Id` to implement `Encode` + = note: required for `*mut Id` to implement `EncodeConvertArgument` + = note: required for `(*mut Id,)` to implement `MessageArguments` note: required by a bound in `send_message` --> $WORKSPACE/crates/objc2/src/message/mod.rs | diff --git a/crates/test-ui/ui/nsarray_bound_not_send_sync.rs b/crates/test-ui/ui/nsarray_bound_not_send_sync.rs index 54160e6d6..21712012d 100644 --- a/crates/test-ui/ui/nsarray_bound_not_send_sync.rs +++ b/crates/test-ui/ui/nsarray_bound_not_send_sync.rs @@ -1,11 +1,10 @@ use icrate::Foundation::NSArray; -use objc2::rc::Shared; use objc2::runtime::Object; fn needs_sync() {} fn needs_send() {} fn main() { - needs_sync::>(); - needs_send::>(); + needs_sync::>(); + needs_send::>(); } diff --git a/crates/test-ui/ui/nsarray_bound_not_send_sync.stderr b/crates/test-ui/ui/nsarray_bound_not_send_sync.stderr index 08a067b83..504509051 100644 --- a/crates/test-ui/ui/nsarray_bound_not_send_sync.stderr +++ b/crates/test-ui/ui/nsarray_bound_not_send_sync.stderr @@ -1,8 +1,8 @@ error[E0277]: `UnsafeCell, PhantomPinned)>>` cannot be shared between threads safely --> ui/nsarray_bound_not_send_sync.rs | - | needs_sync::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell, PhantomPinned)>>` cannot be shared between threads safely + | needs_sync::>(); + | ^^^^^^^^^^^^^^^ `UnsafeCell, PhantomPinned)>>` cannot be shared between threads safely | = help: within `objc2::runtime::Object`, the trait `Sync` is not implemented for `UnsafeCell, PhantomPinned)>>` = note: required because it appears within the type `objc_object` @@ -17,8 +17,8 @@ note: required by a bound in `needs_sync` error[E0277]: `*const UnsafeCell<()>` cannot be sent between threads safely --> ui/nsarray_bound_not_send_sync.rs | - | needs_sync::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^ `*const UnsafeCell<()>` cannot be sent between threads safely + | needs_sync::>(); + | ^^^^^^^^^^^^^^^ `*const UnsafeCell<()>` cannot be sent between threads safely | = help: within `objc2::runtime::Object`, the trait `Send` is not implemented for `*const UnsafeCell<()>` = note: required because it appears within the type `(*const UnsafeCell<()>, PhantomPinned)` @@ -36,8 +36,8 @@ note: required by a bound in `needs_sync` error[E0277]: `UnsafeCell, PhantomPinned)>>` cannot be shared between threads safely --> ui/nsarray_bound_not_send_sync.rs | - | needs_send::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell, PhantomPinned)>>` cannot be shared between threads safely + | needs_send::>(); + | ^^^^^^^^^^^^^^^ `UnsafeCell, PhantomPinned)>>` cannot be shared between threads safely | = help: within `objc2::runtime::Object`, the trait `Sync` is not implemented for `UnsafeCell, PhantomPinned)>>` = note: required because it appears within the type `objc_object` @@ -52,8 +52,8 @@ note: required by a bound in `needs_send` error[E0277]: `*const UnsafeCell<()>` cannot be sent between threads safely --> ui/nsarray_bound_not_send_sync.rs | - | needs_send::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^ `*const UnsafeCell<()>` cannot be sent between threads safely + | needs_send::>(); + | ^^^^^^^^^^^^^^^ `*const UnsafeCell<()>` cannot be sent between threads safely | = help: within `objc2::runtime::Object`, the trait `Send` is not implemented for `*const UnsafeCell<()>` = note: required because it appears within the type `(*const UnsafeCell<()>, PhantomPinned)` diff --git a/crates/test-ui/ui/wrong_optional.rs b/crates/test-ui/ui/wrong_optional.rs index dc9d7c71d..a766ae352 100644 --- a/crates/test-ui/ui/wrong_optional.rs +++ b/crates/test-ui/ui/wrong_optional.rs @@ -1,6 +1,6 @@ use objc2::{extern_class, extern_methods, declare_class, ClassType}; use objc2::runtime::NSObject; -use objc2::rc::{Id, Owned}; +use objc2::rc::Id; extern_class!( pub struct MyObject; @@ -24,7 +24,7 @@ extern_methods!( /// Doc comment #[optional] #[method_id(b)] - fn b(&self) -> Id; + fn b(&self) -> Id; } ); @@ -56,7 +56,7 @@ declare_class!( #[optional] /// Doc comment #[method_id(d)] - fn d(&self) -> Id { + fn d(&self) -> Id { unimplemented!() } } diff --git a/crates/tests/src/exception.rs b/crates/tests/src/exception.rs index 7c26481fa..3a4d32496 100644 --- a/crates/tests/src/exception.rs +++ b/crates/tests/src/exception.rs @@ -3,7 +3,7 @@ use alloc::format; use icrate::Foundation::{NSArray, NSException, NSString}; use objc2::exception::{catch, throw}; use objc2::msg_send; -use objc2::rc::{autoreleasepool, Id, Shared}; +use objc2::rc::{autoreleasepool, Id}; use objc2::runtime::Object; #[track_caller] @@ -118,7 +118,7 @@ fn raise_catch() { fn catch_actual() { let res = unsafe { catch(|| { - let arr: Id, Shared> = NSArray::new(); + let arr: Id> = NSArray::new(); let _obj: *mut Object = msg_send![&arr, objectAtIndex: 0usize]; }) }; diff --git a/crates/tests/src/test_object.rs b/crates/tests/src/test_object.rs index 78cb18bb2..9470fcae7 100644 --- a/crates/tests/src/test_object.rs +++ b/crates/tests/src/test_object.rs @@ -3,8 +3,6 @@ use std::os::raw::c_int; #[cfg(feature = "Foundation_all")] use icrate::Foundation::NSNumber; -#[cfg(feature = "Foundation_all")] -use objc2::rc::Shared; use objc2::rc::{autoreleasepool, AutoreleasePool, Id, Owned}; use objc2::runtime::{Bool, Class, NSObject, NSObjectProtocol, Object, Protocol}; #[cfg(feature = "malloc")] @@ -24,11 +22,11 @@ extern_protocol!( #[cfg(feature = "Foundation_all")] #[method_id(c)] - fn c(&self) -> Id; + fn c(&self) -> Id; #[cfg(feature = "Foundation_all")] #[method_id(d)] - fn d() -> Id; + fn d() -> Id; #[method(e)] #[optional] @@ -41,12 +39,12 @@ extern_protocol!( #[cfg(feature = "Foundation_all")] #[optional] #[method_id(g)] - fn g(&self) -> Id; + fn g(&self) -> Id; #[cfg(feature = "Foundation_all")] #[optional] #[method_id(h)] - fn h() -> Id; + fn h() -> Id; } unsafe impl ProtocolType for dyn MyTestProtocol {