From a9c569bf0a3207c3f5e43b9342d77dc1e17f40bf Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Mon, 7 Aug 2023 11:31:56 +0200 Subject: [PATCH 1/4] Add missing Debug implementations --- crates/block-sys/src/lib.rs | 2 ++ crates/block2/src/lib.rs | 2 ++ crates/icrate/src/Foundation/__macro_helpers/cached.rs | 1 + .../icrate/src/Foundation/__macro_helpers/ns_string.rs | 4 ++++ crates/icrate/src/lib.rs | 2 ++ crates/objc-sys/src/image_info.rs | 1 + crates/objc-sys/src/lib.rs | 1 + crates/objc2-encode/src/encoding.rs | 3 ++- crates/objc2-encode/src/lib.rs | 2 ++ crates/objc2-proc-macros/src/lib.rs | 2 ++ crates/objc2/src/__macro_helpers/cache.rs | 2 ++ crates/objc2/src/__macro_helpers/mod.rs | 3 +++ crates/objc2/src/declare/ivar_bool.rs | 2 ++ crates/objc2/src/declare/ivar_drop.rs | 1 + crates/objc2/src/declare/ivar_encode.rs | 1 + crates/objc2/src/declare/mod.rs | 9 +++++++++ crates/objc2/src/lib.rs | 2 ++ crates/objc2/src/rc/id.rs | 1 + crates/objc2/src/rc/test_object.rs | 1 + 19 files changed, 41 insertions(+), 1 deletion(-) diff --git a/crates/block-sys/src/lib.rs b/crates/block-sys/src/lib.rs index 61b605bd3..a19f8fb84 100644 --- a/crates/block-sys/src/lib.rs +++ b/crates/block-sys/src/lib.rs @@ -14,6 +14,7 @@ #![no_std] #![warn(elided_lifetimes_in_paths)] +#![warn(missing_copy_implementations)] #![deny(non_ascii_idents)] #![warn(unreachable_pub)] #![deny(unsafe_op_in_unsafe_fn)] @@ -291,6 +292,7 @@ pub struct Block_layout { } #[repr(C)] +#[allow(missing_copy_implementations)] pub struct Block_descriptor_header { /// Reserved for future use. Currently always 0. pub reserved: c_ulong, // usize diff --git a/crates/block2/src/lib.rs b/crates/block2/src/lib.rs index 5ee12e786..d5cda24d0 100644 --- a/crates/block2/src/lib.rs +++ b/crates/block2/src/lib.rs @@ -76,6 +76,8 @@ #![no_std] #![warn(elided_lifetimes_in_paths)] +#![warn(missing_copy_implementations)] +#![warn(missing_debug_implementations)] #![warn(missing_docs)] #![deny(non_ascii_idents)] #![warn(unreachable_pub)] diff --git a/crates/icrate/src/Foundation/__macro_helpers/cached.rs b/crates/icrate/src/Foundation/__macro_helpers/cached.rs index 5f249a43e..876a6337e 100644 --- a/crates/icrate/src/Foundation/__macro_helpers/cached.rs +++ b/crates/icrate/src/Foundation/__macro_helpers/cached.rs @@ -6,6 +6,7 @@ use objc2::rc::Id; use objc2::Message; /// Allows storing an `Id` in a static and lazily loading it. +#[derive(Debug)] pub struct CachedId { ptr: AtomicPtr, } diff --git a/crates/icrate/src/Foundation/__macro_helpers/ns_string.rs b/crates/icrate/src/Foundation/__macro_helpers/ns_string.rs index 7458fb238..f6d0b709f 100644 --- a/crates/icrate/src/Foundation/__macro_helpers/ns_string.rs +++ b/crates/icrate/src/Foundation/__macro_helpers/ns_string.rs @@ -1,4 +1,5 @@ #![cfg(feature = "Foundation_NSString")] +#![allow(missing_copy_implementations)] //! Macro for making a static NSString. //! //! This closely follows what clang does, see: @@ -37,6 +38,7 @@ extern "C" { /// [`CFRuntimeBase`]: /// [`CF_CONST_STRING`]: #[repr(C)] +#[derive(Debug)] pub struct CFConstString { isa: &'static AnyClass, // Important that we don't use `usize` here, since that would be wrong on @@ -118,6 +120,7 @@ pub const fn is_ascii_no_nul(bytes: &[u8]) -> bool { true } +#[derive(Debug)] pub struct Utf16Char { pub repr: [u16; 2], pub len: usize, @@ -147,6 +150,7 @@ impl Utf16Char { } } +#[derive(Debug)] pub struct EncodeUtf16Iter { str: &'static [u8], index: usize, diff --git a/crates/icrate/src/lib.rs b/crates/icrate/src/lib.rs index 90b385350..cc31c1e14 100644 --- a/crates/icrate/src/lib.rs +++ b/crates/icrate/src/lib.rs @@ -7,6 +7,8 @@ #![no_std] #![cfg_attr(feature = "unstable-docsrs", feature(doc_auto_cfg))] #![warn(elided_lifetimes_in_paths)] +#![warn(missing_copy_implementations)] +#![warn(missing_debug_implementations)] #![deny(non_ascii_idents)] #![warn(unreachable_pub)] #![deny(unsafe_op_in_unsafe_fn)] diff --git a/crates/objc-sys/src/image_info.rs b/crates/objc-sys/src/image_info.rs index 9c9333322..f177707eb 100644 --- a/crates/objc-sys/src/image_info.rs +++ b/crates/objc-sys/src/image_info.rs @@ -5,6 +5,7 @@ /// only used behind experimental features (`unstable-static-*`). #[repr(C)] #[doc(hidden)] +#[allow(missing_copy_implementations)] pub struct __ImageInfo { // These are not actually `unsigned int`, even though the docs say so /// The version of the image info struct. diff --git a/crates/objc-sys/src/lib.rs b/crates/objc-sys/src/lib.rs index 4cfd1ac89..9790c317f 100644 --- a/crates/objc-sys/src/lib.rs +++ b/crates/objc-sys/src/lib.rs @@ -15,6 +15,7 @@ #![no_std] #![warn(elided_lifetimes_in_paths)] +#![warn(missing_copy_implementations)] #![deny(non_ascii_idents)] #![warn(unreachable_pub)] #![deny(unsafe_op_in_unsafe_fn)] diff --git a/crates/objc2-encode/src/encoding.rs b/crates/objc2-encode/src/encoding.rs index e7917c046..0404f5b61 100644 --- a/crates/objc2-encode/src/encoding.rs +++ b/crates/objc2-encode/src/encoding.rs @@ -34,7 +34,8 @@ use crate::EncodingBox; /// use objc2_encode::Encoding; /// assert!(Encoding::Array(10, &Encoding::FloatComplex).equivalent_to_str("[10jf]")); /// ``` -// Not `Copy`, since this may one day contain `Box` +// Not `Copy`, since this may one day be merged with `EncodingBox` +#[allow(missing_copy_implementations)] #[derive(Clone, Debug, PartialEq, Eq, Hash)] // See #[non_exhaustive] // Maybe we're missing some encodings? diff --git a/crates/objc2-encode/src/lib.rs b/crates/objc2-encode/src/lib.rs index fae47ad26..b005945f1 100644 --- a/crates/objc2-encode/src/lib.rs +++ b/crates/objc2-encode/src/lib.rs @@ -37,6 +37,8 @@ #![no_std] #![warn(elided_lifetimes_in_paths)] +#![warn(missing_copy_implementations)] +#![warn(missing_debug_implementations)] #![warn(missing_docs)] #![deny(non_ascii_idents)] #![warn(unreachable_pub)] diff --git a/crates/objc2-proc-macros/src/lib.rs b/crates/objc2-proc-macros/src/lib.rs index 1c905f20f..4b67518de 100644 --- a/crates/objc2-proc-macros/src/lib.rs +++ b/crates/objc2-proc-macros/src/lib.rs @@ -5,6 +5,8 @@ #![warn(elided_lifetimes_in_paths)] #![warn(missing_docs)] +#![warn(missing_copy_implementations)] +#![warn(missing_debug_implementations)] #![deny(non_ascii_idents)] #![warn(unreachable_pub)] #![deny(unsafe_op_in_unsafe_fn)] diff --git a/crates/objc2/src/__macro_helpers/cache.rs b/crates/objc2/src/__macro_helpers/cache.rs index 32d6cf0bd..5a20aea1e 100644 --- a/crates/objc2/src/__macro_helpers/cache.rs +++ b/crates/objc2/src/__macro_helpers/cache.rs @@ -8,6 +8,7 @@ use crate::ffi; use crate::runtime::{AnyClass, Sel}; /// Allows storing a [`Sel`] in a static and lazily loading it. +#[derive(Debug)] pub struct CachedSel { ptr: AtomicPtr, } @@ -52,6 +53,7 @@ impl CachedSel { } /// Allows storing a [`AnyClass`] reference in a static and lazily loading it. +#[derive(Debug)] pub struct CachedClass { ptr: AtomicPtr, } diff --git a/crates/objc2/src/__macro_helpers/mod.rs b/crates/objc2/src/__macro_helpers/mod.rs index 68047e6c9..b03753df9 100644 --- a/crates/objc2/src/__macro_helpers/mod.rs +++ b/crates/objc2/src/__macro_helpers/mod.rs @@ -58,6 +58,7 @@ pub use self::declare_class::{ /// /// // TODO: Use an enum instead of u8 here when stable +#[derive(Debug)] pub struct RetainSemantics {} pub type New = RetainSemantics<1>; @@ -425,6 +426,7 @@ const fn in_selector_family(mut selector: &[u8], mut family: &[u8]) -> bool { /// /// #[repr(C)] +#[derive(Debug)] pub struct ModuleInfo { version: usize, size: usize, @@ -496,6 +498,7 @@ impl ClassBuilder { /// - Only methods on the protocol are overriden. /// - TODO: The methods have the correct signature. /// - All required methods are overridden. +#[derive(Debug)] pub struct ClassProtocolMethodsBuilder<'a, 'b> { builder: &'a mut ClassBuilder, #[allow(unused)] diff --git a/crates/objc2/src/declare/ivar_bool.rs b/crates/objc2/src/declare/ivar_bool.rs index 00a7da968..f7e1930a5 100644 --- a/crates/objc2/src/declare/ivar_bool.rs +++ b/crates/objc2/src/declare/ivar_bool.rs @@ -10,6 +10,8 @@ use super::InnerIvarType; /// so using C99 `_Bool`; if you want to use `BOOL` in Objective-C, you should /// use `IvarEncode`. #[repr(transparent)] +#[allow(missing_copy_implementations)] +#[allow(missing_debug_implementations)] pub struct IvarBool(bool); unsafe impl Encode for IvarBool { diff --git a/crates/objc2/src/declare/ivar_drop.rs b/crates/objc2/src/declare/ivar_drop.rs index e1a9d6905..0fa488608 100644 --- a/crates/objc2/src/declare/ivar_drop.rs +++ b/crates/objc2/src/declare/ivar_drop.rs @@ -26,6 +26,7 @@ mod private { /// /// Further may be added when the standard library guarantee their layout. #[repr(transparent)] +#[allow(missing_debug_implementations)] pub struct IvarDrop(::Inner); impl super::ivar::private::Sealed for IvarDrop {} diff --git a/crates/objc2/src/declare/ivar_encode.rs b/crates/objc2/src/declare/ivar_encode.rs index 2ff363fe9..3a4300059 100644 --- a/crates/objc2/src/declare/ivar_encode.rs +++ b/crates/objc2/src/declare/ivar_encode.rs @@ -9,6 +9,7 @@ use super::InnerIvarType; // Note: We put the inner type in a `MaybeUninit`, since we may need to access // this type before the inner type has been properly initialized. #[repr(transparent)] +#[allow(missing_debug_implementations)] pub struct IvarEncode(MaybeUninit); // We intentionally don't implement `Drop`, since that may happen before the diff --git a/crates/objc2/src/declare/mod.rs b/crates/objc2/src/declare/mod.rs index b38290146..ae3054abc 100644 --- a/crates/objc2/src/declare/mod.rs +++ b/crates/objc2/src/declare/mod.rs @@ -288,6 +288,7 @@ method_decl_impl!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P); /// `Allocated`, without exposing that implementation to users. #[doc(hidden)] #[repr(transparent)] +#[derive(Debug)] pub struct __IdReturnValue(pub(crate) *mut AnyObject); // SAFETY: `__IdReturnValue` is `#[repr(transparent)]` @@ -745,6 +746,14 @@ impl ProtocolBuilder { } } +impl Drop for ProtocolBuilder { + fn drop(&mut self) { + // We implement Drop to communicate to the type-system that this type + // may drop in the future (once Apple add some way of disposing + // protocols). + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/crates/objc2/src/lib.rs b/crates/objc2/src/lib.rs index 716f477cc..22396917d 100644 --- a/crates/objc2/src/lib.rs +++ b/crates/objc2/src/lib.rs @@ -159,6 +159,8 @@ #![cfg_attr(feature = "unstable-c-unwind", feature(c_unwind))] #![cfg_attr(feature = "unstable-docsrs", feature(doc_cfg, doc_auto_cfg))] #![warn(elided_lifetimes_in_paths)] +#![warn(missing_copy_implementations)] +#![warn(missing_debug_implementations)] #![warn(missing_docs)] #![deny(non_ascii_idents)] #![warn(unreachable_pub)] diff --git a/crates/objc2/src/rc/id.rs b/crates/objc2/src/rc/id.rs index 73012952a..a428982a6 100644 --- a/crates/objc2/src/rc/id.rs +++ b/crates/objc2/src/rc/id.rs @@ -702,6 +702,7 @@ impl fmt::Pointer for Id { } } +#[allow(missing_debug_implementations)] mod private { use crate::runtime::AnyObject; use crate::ClassType; diff --git a/crates/objc2/src/rc/test_object.rs b/crates/objc2/src/rc/test_object.rs index 316b3b8cf..7338c1f49 100644 --- a/crates/objc2/src/rc/test_object.rs +++ b/crates/objc2/src/rc/test_object.rs @@ -8,6 +8,7 @@ use crate::{declare_class, msg_send, msg_send_id, ClassType}; // TODO: Put tests that use this in another crate #[derive(Debug, Clone, Default, PartialEq, Eq)] +#[allow(missing_copy_implementations)] #[doc(hidden)] pub struct __ThreadTestData { pub alloc: usize, From bdd9d39f05ab677eaa1b74d23218ae21355893ad Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Mon, 28 Aug 2023 00:07:59 +0200 Subject: [PATCH 2/4] Add missing error and panic docs --- crates/block-sys/src/lib.rs | 2 ++ crates/block2/src/block.rs | 2 +- crates/block2/src/lib.rs | 2 ++ crates/objc-sys/src/lib.rs | 2 ++ crates/objc2-encode/src/encoding_box.rs | 5 +++++ crates/objc2-encode/src/lib.rs | 2 ++ crates/objc2-proc-macros/src/lib.rs | 2 ++ crates/objc2/src/declare/mod.rs | 5 +++++ crates/objc2/src/exception.rs | 11 +++++++---- crates/objc2/src/lib.rs | 2 ++ crates/objc2/src/rc/test_object.rs | 1 + crates/objc2/src/runtime/mod.rs | 1 + 12 files changed, 32 insertions(+), 5 deletions(-) diff --git a/crates/block-sys/src/lib.rs b/crates/block-sys/src/lib.rs index a19f8fb84..a642c9f86 100644 --- a/crates/block-sys/src/lib.rs +++ b/crates/block-sys/src/lib.rs @@ -20,6 +20,8 @@ #![deny(unsafe_op_in_unsafe_fn)] #![warn(clippy::cargo)] #![warn(clippy::ptr_as_ptr)] +#![warn(clippy::missing_errors_doc)] +#![warn(clippy::missing_panics_doc)] // Update in Cargo.toml as well. #![doc(html_root_url = "https://docs.rs/block-sys/0.2.0")] #![cfg_attr(feature = "unstable-docsrs", feature(doc_auto_cfg, doc_cfg_hide))] diff --git a/crates/block2/src/block.rs b/crates/block2/src/block.rs index 892c0e88b..0b32ad489 100644 --- a/crates/block2/src/block.rs +++ b/crates/block2/src/block.rs @@ -116,7 +116,7 @@ impl Block { let ptr: *const Self = self; let layout = unsafe { ptr.cast::().as_ref().unwrap_unchecked() }; // TODO: Is `invoke` actually ever null? - let invoke = layout.invoke.unwrap(); + let invoke = layout.invoke.unwrap_or_else(|| unreachable!()); unsafe { A::__call_block(invoke, ptr as *mut Self, args) } } diff --git a/crates/block2/src/lib.rs b/crates/block2/src/lib.rs index d5cda24d0..73346095c 100644 --- a/crates/block2/src/lib.rs +++ b/crates/block2/src/lib.rs @@ -84,6 +84,8 @@ #![deny(unsafe_op_in_unsafe_fn)] #![warn(clippy::cargo)] #![warn(clippy::ptr_as_ptr)] +#![warn(clippy::missing_errors_doc)] +#![warn(clippy::missing_panics_doc)] // Update in Cargo.toml as well. #![doc(html_root_url = "https://docs.rs/block2/0.3.0")] diff --git a/crates/objc-sys/src/lib.rs b/crates/objc-sys/src/lib.rs index 9790c317f..90b5217ff 100644 --- a/crates/objc-sys/src/lib.rs +++ b/crates/objc-sys/src/lib.rs @@ -21,6 +21,8 @@ #![deny(unsafe_op_in_unsafe_fn)] #![warn(clippy::cargo)] #![warn(clippy::ptr_as_ptr)] +#![warn(clippy::missing_errors_doc)] +#![warn(clippy::missing_panics_doc)] #![allow(clippy::upper_case_acronyms)] #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] diff --git a/crates/objc2-encode/src/encoding_box.rs b/crates/objc2-encode/src/encoding_box.rs index d3e05f766..e369fbff9 100644 --- a/crates/objc2-encode/src/encoding_box.rs +++ b/crates/objc2-encode/src/encoding_box.rs @@ -111,6 +111,11 @@ impl EncodingBox { /// returned by `method_getTypeEncoding`. /// /// [`from_str`][Self::from_str] is simpler, use that instead if you can. + /// + /// + /// # Errors + /// + /// Returns an error if the string was an ill-formatted encoding string. pub fn from_start_of_str(s: &mut &str) -> Result { let mut parser = Parser::new(s); parser.strip_leading_qualifiers(); diff --git a/crates/objc2-encode/src/lib.rs b/crates/objc2-encode/src/lib.rs index b005945f1..1bb1f564e 100644 --- a/crates/objc2-encode/src/lib.rs +++ b/crates/objc2-encode/src/lib.rs @@ -45,6 +45,8 @@ #![deny(unsafe_op_in_unsafe_fn)] #![warn(clippy::cargo)] #![warn(clippy::ptr_as_ptr)] +#![warn(clippy::missing_errors_doc)] +#![warn(clippy::missing_panics_doc)] // Update in Cargo.toml as well. #![doc(html_root_url = "https://docs.rs/objc2-encode/3.0.0")] #![cfg_attr(feature = "unstable-c-unwind", feature(c_unwind))] diff --git a/crates/objc2-proc-macros/src/lib.rs b/crates/objc2-proc-macros/src/lib.rs index 4b67518de..0c23f88f0 100644 --- a/crates/objc2-proc-macros/src/lib.rs +++ b/crates/objc2-proc-macros/src/lib.rs @@ -12,6 +12,8 @@ #![deny(unsafe_op_in_unsafe_fn)] #![warn(clippy::cargo)] #![warn(clippy::ptr_as_ptr)] +#![warn(clippy::missing_errors_doc)] +#![warn(clippy::missing_panics_doc)] // Update in Cargo.toml as well. #![doc(html_root_url = "https://docs.rs/objc2-proc-macros/0.1.1")] diff --git a/crates/objc2/src/declare/mod.rs b/crates/objc2/src/declare/mod.rs index ae3054abc..8a54835b5 100644 --- a/crates/objc2/src/declare/mod.rs +++ b/crates/objc2/src/declare/mod.rs @@ -666,6 +666,11 @@ impl ProtocolBuilder { /// Constructs a [`ProtocolBuilder`] with the given name. /// /// Returns [`None`] if the protocol couldn't be allocated. + /// + /// + /// # Panics + /// + /// Panics if the name contains an internal NULL byte. pub fn new(name: &str) -> Option { let c_name = CString::new(name).unwrap(); let proto = unsafe { ffi::objc_allocateProtocol(c_name.as_ptr()) }; diff --git a/crates/objc2/src/exception.rs b/crates/objc2/src/exception.rs index 719784ed1..d3e399f91 100644 --- a/crates/objc2/src/exception.rs +++ b/crates/objc2/src/exception.rs @@ -254,6 +254,11 @@ unsafe fn try_no_ret(closure: F) -> Result<(), Option /// Accordingly, if your Rust code is compiled with `panic=abort` this cannot /// catch the exception. /// +/// [`catch_unwind`]: std::panic::catch_unwind +/// +/// +/// # Errors +/// /// Returns a `Result` that is either `Ok` if the closure succeeded without an /// exception being thrown, or an `Err` with the exception. The exception is /// automatically released. @@ -263,8 +268,6 @@ unsafe fn try_no_ret(closure: F) -> Result<(), Option /// technically possible on some systems with `@throw nil`, or in OOM /// situations. /// -/// [`catch_unwind`]: std::panic::catch_unwind -/// /// /// # Safety /// @@ -286,8 +289,8 @@ pub unsafe fn catch( *value_ref = Some(closure()); }; let result = unsafe { try_no_ret(closure) }; - // If the try succeeded, this was set so it's safe to unwrap - result.map(|()| value.unwrap()) + // If the try succeeded, value was set so it's safe to unwrap + result.map(|()| value.unwrap_or_else(|| unreachable!())) } #[cfg(test)] diff --git a/crates/objc2/src/lib.rs b/crates/objc2/src/lib.rs index 22396917d..76be46550 100644 --- a/crates/objc2/src/lib.rs +++ b/crates/objc2/src/lib.rs @@ -167,6 +167,8 @@ #![deny(unsafe_op_in_unsafe_fn)] #![warn(clippy::cargo)] #![warn(clippy::ptr_as_ptr)] +#![warn(clippy::missing_errors_doc)] +#![warn(clippy::missing_panics_doc)] // Update in Cargo.toml as well. #![doc(html_root_url = "https://docs.rs/objc2/0.4.1")] diff --git a/crates/objc2/src/rc/test_object.rs b/crates/objc2/src/rc/test_object.rs index 7338c1f49..debc48b04 100644 --- a/crates/objc2/src/rc/test_object.rs +++ b/crates/objc2/src/rc/test_object.rs @@ -30,6 +30,7 @@ impl __ThreadTestData { } #[track_caller] + #[allow(clippy::missing_panics_doc)] pub fn assert_current(&self) { let current = Self::current(); let mut expected = self.clone(); diff --git a/crates/objc2/src/runtime/mod.rs b/crates/objc2/src/runtime/mod.rs index 236c35335..416e0c04c 100644 --- a/crates/objc2/src/runtime/mod.rs +++ b/crates/objc2/src/runtime/mod.rs @@ -827,6 +827,7 @@ impl AnyClass { /// let result = cls.verify_sel::<(&AnyClass,), bool>(sel); /// assert!(result.is_ok()); /// ``` + #[allow(clippy::missing_errors_doc)] // Written differently in the docs pub fn verify_sel(&self, sel: Sel) -> Result<(), VerificationError> where A: EncodeArguments, From c35731855585e3fff2475b8d20d08cbc6951806f Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Mon, 28 Aug 2023 02:58:44 +0200 Subject: [PATCH 3/4] Fix a few pedantic clippy warnings --- .../src/declare/ivar_forwarding_impls.rs | 12 +- crates/objc2/src/declare/mod.rs | 24 +- crates/objc2/src/message/mod.rs | 6 +- crates/objc2/src/rc/id_forwarding_impls.rs | 13 +- crates/objc2/src/rc/test_object.rs | 2 +- crates/objc2/src/runtime/protocol_object.rs | 37 ++- .../expected/apple-aarch64.s | 250 +++++++++--------- .../test_declare_class/expected/apple-armv7.s | 250 +++++++++--------- .../expected/apple-armv7s.s | 250 +++++++++--------- .../expected/apple-old-x86.s | 180 ++++++------- .../test_declare_class/expected/apple-x86.s | 180 ++++++------- .../expected/apple-x86_64.s | 170 ++++++------ 12 files changed, 687 insertions(+), 687 deletions(-) diff --git a/crates/objc2/src/declare/ivar_forwarding_impls.rs b/crates/objc2/src/declare/ivar_forwarding_impls.rs index 23a16df5e..3b80f25c7 100644 --- a/crates/objc2/src/declare/ivar_forwarding_impls.rs +++ b/crates/objc2/src/declare/ivar_forwarding_impls.rs @@ -14,7 +14,7 @@ use core::fmt; use core::future::Future; use core::hash; use core::iter::FusedIterator; -use core::ops::{Deref, DerefMut}; +use core::ops::Deref; use core::pin::Pin; use core::task::{Context, Poll}; use std::error::Error; @@ -192,25 +192,27 @@ impl FusedIterator for Ivar where ::Target: Fused // impl borrow::Borrow<::Target> for Ivar { // fn borrow(&self) -> &::Target { -// Deref::deref(self) +// self // } // } // // impl borrow::BorrowMut<::Target> for Ivar { // fn borrow_mut(&mut self) -> &mut ::Target { -// DerefMut::deref_mut(self) +// self // } // } impl AsRef<::Target> for Ivar { fn as_ref(&self) -> &::Target { - Deref::deref(self) + // Auto-derefs + self } } impl AsMut<::Target> for Ivar { fn as_mut(&mut self) -> &mut ::Target { - DerefMut::deref_mut(self) + // Auto-derefs + self } } diff --git a/crates/objc2/src/declare/mod.rs b/crates/objc2/src/declare/mod.rs index 8a54835b5..97088959f 100644 --- a/crates/objc2/src/declare/mod.rs +++ b/crates/objc2/src/declare/mod.rs @@ -432,7 +432,7 @@ impl ClassBuilder { self.add_method_inner( sel, F::Args::ENCODINGS, - F::Ret::ENCODING_RETURN, + &F::Ret::ENCODING_RETURN, func.__imp(), ) } @@ -442,7 +442,7 @@ impl ClassBuilder { &mut self, sel: Sel, enc_args: &[Encoding], - enc_ret: Encoding, + enc_ret: &Encoding, func: Imp, ) { let sel_args = sel.number_of_arguments(); @@ -458,14 +458,14 @@ impl ClassBuilder { #[cfg(debug_assertions)] if let Some(superclass) = self.superclass() { if let Some(method) = superclass.instance_method(sel) { - if let Err(err) = crate::verify::verify_method_signature(method, enc_args, &enc_ret) + if let Err(err) = crate::verify::verify_method_signature(method, enc_args, enc_ret) { panic!("declared invalid method -[{} {sel}]: {err}", self.name()) } } } - let types = method_type_encoding(&enc_ret, enc_args); + let types = method_type_encoding(enc_ret, enc_args); let success = Bool::from_raw(unsafe { ffi::class_addMethod(self.as_mut_ptr(), sel.as_ptr(), Some(func), types.as_ptr()) }); @@ -496,7 +496,7 @@ impl ClassBuilder { self.add_class_method_inner( sel, F::Args::ENCODINGS, - F::Ret::ENCODING_RETURN, + &F::Ret::ENCODING_RETURN, func.__imp(), ) } @@ -506,7 +506,7 @@ impl ClassBuilder { &mut self, sel: Sel, enc_args: &[Encoding], - enc_ret: Encoding, + enc_ret: &Encoding, func: Imp, ) { let sel_args = sel.number_of_arguments(); @@ -522,14 +522,14 @@ impl ClassBuilder { #[cfg(debug_assertions)] if let Some(superclass) = self.superclass() { if let Some(method) = superclass.class_method(sel) { - if let Err(err) = crate::verify::verify_method_signature(method, enc_args, &enc_ret) + if let Err(err) = crate::verify::verify_method_signature(method, enc_args, enc_ret) { panic!("declared invalid method +[{} {sel}]: {err}", self.name()) } } } - let types = method_type_encoding(&enc_ret, enc_args); + let types = method_type_encoding(enc_ret, enc_args); let success = Bool::from_raw(unsafe { ffi::class_addMethod( self.metaclass_mut(), @@ -681,7 +681,7 @@ impl ProtocolBuilder { &mut self, sel: Sel, enc_args: &[Encoding], - enc_ret: Encoding, + enc_ret: &Encoding, required: bool, instance_method: bool, ) { @@ -692,7 +692,7 @@ impl ProtocolBuilder { "selector {sel} accepts {sel_args} arguments, but function accepts {}", enc_args.len(), ); - let types = method_type_encoding(&enc_ret, enc_args); + let types = method_type_encoding(enc_ret, enc_args); unsafe { ffi::protocol_addMethodDescription( self.as_mut_ptr(), @@ -713,7 +713,7 @@ impl ProtocolBuilder { self.add_method_description_inner( sel, Args::ENCODINGS, - Ret::ENCODING_RETURN, + &Ret::ENCODING_RETURN, required, true, ) @@ -728,7 +728,7 @@ impl ProtocolBuilder { self.add_method_description_inner( sel, Args::ENCODINGS, - Ret::ENCODING_RETURN, + &Ret::ENCODING_RETURN, required, false, ) diff --git a/crates/objc2/src/message/mod.rs b/crates/objc2/src/message/mod.rs index 68ba65f9f..1cc4ce48f 100644 --- a/crates/objc2/src/message/mod.rs +++ b/crates/objc2/src/message/mod.rs @@ -68,7 +68,7 @@ fn msg_send_check( VerificationError::from(Inner::MethodNotFound) }; - panic_verify(cls, sel, err); + panic_verify(cls, sel, &err); } #[cfg(debug_assertions)] @@ -79,7 +79,7 @@ fn panic_null(sel: Sel) -> ! { #[cfg(debug_assertions)] #[track_caller] -fn panic_verify(cls: &AnyClass, sel: Sel, err: crate::runtime::VerificationError) -> ! { +fn panic_verify(cls: &AnyClass, sel: Sel, err: &crate::runtime::VerificationError) -> ! { panic!( "invalid message send to {}[{cls} {sel}]: {err}", if cls.is_metaclass() { "+" } else { "-" }, @@ -269,7 +269,7 @@ pub unsafe trait MessageReceiver: private::Sealed + Sized { panic_null(sel); } if let Err(err) = superclass.verify_sel::(sel) { - panic_verify(superclass, sel, err); + panic_verify(superclass, sel, &err); } } unsafe { diff --git a/crates/objc2/src/rc/id_forwarding_impls.rs b/crates/objc2/src/rc/id_forwarding_impls.rs index d113aaf7a..90bfad0c4 100644 --- a/crates/objc2/src/rc/id_forwarding_impls.rs +++ b/crates/objc2/src/rc/id_forwarding_impls.rs @@ -13,7 +13,6 @@ use core::cmp::Ordering; use core::fmt; use core::future::Future; use core::hash; -use core::ops::{Deref, DerefMut}; use core::pin::Pin; use core::task::{Context, Poll}; use std::error::Error; @@ -132,25 +131,29 @@ impl fmt::Debug for Id { impl borrow::Borrow for Id { fn borrow(&self) -> &T { - Deref::deref(self) + // Auto-derefs + self } } impl borrow::BorrowMut for Id { fn borrow_mut(&mut self) -> &mut T { - DerefMut::deref_mut(self) + // Auto-derefs + self } } impl AsRef for Id { fn as_ref(&self) -> &T { - Deref::deref(self) + // Auto-derefs + self } } impl AsMut for Id { fn as_mut(&mut self) -> &mut T { - DerefMut::deref_mut(self) + // Auto-derefs + self } } diff --git a/crates/objc2/src/rc/test_object.rs b/crates/objc2/src/rc/test_object.rs index debc48b04..339a8b0ae 100644 --- a/crates/objc2/src/rc/test_object.rs +++ b/crates/objc2/src/rc/test_object.rs @@ -54,7 +54,7 @@ impl __ThreadTestData { } std::thread_local! { - static TEST_DATA: RefCell<__ThreadTestData> = RefCell::new(Default::default()); + static TEST_DATA: RefCell<__ThreadTestData> = RefCell::default(); } declare_class!( diff --git a/crates/objc2/src/runtime/protocol_object.rs b/crates/objc2/src/runtime/protocol_object.rs index 7b4f6688e..cdcaeeab7 100644 --- a/crates/objc2/src/runtime/protocol_object.rs +++ b/crates/objc2/src/runtime/protocol_object.rs @@ -137,29 +137,24 @@ impl hash::Hash for ProtocolObject< impl fmt::Debug for ProtocolObject

{ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let description = self.__description(); - - match description { - // Attempt to format description string - Some(description) => { - // We use a leaking autorelease pool since often the string - // will be UTF-8, and in that case the pool will be - // irrelevant. Also, it allows us to pass the formatter into - // the pool (since it may contain a pool internally that it - // assumes is current when writing). - autoreleasepool_leaking(|pool| { - // SAFETY: `description` selector is guaranteed to always - // return an instance of `NSString`. - let s = unsafe { nsstring_to_str(&description, pool) }; - fmt::Display::fmt(s, f) - }) - } + // Attempt to format description string + if let Some(description) = self.__description() { + // We use a leaking autorelease pool since often the string + // will be UTF-8, and in that case the pool will be + // irrelevant. Also, it allows us to pass the formatter into + // the pool (since it may contain a pool internally that it + // assumes is current when writing). + autoreleasepool_leaking(|pool| { + // SAFETY: `description` selector is guaranteed to always + // return an instance of `NSString`. + let s = unsafe { nsstring_to_str(&description, pool) }; + fmt::Display::fmt(s, f) + }) + } else { // If description was `NULL`, use `AnyObject`'s `Debug` impl // instead - None => { - let obj: &AnyObject = &self.inner; - fmt::Debug::fmt(obj, f) - } + let obj: &AnyObject = &self.inner; + fmt::Debug::fmt(obj, f) } } } diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-aarch64.s b/crates/test-assembly/crates/test_declare_class/expected/apple-aarch64.s index ec60189d2..59304b69b 100644 --- a/crates/test-assembly/crates/test_declare_class/expected/apple-aarch64.s +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-aarch64.s @@ -21,34 +21,34 @@ Lloh1: Lloh2: ldr x2, [x8] Lloh3: - adrp x0, l_anon.[ID].11@PAGE + adrp x0, l_anon.[ID].16@PAGE Lloh4: - add x0, x0, l_anon.[ID].11@PAGEOFF + add x0, x0, l_anon.[ID].16@PAGEOFF mov w1, #15 bl SYM(objc2::declare::ClassBuilder::new::GENERATED_ID, 0) cbz x0, LBB1_4 str x0, [sp] Lloh5: - adrp x1, l_anon.[ID].5@PAGE + adrp x1, l_anon.[ID].11@PAGE Lloh6: - add x1, x1, l_anon.[ID].5@PAGEOFF + add x1, x1, l_anon.[ID].11@PAGEOFF Lloh7: - adrp x5, l_anon.[ID].6@PAGE + adrp x5, l_anon.[ID].12@PAGE Lloh8: - add x5, x5, l_anon.[ID].6@PAGEOFF + add x5, x5, l_anon.[ID].12@PAGEOFF mov x0, sp mov w2, #4 mov w3, #1 mov w4, #0 bl SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) Lloh9: - adrp x1, l_anon.[ID].7@PAGE + adrp x1, l_anon.[ID].13@PAGE Lloh10: - add x1, x1, l_anon.[ID].7@PAGEOFF + add x1, x1, l_anon.[ID].13@PAGEOFF Lloh11: - adrp x19, l_anon.[ID].8@PAGE + adrp x19, l_anon.[ID].2@PAGE Lloh12: - add x19, x19, l_anon.[ID].8@PAGEOFF + add x19, x19, l_anon.[ID].2@PAGEOFF mov x0, sp mov w2, #4 mov w3, #8 @@ -66,9 +66,9 @@ Lloh16: Lloh17: add x20, x20, l_anon.[ID].1@PAGEOFF Lloh18: - adrp x21, l_anon.[ID].12@PAGE + adrp x21, l_anon.[ID].3@PAGE Lloh19: - add x21, x21, l_anon.[ID].12@PAGEOFF + add x21, x21, l_anon.[ID].3@PAGEOFF Lloh20: adrp x5, SYM(::class::{closure#0}::__objc2_dealloc, 0)@PAGE Lloh21: @@ -124,9 +124,9 @@ Lloh35: Lloh36: ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6@PAGEOFF] Lloh37: - adrp x21, l_anon.[ID].13@PAGE + adrp x21, l_anon.[ID].4@PAGE Lloh38: - add x21, x21, l_anon.[ID].13@PAGEOFF + add x21, x21, l_anon.[ID].4@PAGEOFF Lloh39: adrp x5, _method_bool@PAGE Lloh40: @@ -163,9 +163,9 @@ Lloh48: mov x4, x19 bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) Lloh49: - adrp x0, l_anon.[ID].14@PAGE + adrp x0, l_anon.[ID].17@PAGE Lloh50: - add x0, x0, l_anon.[ID].14@PAGEOFF + add x0, x0, l_anon.[ID].17@PAGEOFF mov w1, #9 bl SYM(objc2::runtime::AnyProtocol::get::GENERATED_ID, 0) mov x1, x0 @@ -176,9 +176,9 @@ Lloh51: Lloh52: ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9@PAGEOFF] Lloh53: - adrp x2, l_anon.[ID].17@PAGE + adrp x2, l_anon.[ID].7@PAGE Lloh54: - add x2, x2, l_anon.[ID].17@PAGEOFF + add x2, x2, l_anon.[ID].7@PAGEOFF Lloh55: adrp x5, _copy_with_zone@PAGE Lloh56: @@ -195,13 +195,13 @@ Lloh56: ret LBB1_3: Lloh57: - adrp x0, l_anon.[ID].2@PAGE + adrp x0, l_anon.[ID].8@PAGE Lloh58: - add x0, x0, l_anon.[ID].2@PAGEOFF + add x0, x0, l_anon.[ID].8@PAGEOFF Lloh59: - adrp x2, l_anon.[ID].4@PAGE + adrp x2, l_anon.[ID].10@PAGE Lloh60: - add x2, x2, l_anon.[ID].4@PAGEOFF + add x2, x2, l_anon.[ID].10@PAGEOFF mov w1, #43 bl SYM(core::panicking::panic::GENERATED_ID, 0) LBB1_4: @@ -225,9 +225,9 @@ Lloh66: str x8, [sp, #16] stp x9, xzr, [sp, #24] Lloh67: - adrp x1, l_anon.[ID].10@PAGE + adrp x1, l_anon.[ID].15@PAGE Lloh68: - add x1, x1, l_anon.[ID].10@PAGEOFF + add x1, x1, l_anon.[ID].15@PAGEOFF mov x0, sp bl SYM(core::panicking::panic_fmt::GENERATED_ID, 0) .loh AdrpAdd Lloh3, Lloh4 @@ -298,9 +298,9 @@ Lloh70: cmp x8, #3 b.ne LBB4_3 Lloh71: - adrp x0, l_anon.[ID].11@PAGE + adrp x0, l_anon.[ID].16@PAGE Lloh72: - add x0, x0, l_anon.[ID].11@PAGEOFF + add x0, x0, l_anon.[ID].16@PAGEOFF mov w1, #15 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) cbz x0, LBB4_4 @@ -322,28 +322,28 @@ Lloh75: Lloh76: add x3, x3, l_anon.[ID].0@PAGEOFF Lloh77: - adrp x4, l_anon.[ID].10@PAGE + adrp x4, l_anon.[ID].15@PAGE Lloh78: - add x4, x4, l_anon.[ID].10@PAGEOFF + add x4, x4, l_anon.[ID].15@PAGEOFF add x2, sp, #8 mov w1, #0 bl SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) Lloh79: - adrp x0, l_anon.[ID].11@PAGE + adrp x0, l_anon.[ID].16@PAGE Lloh80: - add x0, x0, l_anon.[ID].11@PAGEOFF + add x0, x0, l_anon.[ID].16@PAGEOFF mov w1, #15 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) cbnz x0, LBB4_2 LBB4_4: Lloh81: - adrp x0, l_anon.[ID].2@PAGE + adrp x0, l_anon.[ID].8@PAGE Lloh82: - add x0, x0, l_anon.[ID].2@PAGEOFF + add x0, x0, l_anon.[ID].8@PAGEOFF Lloh83: - adrp x2, l_anon.[ID].10@PAGE + adrp x2, l_anon.[ID].15@PAGE Lloh84: - add x2, x2, l_anon.[ID].10@PAGEOFF + add x2, x2, l_anon.[ID].15@PAGEOFF mov w1, #43 bl SYM(core::panicking::panic::GENERATED_ID, 0) .loh AdrpAdd Lloh69, Lloh70 @@ -385,26 +385,26 @@ _access_ivars: mov x19, x0 bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) Lloh88: - adrp x1, l_anon.[ID].5@PAGE + adrp x1, l_anon.[ID].11@PAGE Lloh89: - add x1, x1, l_anon.[ID].5@PAGEOFF + add x1, x1, l_anon.[ID].11@PAGEOFF Lloh90: - adrp x3, l_anon.[ID].6@PAGE + adrp x3, l_anon.[ID].12@PAGE Lloh91: - add x3, x3, l_anon.[ID].6@PAGEOFF + add x3, x3, l_anon.[ID].12@PAGEOFF mov w2, #4 bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) ldrb w20, [x19, x0] mov x0, x19 bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) Lloh92: - adrp x1, l_anon.[ID].7@PAGE + adrp x1, l_anon.[ID].13@PAGE Lloh93: - add x1, x1, l_anon.[ID].7@PAGEOFF + add x1, x1, l_anon.[ID].13@PAGEOFF Lloh94: - adrp x3, l_anon.[ID].8@PAGE + adrp x3, l_anon.[ID].2@PAGE Lloh95: - add x3, x3, l_anon.[ID].8@PAGEOFF + add x3, x3, l_anon.[ID].2@PAGEOFF mov w2, #4 bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) ldr x21, [x19, x0] @@ -435,9 +435,9 @@ Lloh97: cmp x8, #3 b.ne LBB7_3 Lloh98: - adrp x0, l_anon.[ID].11@PAGE + adrp x0, l_anon.[ID].16@PAGE Lloh99: - add x0, x0, l_anon.[ID].11@PAGEOFF + add x0, x0, l_anon.[ID].16@PAGEOFF mov w1, #15 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) cbz x0, LBB7_4 @@ -459,28 +459,28 @@ Lloh102: Lloh103: add x3, x3, l_anon.[ID].0@PAGEOFF Lloh104: - adrp x4, l_anon.[ID].10@PAGE + adrp x4, l_anon.[ID].15@PAGE Lloh105: - add x4, x4, l_anon.[ID].10@PAGEOFF + add x4, x4, l_anon.[ID].15@PAGEOFF add x2, sp, #8 mov w1, #0 bl SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) Lloh106: - adrp x0, l_anon.[ID].11@PAGE + adrp x0, l_anon.[ID].16@PAGE Lloh107: - add x0, x0, l_anon.[ID].11@PAGEOFF + add x0, x0, l_anon.[ID].16@PAGEOFF mov w1, #15 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) cbnz x0, LBB7_2 LBB7_4: Lloh108: - adrp x0, l_anon.[ID].2@PAGE + adrp x0, l_anon.[ID].8@PAGE Lloh109: - add x0, x0, l_anon.[ID].2@PAGEOFF + add x0, x0, l_anon.[ID].8@PAGEOFF Lloh110: - adrp x2, l_anon.[ID].10@PAGE + adrp x2, l_anon.[ID].15@PAGE Lloh111: - add x2, x2, l_anon.[ID].10@PAGEOFF + add x2, x2, l_anon.[ID].15@PAGEOFF mov w1, #43 bl SYM(core::panicking::panic::GENERATED_ID, 0) .loh AdrpAdd Lloh96, Lloh97 @@ -502,13 +502,13 @@ SYM(::class::REGISTER_CLASS, 0),8,3 + .section __TEXT,__const .p2align 3, 0x0 l_anon.[ID].12: - .byte 17 + .byte 5 .space 39 - .p2align 3, 0x0 + .section __TEXT,__literal4,4byte_literals l_anon.[ID].13: - .byte 16 - .space 39 + .ascii "_obj" + .section __TEXT,__const l_anon.[ID].14: - .ascii "NSCopying" - -l_anon.[ID].15: - .ascii "_NSZone" + .ascii "crates/$DIR/lib.rs" .section __DATA,__const .p2align 3, 0x0 +l_anon.[ID].15: + .quad l_anon.[ID].14 + .asciz "5\000\000\000\000\000\000\000\013\000\000\000\001\000\000" + + .section __TEXT,__const l_anon.[ID].16: - .byte 28 - .space 7 - .quad l_anon.[ID].15 - .asciz "\007\000\000\000\000\000\000" - .quad l_anon.[ID].1 - .space 8 + .ascii "CustomClassName" - .p2align 3, 0x0 +.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),8,3 l_anon.[ID].17: - .byte 25 - .space 7 - .quad l_anon.[ID].16 - .space 24 + .ascii "NSCopying" - .section __TEXT,__const l_anon.[ID].18: .ascii "could not create new class " @@ -875,7 +875,7 @@ l_anon.[ID].20: .p2align 3, 0x0 l_anon.[ID].21: - .quad l_anon.[ID].11 + .quad l_anon.[ID].16 .asciz "\017\000\000\000\000\000\000" .section __DATA,__objc_imageinfo,regular,no_dead_strip diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-armv7.s b/crates/test-assembly/crates/test_declare_class/expected/apple-armv7.s index f6b37478c..c380efdab 100644 --- a/crates/test-assembly/crates/test_declare_class/expected/apple-armv7.s +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-armv7.s @@ -24,18 +24,18 @@ SYM(::call_once::<::__add_protocol_methods::GENERATED_ID, 0) - movw r2, :lower16:(l_anon.[ID].17-(LPC1_24+8)) + movw r2, :lower16:(l_anon.[ID].7-(LPC1_24+8)) mov r3, #1 - movt r2, :upper16:(l_anon.[ID].17-(LPC1_24+8)) + movt r2, :upper16:(l_anon.[ID].7-(LPC1_24+8)) movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9-(LPC1_25+8)) movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9-(LPC1_25+8)) LPC1_24: @@ -197,11 +197,11 @@ LPC1_26: pop {r8, r10, r11} pop {r4, r5, r7, pc} LBB1_3: - movw r0, :lower16:(l_anon.[ID].2-(LPC1_27+8)) + movw r0, :lower16:(l_anon.[ID].8-(LPC1_27+8)) mov r1, #43 - movt r0, :upper16:(l_anon.[ID].2-(LPC1_27+8)) - movw r2, :lower16:(l_anon.[ID].4-(LPC1_28+8)) - movt r2, :upper16:(l_anon.[ID].4-(LPC1_28+8)) + movt r0, :upper16:(l_anon.[ID].8-(LPC1_27+8)) + movw r2, :lower16:(l_anon.[ID].10-(LPC1_28+8)) + movt r2, :upper16:(l_anon.[ID].10-(LPC1_28+8)) LPC1_27: add r0, pc, r0 LPC1_28: @@ -216,10 +216,10 @@ LBB1_4: movt r2, :upper16:(SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)-(LPC1_30+8)) movw r3, :lower16:(l_anon.[ID].21-(LPC1_31+8)) movt r3, :upper16:(l_anon.[ID].21-(LPC1_31+8)) - movw r1, :lower16:(l_anon.[ID].10-(LPC1_32+8)) + movw r1, :lower16:(l_anon.[ID].15-(LPC1_32+8)) LPC1_29: add r0, pc, r0 - movt r1, :upper16:(l_anon.[ID].10-(LPC1_32+8)) + movt r1, :upper16:(l_anon.[ID].15-(LPC1_32+8)) str r0, [sp, #8] mov r0, #1 str r0, [sp, #20] @@ -276,9 +276,9 @@ LPC4_0: cmp r0, #3 bne LBB4_3 LBB4_1: - movw r0, :lower16:(l_anon.[ID].11-(LPC4_4+8)) + movw r0, :lower16:(l_anon.[ID].16-(LPC4_4+8)) mov r1, #15 - movt r0, :upper16:(l_anon.[ID].11-(LPC4_4+8)) + movt r0, :upper16:(l_anon.[ID].16-(LPC4_4+8)) LPC4_4: add r0, pc, r0 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) @@ -286,11 +286,11 @@ LPC4_4: movne sp, r7 popne {r7, pc} LBB4_2: - movw r0, :lower16:(l_anon.[ID].2-(LPC4_5+8)) + movw r0, :lower16:(l_anon.[ID].8-(LPC4_5+8)) mov r1, #43 - movt r0, :upper16:(l_anon.[ID].2-(LPC4_5+8)) - movw r2, :lower16:(l_anon.[ID].10-(LPC4_6+8)) - movt r2, :upper16:(l_anon.[ID].10-(LPC4_6+8)) + movt r0, :upper16:(l_anon.[ID].8-(LPC4_5+8)) + movw r2, :lower16:(l_anon.[ID].15-(LPC4_6+8)) + movt r2, :upper16:(l_anon.[ID].15-(LPC4_6+8)) LPC4_5: add r0, pc, r0 LPC4_6: @@ -303,8 +303,8 @@ LBB4_3: movt r0, :upper16:(SYM(::class::REGISTER_CLASS, 0)-(LPC4_1+8)) movw r3, :lower16:(l_anon.[ID].0-(LPC4_2+8)) movt r3, :upper16:(l_anon.[ID].0-(LPC4_2+8)) - movw r1, :lower16:(l_anon.[ID].10-(LPC4_3+8)) - movt r1, :upper16:(l_anon.[ID].10-(LPC4_3+8)) + movw r1, :lower16:(l_anon.[ID].15-(LPC4_3+8)) + movt r1, :upper16:(l_anon.[ID].15-(LPC4_3+8)) strb r2, [r7, #-5] sub r2, r7, #5 LPC4_3: @@ -345,11 +345,11 @@ _access_ivars: bl _get_obj mov r4, r0 bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) - movw r1, :lower16:(L_anon.[ID].5-(LPC6_0+8)) + movw r1, :lower16:(L_anon.[ID].11-(LPC6_0+8)) mov r2, #4 - movt r1, :upper16:(L_anon.[ID].5-(LPC6_0+8)) - movw r3, :lower16:(l_anon.[ID].6-(LPC6_1+8)) - movt r3, :upper16:(l_anon.[ID].6-(LPC6_1+8)) + movt r1, :upper16:(L_anon.[ID].11-(LPC6_0+8)) + movw r3, :lower16:(l_anon.[ID].12-(LPC6_1+8)) + movt r3, :upper16:(l_anon.[ID].12-(LPC6_1+8)) LPC6_0: add r1, pc, r1 LPC6_1: @@ -358,11 +358,11 @@ LPC6_1: ldrb r5, [r4, r0] mov r0, r4 bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) - movw r1, :lower16:(L_anon.[ID].7-(LPC6_2+8)) + movw r1, :lower16:(L_anon.[ID].13-(LPC6_2+8)) mov r2, #4 - movt r1, :upper16:(L_anon.[ID].7-(LPC6_2+8)) - movw r3, :lower16:(l_anon.[ID].8-(LPC6_3+8)) - movt r3, :upper16:(l_anon.[ID].8-(LPC6_3+8)) + movt r1, :upper16:(L_anon.[ID].13-(LPC6_2+8)) + movw r3, :lower16:(l_anon.[ID].2-(LPC6_3+8)) + movt r3, :upper16:(l_anon.[ID].2-(LPC6_3+8)) LPC6_2: add r1, pc, r1 LPC6_3: @@ -391,9 +391,9 @@ LPC7_0: cmp r0, #3 bne LBB7_3 LBB7_1: - movw r0, :lower16:(l_anon.[ID].11-(LPC7_4+8)) + movw r0, :lower16:(l_anon.[ID].16-(LPC7_4+8)) mov r1, #15 - movt r0, :upper16:(l_anon.[ID].11-(LPC7_4+8)) + movt r0, :upper16:(l_anon.[ID].16-(LPC7_4+8)) LPC7_4: add r0, pc, r0 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) @@ -401,11 +401,11 @@ LPC7_4: movne sp, r7 popne {r7, pc} LBB7_2: - movw r0, :lower16:(l_anon.[ID].2-(LPC7_5+8)) + movw r0, :lower16:(l_anon.[ID].8-(LPC7_5+8)) mov r1, #43 - movt r0, :upper16:(l_anon.[ID].2-(LPC7_5+8)) - movw r2, :lower16:(l_anon.[ID].10-(LPC7_6+8)) - movt r2, :upper16:(l_anon.[ID].10-(LPC7_6+8)) + movt r0, :upper16:(l_anon.[ID].8-(LPC7_5+8)) + movw r2, :lower16:(l_anon.[ID].15-(LPC7_6+8)) + movt r2, :upper16:(l_anon.[ID].15-(LPC7_6+8)) LPC7_5: add r0, pc, r0 LPC7_6: @@ -418,8 +418,8 @@ LBB7_3: movt r0, :upper16:(SYM(::class::REGISTER_CLASS, 0)-(LPC7_1+8)) movw r3, :lower16:(l_anon.[ID].0-(LPC7_2+8)) movt r3, :upper16:(l_anon.[ID].0-(LPC7_2+8)) - movw r1, :lower16:(l_anon.[ID].10-(LPC7_3+8)) - movt r1, :upper16:(l_anon.[ID].10-(LPC7_3+8)) + movw r1, :lower16:(l_anon.[ID].15-(LPC7_3+8)) + movt r1, :upper16:(l_anon.[ID].15-(LPC7_3+8)) strb r2, [r7, #-5] sub r2, r7, #5 LPC7_3: @@ -444,11 +444,11 @@ SYM(::class::REGISTER_CLASS, 0),4,2 + .section __TEXT,__const .p2align 2, 0x0 l_anon.[ID].12: - .byte 17 + .byte 5 .space 19 - .p2align 2, 0x0 -l_anon.[ID].13: - .space 1 - .space 19 + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].13: + .ascii "_obj" + .section __TEXT,__const l_anon.[ID].14: - .ascii "NSCopying" - -l_anon.[ID].15: - .ascii "_NSZone" + .ascii "crates/$DIR/lib.rs" .section __DATA,__const .p2align 2, 0x0 +l_anon.[ID].15: + .long l_anon.[ID].14 + .asciz "5\000\000\000\013\000\000\000\001\000\000" + + .section __TEXT,__const l_anon.[ID].16: - .byte 28 - .space 3 - .long l_anon.[ID].15 - .asciz "\007\000\000" - .long l_anon.[ID].1 - .space 4 + .ascii "CustomClassName" - .p2align 2, 0x0 +.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),4,2 l_anon.[ID].17: - .byte 25 - .space 3 - .long l_anon.[ID].16 - .space 12 + .ascii "NSCopying" - .section __TEXT,__const l_anon.[ID].18: .ascii "could not create new class " @@ -803,7 +803,7 @@ l_anon.[ID].20: .p2align 2, 0x0 l_anon.[ID].21: - .long l_anon.[ID].11 + .long l_anon.[ID].16 .asciz "\017\000\000" .section __DATA,__objc_imageinfo,regular,no_dead_strip diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-armv7s.s b/crates/test-assembly/crates/test_declare_class/expected/apple-armv7s.s index 718a0d1fe..da99dfe97 100644 --- a/crates/test-assembly/crates/test_declare_class/expected/apple-armv7s.s +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-armv7s.s @@ -24,18 +24,18 @@ SYM(::call_once::<::fmt, 0)-(LPC1_32+8)) movt r3, :upper16:(SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)-(LPC1_32+8)) str r5, [sp, #24] @@ -279,9 +279,9 @@ LPC4_0: cmp r0, #3 bne LBB4_3 LBB4_1: - movw r0, :lower16:(l_anon.[ID].11-(LPC4_4+8)) + movw r0, :lower16:(l_anon.[ID].16-(LPC4_4+8)) mov r1, #15 - movt r0, :upper16:(l_anon.[ID].11-(LPC4_4+8)) + movt r0, :upper16:(l_anon.[ID].16-(LPC4_4+8)) LPC4_4: add r0, pc, r0 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) @@ -289,11 +289,11 @@ LPC4_4: movne sp, r7 popne {r7, pc} LBB4_2: - movw r0, :lower16:(l_anon.[ID].2-(LPC4_5+8)) + movw r0, :lower16:(l_anon.[ID].8-(LPC4_5+8)) mov r1, #43 - movt r0, :upper16:(l_anon.[ID].2-(LPC4_5+8)) - movw r2, :lower16:(l_anon.[ID].10-(LPC4_6+8)) - movt r2, :upper16:(l_anon.[ID].10-(LPC4_6+8)) + movt r0, :upper16:(l_anon.[ID].8-(LPC4_5+8)) + movw r2, :lower16:(l_anon.[ID].15-(LPC4_6+8)) + movt r2, :upper16:(l_anon.[ID].15-(LPC4_6+8)) LPC4_5: add r0, pc, r0 LPC4_6: @@ -306,8 +306,8 @@ LBB4_3: movt r0, :upper16:(SYM(::class::REGISTER_CLASS, 0)-(LPC4_1+8)) movw r3, :lower16:(l_anon.[ID].0-(LPC4_2+8)) movt r3, :upper16:(l_anon.[ID].0-(LPC4_2+8)) - movw r1, :lower16:(l_anon.[ID].10-(LPC4_3+8)) - movt r1, :upper16:(l_anon.[ID].10-(LPC4_3+8)) + movw r1, :lower16:(l_anon.[ID].15-(LPC4_3+8)) + movt r1, :upper16:(l_anon.[ID].15-(LPC4_3+8)) strb r2, [r7, #-5] LPC4_3: add r1, pc, r1 @@ -348,11 +348,11 @@ _access_ivars: bl _get_obj mov r4, r0 bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) - movw r1, :lower16:(L_anon.[ID].5-(LPC6_0+8)) + movw r1, :lower16:(L_anon.[ID].11-(LPC6_0+8)) mov r2, #4 - movt r1, :upper16:(L_anon.[ID].5-(LPC6_0+8)) - movw r3, :lower16:(l_anon.[ID].6-(LPC6_1+8)) - movt r3, :upper16:(l_anon.[ID].6-(LPC6_1+8)) + movt r1, :upper16:(L_anon.[ID].11-(LPC6_0+8)) + movw r3, :lower16:(l_anon.[ID].12-(LPC6_1+8)) + movt r3, :upper16:(l_anon.[ID].12-(LPC6_1+8)) LPC6_0: add r1, pc, r1 LPC6_1: @@ -361,11 +361,11 @@ LPC6_1: ldrb r5, [r4, r0] mov r0, r4 bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) - movw r1, :lower16:(L_anon.[ID].7-(LPC6_2+8)) + movw r1, :lower16:(L_anon.[ID].13-(LPC6_2+8)) mov r2, #4 - movt r1, :upper16:(L_anon.[ID].7-(LPC6_2+8)) - movw r3, :lower16:(l_anon.[ID].8-(LPC6_3+8)) - movt r3, :upper16:(l_anon.[ID].8-(LPC6_3+8)) + movt r1, :upper16:(L_anon.[ID].13-(LPC6_2+8)) + movw r3, :lower16:(l_anon.[ID].2-(LPC6_3+8)) + movt r3, :upper16:(l_anon.[ID].2-(LPC6_3+8)) LPC6_2: add r1, pc, r1 LPC6_3: @@ -394,9 +394,9 @@ LPC7_0: cmp r0, #3 bne LBB7_3 LBB7_1: - movw r0, :lower16:(l_anon.[ID].11-(LPC7_4+8)) + movw r0, :lower16:(l_anon.[ID].16-(LPC7_4+8)) mov r1, #15 - movt r0, :upper16:(l_anon.[ID].11-(LPC7_4+8)) + movt r0, :upper16:(l_anon.[ID].16-(LPC7_4+8)) LPC7_4: add r0, pc, r0 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) @@ -404,11 +404,11 @@ LPC7_4: movne sp, r7 popne {r7, pc} LBB7_2: - movw r0, :lower16:(l_anon.[ID].2-(LPC7_5+8)) + movw r0, :lower16:(l_anon.[ID].8-(LPC7_5+8)) mov r1, #43 - movt r0, :upper16:(l_anon.[ID].2-(LPC7_5+8)) - movw r2, :lower16:(l_anon.[ID].10-(LPC7_6+8)) - movt r2, :upper16:(l_anon.[ID].10-(LPC7_6+8)) + movt r0, :upper16:(l_anon.[ID].8-(LPC7_5+8)) + movw r2, :lower16:(l_anon.[ID].15-(LPC7_6+8)) + movt r2, :upper16:(l_anon.[ID].15-(LPC7_6+8)) LPC7_5: add r0, pc, r0 LPC7_6: @@ -421,8 +421,8 @@ LBB7_3: movt r0, :upper16:(SYM(::class::REGISTER_CLASS, 0)-(LPC7_1+8)) movw r3, :lower16:(l_anon.[ID].0-(LPC7_2+8)) movt r3, :upper16:(l_anon.[ID].0-(LPC7_2+8)) - movw r1, :lower16:(l_anon.[ID].10-(LPC7_3+8)) - movt r1, :upper16:(l_anon.[ID].10-(LPC7_3+8)) + movw r1, :lower16:(l_anon.[ID].15-(LPC7_3+8)) + movt r1, :upper16:(l_anon.[ID].15-(LPC7_3+8)) strb r2, [r7, #-5] LPC7_3: add r1, pc, r1 @@ -447,11 +447,11 @@ SYM(::class::REGISTER_CLASS, 0),4,2 + .section __TEXT,__const .p2align 2, 0x0 l_anon.[ID].12: - .byte 17 + .byte 5 .space 19 - .p2align 2, 0x0 -l_anon.[ID].13: - .space 1 - .space 19 + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].13: + .ascii "_obj" + .section __TEXT,__const l_anon.[ID].14: - .ascii "NSCopying" - -l_anon.[ID].15: - .ascii "_NSZone" + .ascii "crates/$DIR/lib.rs" .section __DATA,__const .p2align 2, 0x0 +l_anon.[ID].15: + .long l_anon.[ID].14 + .asciz "5\000\000\000\013\000\000\000\001\000\000" + + .section __TEXT,__const l_anon.[ID].16: - .byte 28 - .space 3 - .long l_anon.[ID].15 - .asciz "\007\000\000" - .long l_anon.[ID].1 - .space 4 + .ascii "CustomClassName" - .p2align 2, 0x0 +.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),4,2 l_anon.[ID].17: - .byte 25 - .space 3 - .long l_anon.[ID].16 - .space 12 + .ascii "NSCopying" - .section __TEXT,__const l_anon.[ID].18: .ascii "could not create new class " @@ -806,7 +806,7 @@ l_anon.[ID].20: .p2align 2, 0x0 l_anon.[ID].21: - .long l_anon.[ID].11 + .long l_anon.[ID].16 .asciz "\017\000\000" .section __DATA,__objc_imageinfo,regular,no_dead_strip diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-old-x86.s b/crates/test-assembly/crates/test_declare_class/expected/apple-old-x86.s index 736669c17..8226e0df6 100644 --- a/crates/test-assembly/crates/test_declare_class/expected/apple-old-x86.s +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-old-x86.s @@ -25,7 +25,7 @@ L1$pb: je LBB1_3 mov eax, dword ptr [esi + LL_OBJC_CLASS_REFERENCES_NSObject$non_lazy_ptr-L1$pb] sub esp, 4 - lea ecx, [esi + l_anon.[ID].11-L1$pb] + lea ecx, [esi + l_anon.[ID].16-L1$pb] push dword ptr [eax] push 15 push ecx @@ -35,8 +35,8 @@ L1$pb: je LBB1_4 mov dword ptr [ebp - 36], eax sub esp, 8 - lea eax, [esi + l_anon.[ID].6-L1$pb] - lea ecx, [esi + L_anon.[ID].5-L1$pb] + lea eax, [esi + l_anon.[ID].12-L1$pb] + lea ecx, [esi + L_anon.[ID].11-L1$pb] lea ebx, [ebp - 36] push eax push 0 @@ -46,8 +46,8 @@ L1$pb: push ebx call SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) add esp, 24 - lea ecx, [esi + l_anon.[ID].8-L1$pb] - lea eax, [esi + L_anon.[ID].7-L1$pb] + lea ecx, [esi + l_anon.[ID].2-L1$pb] + lea eax, [esi + L_anon.[ID].13-L1$pb] push ecx push 2 push 4 @@ -59,7 +59,7 @@ L1$pb: mov eax, dword ptr [esi + LL_OBJC_SELECTOR_REFERENCES_dealloc$non_lazy_ptr-L1$pb] sub esp, 8 lea ecx, [esi + SYM(::class::{closure#0}::__objc2_dealloc, 0)-L1$pb] - lea edi, [esi + l_anon.[ID].12-L1$pb] + lea edi, [esi + l_anon.[ID].3-L1$pb] lea edx, [esi + l_anon.[ID].1-L1$pb] push ecx push edi @@ -74,7 +74,7 @@ L1$pb: sub esp, 8 lea ecx, [esi + _init-L1$pb] push ecx - lea ecx, [esi + l_anon.[ID].8-L1$pb] + lea ecx, [esi + l_anon.[ID].2-L1$pb] push ecx push 0 push edi @@ -84,7 +84,7 @@ L1$pb: add esp, 24 lea eax, [esi + _class_method-L1$pb] push eax - lea eax, [esi + l_anon.[ID].12-L1$pb] + lea eax, [esi + l_anon.[ID].3-L1$pb] push eax push 0 push edi @@ -94,7 +94,7 @@ L1$pb: add esp, 24 lea eax, [esi + _method-L1$pb] push eax - lea eax, [esi + l_anon.[ID].12-L1$pb] + lea eax, [esi + l_anon.[ID].3-L1$pb] push eax push 0 push edi @@ -103,7 +103,7 @@ L1$pb: call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) add esp, 24 lea eax, [esi + _method_bool-L1$pb] - lea ecx, [esi + l_anon.[ID].13-L1$pb] + lea ecx, [esi + l_anon.[ID].4-L1$pb] push eax push ecx push 1 @@ -114,7 +114,7 @@ L1$pb: add esp, 24 lea eax, [esi + _method_id-L1$pb] push eax - lea edi, [esi + l_anon.[ID].8-L1$pb] + lea edi, [esi + l_anon.[ID].2-L1$pb] push edi push 0 lea eax, [esi + l_anon.[ID].1-L1$pb] @@ -127,13 +127,13 @@ L1$pb: push eax push edi push 1 - lea eax, [esi + l_anon.[ID].13-L1$pb] + lea eax, [esi + l_anon.[ID].4-L1$pb] push eax push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8-L1$pb] push ebx call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) add esp, 24 - lea eax, [esi + l_anon.[ID].14-L1$pb] + lea eax, [esi + l_anon.[ID].17-L1$pb] push 9 push eax call SYM(objc2::runtime::AnyProtocol::get::GENERATED_ID, 0) @@ -143,7 +143,7 @@ L1$pb: call SYM(objc2::__macro_helpers::::__add_protocol_methods::GENERATED_ID, 0) add esp, 8 lea ecx, [esi + _copy_with_zone-L1$pb] - lea edx, [esi + l_anon.[ID].17-L1$pb] + lea edx, [esi + l_anon.[ID].7-L1$pb] push ecx push edi push 1 @@ -162,8 +162,8 @@ L1$pb: ret LBB1_3: sub esp, 4 - lea eax, [esi + l_anon.[ID].4-L1$pb] - lea ecx, [esi + l_anon.[ID].2-L1$pb] + lea eax, [esi + l_anon.[ID].10-L1$pb] + lea ecx, [esi + l_anon.[ID].8-L1$pb] push eax push 43 push ecx @@ -181,7 +181,7 @@ LBB1_4: mov dword ptr [ebp - 28], eax mov dword ptr [ebp - 24], 1 sub esp, 8 - lea eax, [esi + l_anon.[ID].10-L1$pb] + lea eax, [esi + l_anon.[ID].15-L1$pb] lea ecx, [ebp - 36] push eax push ecx @@ -233,7 +233,7 @@ L4$pb: jne LBB4_1 LBB4_2: sub esp, 8 - lea eax, [esi + l_anon.[ID].11-L4$pb] + lea eax, [esi + l_anon.[ID].16-L4$pb] push 15 push eax call SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) @@ -250,7 +250,7 @@ LBB4_1: lea eax, [ebp - 9] mov dword ptr [ebp - 16], eax sub esp, 12 - lea eax, [esi + l_anon.[ID].10-L4$pb] + lea eax, [esi + l_anon.[ID].15-L4$pb] lea ecx, [esi + l_anon.[ID].0-L4$pb] lea edx, [ebp - 16] lea edi, [esi + SYM(::class::REGISTER_CLASS, 0)-L4$pb] @@ -264,8 +264,8 @@ LBB4_1: jmp LBB4_2 LBB4_4: sub esp, 4 - lea eax, [esi + l_anon.[ID].10-L4$pb] - lea ecx, [esi + l_anon.[ID].2-L4$pb] + lea eax, [esi + l_anon.[ID].15-L4$pb] + lea ecx, [esi + l_anon.[ID].8-L4$pb] push eax push 43 push ecx @@ -311,8 +311,8 @@ L6$pb: push eax call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) add esp, 16 - lea ecx, [edi + l_anon.[ID].6-L6$pb] - lea edx, [edi + L_anon.[ID].5-L6$pb] + lea ecx, [edi + l_anon.[ID].12-L6$pb] + lea edx, [edi + L_anon.[ID].11-L6$pb] push ecx push 4 push edx @@ -324,8 +324,8 @@ L6$pb: push esi call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) add esp, 16 - lea ecx, [edi + l_anon.[ID].8-L6$pb] - lea edx, [edi + L_anon.[ID].7-L6$pb] + lea ecx, [edi + l_anon.[ID].2-L6$pb] + lea edx, [edi + L_anon.[ID].13-L6$pb] push ecx push 4 push edx @@ -362,7 +362,7 @@ L7$pb: jne LBB7_1 LBB7_2: sub esp, 8 - lea eax, [esi + l_anon.[ID].11-L7$pb] + lea eax, [esi + l_anon.[ID].16-L7$pb] push 15 push eax call SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) @@ -379,7 +379,7 @@ LBB7_1: lea eax, [ebp - 9] mov dword ptr [ebp - 16], eax sub esp, 12 - lea eax, [esi + l_anon.[ID].10-L7$pb] + lea eax, [esi + l_anon.[ID].15-L7$pb] lea ecx, [esi + l_anon.[ID].0-L7$pb] lea edx, [ebp - 16] lea edi, [esi + SYM(::class::REGISTER_CLASS, 0)-L7$pb] @@ -393,8 +393,8 @@ LBB7_1: jmp LBB7_2 LBB7_4: sub esp, 4 - lea eax, [esi + l_anon.[ID].10-L7$pb] - lea ecx, [esi + l_anon.[ID].2-L7$pb] + lea eax, [esi + l_anon.[ID].15-L7$pb] + lea ecx, [esi + l_anon.[ID].8-L7$pb] push eax push 43 push ecx @@ -417,8 +417,8 @@ L8$pb: push edi call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) add esp, 16 - lea ecx, [ebx + l_anon.[ID].8-L8$pb] - lea edx, [ebx + L_anon.[ID].7-L8$pb] + lea ecx, [ebx + l_anon.[ID].2-L8$pb] + lea edx, [ebx + L_anon.[ID].13-L8$pb] push ecx push 4 push edx @@ -480,8 +480,8 @@ L9$pb: push esi call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) add esp, 16 - lea ecx, [edi + l_anon.[ID].6-L9$pb] - lea edx, [edi + L_anon.[ID].5-L9$pb] + lea ecx, [edi + l_anon.[ID].12-L9$pb] + lea edx, [edi + L_anon.[ID].11-L9$pb] push ecx push 4 push edx @@ -493,8 +493,8 @@ L9$pb: push esi call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) add esp, 16 - lea ecx, [edi + l_anon.[ID].8-L9$pb] - lea edx, [edi + L_anon.[ID].7-L9$pb] + lea ecx, [edi + l_anon.[ID].2-L9$pb] + lea edx, [edi + L_anon.[ID].13-L9$pb] push ecx push 4 push edx @@ -552,8 +552,8 @@ L13$pb: push esi call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) add esp, 16 - lea ecx, [edi + l_anon.[ID].8-L13$pb] - lea edx, [edi + L_anon.[ID].7-L13$pb] + lea ecx, [edi + l_anon.[ID].2-L13$pb] + lea edx, [edi + L_anon.[ID].13-L13$pb] push ecx push 4 push edx @@ -599,9 +599,9 @@ L14$pb: mov ebx, dword ptr [ebp + 8] mov dword ptr [esp], ebx call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) - lea ecx, [edi + l_anon.[ID].8-L14$pb] + lea ecx, [edi + l_anon.[ID].2-L14$pb] mov dword ptr [esp + 12], ecx - lea ecx, [edi + L_anon.[ID].7-L14$pb] + lea ecx, [edi + L_anon.[ID].13-L14$pb] mov dword ptr [esp + 4], ecx mov dword ptr [esp], eax mov dword ptr [esp + 8], 4 @@ -651,8 +651,8 @@ L15$pb: mov ebx, eax call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) add esp, 16 - lea edx, [edi + l_anon.[ID].6-L15$pb] - lea ecx, [edi + L_anon.[ID].5-L15$pb] + lea edx, [edi + l_anon.[ID].12-L15$pb] + lea ecx, [edi + L_anon.[ID].11-L15$pb] push edx push 4 push ecx @@ -664,10 +664,10 @@ L15$pb: push esi call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) add esp, 16 - lea ecx, [edi + l_anon.[ID].6-L15$pb] + lea ecx, [edi + l_anon.[ID].12-L15$pb] push ecx push 4 - lea ecx, [edi + L_anon.[ID].5-L15$pb] + lea ecx, [edi + L_anon.[ID].11-L15$pb] push ecx push eax call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) @@ -677,8 +677,8 @@ L15$pb: push dword ptr [ebp + 8] call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) add esp, 16 - lea ecx, [edi + l_anon.[ID].8-L15$pb] - lea ebx, [edi + L_anon.[ID].7-L15$pb] + lea ecx, [edi + l_anon.[ID].2-L15$pb] + lea ebx, [edi + L_anon.[ID].13-L15$pb] mov dword ptr [ebp - 16], ecx push ecx push 4 @@ -732,86 +732,86 @@ l_anon.[ID].0: l_anon.[ID].1: .byte 0 + .p2align 2, 0x0 l_anon.[ID].2: - .ascii "called `Option::unwrap()` on a `None` value" + .byte 19 + .space 19 + .p2align 2, 0x0 l_anon.[ID].3: - .ascii "$RUSTC/library/std/src/sync/once.rs" + .byte 17 + .space 19 - .section __DATA,__const .p2align 2, 0x0 l_anon.[ID].4: - .long l_anon.[ID].3 - .asciz "p\000\000\000\225\000\000\0002\000\000" + .space 1 + .space 19 - .section __TEXT,__literal4,4byte_literals -L_anon.[ID].5: - .ascii "_foo" +l_anon.[ID].5: + .ascii "_NSZone" - .section __TEXT,__const + .section __DATA,__const .p2align 2, 0x0 l_anon.[ID].6: - .byte 5 - .space 19 + .byte 28 + .space 3 + .long l_anon.[ID].5 + .asciz "\007\000\000" + .long l_anon.[ID].1 + .space 4 - .section __TEXT,__literal4,4byte_literals -L_anon.[ID].7: - .ascii "_obj" + .p2align 2, 0x0 +l_anon.[ID].7: + .byte 25 + .space 3 + .long l_anon.[ID].6 + .space 12 .section __TEXT,__const - .p2align 2, 0x0 l_anon.[ID].8: - .byte 19 - .space 19 + .ascii "called `Option::unwrap()` on a `None` value" l_anon.[ID].9: - .ascii "crates/$DIR/lib.rs" + .ascii "$RUSTC/library/std/src/sync/once.rs" .section __DATA,__const .p2align 2, 0x0 l_anon.[ID].10: .long l_anon.[ID].9 - .asciz "5\000\000\000\013\000\000\000\001\000\000" + .asciz "p\000\000\000\225\000\000\0002\000\000" - .section __TEXT,__const -l_anon.[ID].11: - .ascii "CustomClassName" + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].11: + .ascii "_foo" -.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),4,2 + .section __TEXT,__const .p2align 2, 0x0 l_anon.[ID].12: - .byte 17 + .byte 5 .space 19 - .p2align 2, 0x0 -l_anon.[ID].13: - .space 1 - .space 19 + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].13: + .ascii "_obj" + .section __TEXT,__const l_anon.[ID].14: - .ascii "NSCopying" - -l_anon.[ID].15: - .ascii "_NSZone" + .ascii "crates/$DIR/lib.rs" .section __DATA,__const .p2align 2, 0x0 +l_anon.[ID].15: + .long l_anon.[ID].14 + .asciz "5\000\000\000\013\000\000\000\001\000\000" + + .section __TEXT,__const l_anon.[ID].16: - .byte 28 - .space 3 - .long l_anon.[ID].15 - .asciz "\007\000\000" - .long l_anon.[ID].1 - .space 4 + .ascii "CustomClassName" - .p2align 2, 0x0 +.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),4,2 l_anon.[ID].17: - .byte 25 - .space 3 - .long l_anon.[ID].16 - .space 12 + .ascii "NSCopying" - .section __TEXT,__const l_anon.[ID].18: .ascii "could not create new class " @@ -828,7 +828,7 @@ l_anon.[ID].20: .p2align 2, 0x0 l_anon.[ID].21: - .long l_anon.[ID].11 + .long l_anon.[ID].16 .asciz "\017\000\000" .section __OBJC,__image_info diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-x86.s b/crates/test-assembly/crates/test_declare_class/expected/apple-x86.s index cb0432314..79f70b9c1 100644 --- a/crates/test-assembly/crates/test_declare_class/expected/apple-x86.s +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-x86.s @@ -25,7 +25,7 @@ L1$pb: je LBB1_3 mov eax, dword ptr [esi + LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-L1$pb] sub esp, 4 - lea ecx, [esi + l_anon.[ID].11-L1$pb] + lea ecx, [esi + l_anon.[ID].16-L1$pb] push dword ptr [eax] push 15 push ecx @@ -35,8 +35,8 @@ L1$pb: je LBB1_4 mov dword ptr [ebp - 36], eax sub esp, 8 - lea eax, [esi + l_anon.[ID].6-L1$pb] - lea ecx, [esi + L_anon.[ID].5-L1$pb] + lea eax, [esi + l_anon.[ID].12-L1$pb] + lea ecx, [esi + L_anon.[ID].11-L1$pb] lea ebx, [ebp - 36] push eax push 0 @@ -46,8 +46,8 @@ L1$pb: push ebx call SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) add esp, 24 - lea ecx, [esi + l_anon.[ID].8-L1$pb] - lea eax, [esi + L_anon.[ID].7-L1$pb] + lea ecx, [esi + l_anon.[ID].2-L1$pb] + lea eax, [esi + L_anon.[ID].13-L1$pb] push ecx push 2 push 4 @@ -59,7 +59,7 @@ L1$pb: mov eax, dword ptr [esi + LL_OBJC_SELECTOR_REFERENCES_dealloc$non_lazy_ptr-L1$pb] sub esp, 8 lea ecx, [esi + SYM(::class::{closure#0}::__objc2_dealloc, 0)-L1$pb] - lea edi, [esi + l_anon.[ID].12-L1$pb] + lea edi, [esi + l_anon.[ID].3-L1$pb] lea edx, [esi + l_anon.[ID].1-L1$pb] push ecx push edi @@ -74,7 +74,7 @@ L1$pb: sub esp, 8 lea ecx, [esi + _init-L1$pb] push ecx - lea ecx, [esi + l_anon.[ID].8-L1$pb] + lea ecx, [esi + l_anon.[ID].2-L1$pb] push ecx push 0 push edi @@ -84,7 +84,7 @@ L1$pb: add esp, 24 lea eax, [esi + _class_method-L1$pb] push eax - lea eax, [esi + l_anon.[ID].12-L1$pb] + lea eax, [esi + l_anon.[ID].3-L1$pb] push eax push 0 push edi @@ -94,7 +94,7 @@ L1$pb: add esp, 24 lea eax, [esi + _method-L1$pb] push eax - lea eax, [esi + l_anon.[ID].12-L1$pb] + lea eax, [esi + l_anon.[ID].3-L1$pb] push eax push 0 push edi @@ -103,7 +103,7 @@ L1$pb: call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) add esp, 24 lea eax, [esi + _method_bool-L1$pb] - lea ecx, [esi + l_anon.[ID].13-L1$pb] + lea ecx, [esi + l_anon.[ID].4-L1$pb] push eax push ecx push 1 @@ -114,7 +114,7 @@ L1$pb: add esp, 24 lea eax, [esi + _method_id-L1$pb] push eax - lea edi, [esi + l_anon.[ID].8-L1$pb] + lea edi, [esi + l_anon.[ID].2-L1$pb] push edi push 0 lea eax, [esi + l_anon.[ID].1-L1$pb] @@ -127,13 +127,13 @@ L1$pb: push eax push edi push 1 - lea eax, [esi + l_anon.[ID].13-L1$pb] + lea eax, [esi + l_anon.[ID].4-L1$pb] push eax push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8-L1$pb] push ebx call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) add esp, 24 - lea eax, [esi + l_anon.[ID].14-L1$pb] + lea eax, [esi + l_anon.[ID].17-L1$pb] push 9 push eax call SYM(objc2::runtime::AnyProtocol::get::GENERATED_ID, 0) @@ -143,7 +143,7 @@ L1$pb: call SYM(objc2::__macro_helpers::::__add_protocol_methods::GENERATED_ID, 0) add esp, 8 lea ecx, [esi + _copy_with_zone-L1$pb] - lea edx, [esi + l_anon.[ID].17-L1$pb] + lea edx, [esi + l_anon.[ID].7-L1$pb] push ecx push edi push 1 @@ -162,8 +162,8 @@ L1$pb: ret LBB1_3: sub esp, 4 - lea eax, [esi + l_anon.[ID].4-L1$pb] - lea ecx, [esi + l_anon.[ID].2-L1$pb] + lea eax, [esi + l_anon.[ID].10-L1$pb] + lea ecx, [esi + l_anon.[ID].8-L1$pb] push eax push 43 push ecx @@ -181,7 +181,7 @@ LBB1_4: mov dword ptr [ebp - 28], eax mov dword ptr [ebp - 24], 1 sub esp, 8 - lea eax, [esi + l_anon.[ID].10-L1$pb] + lea eax, [esi + l_anon.[ID].15-L1$pb] lea ecx, [ebp - 36] push eax push ecx @@ -233,7 +233,7 @@ L4$pb: jne LBB4_1 LBB4_2: sub esp, 8 - lea eax, [esi + l_anon.[ID].11-L4$pb] + lea eax, [esi + l_anon.[ID].16-L4$pb] push 15 push eax call SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) @@ -250,7 +250,7 @@ LBB4_1: lea eax, [ebp - 9] mov dword ptr [ebp - 16], eax sub esp, 12 - lea eax, [esi + l_anon.[ID].10-L4$pb] + lea eax, [esi + l_anon.[ID].15-L4$pb] lea ecx, [esi + l_anon.[ID].0-L4$pb] lea edx, [ebp - 16] lea edi, [esi + SYM(::class::REGISTER_CLASS, 0)-L4$pb] @@ -264,8 +264,8 @@ LBB4_1: jmp LBB4_2 LBB4_4: sub esp, 4 - lea eax, [esi + l_anon.[ID].10-L4$pb] - lea ecx, [esi + l_anon.[ID].2-L4$pb] + lea eax, [esi + l_anon.[ID].15-L4$pb] + lea ecx, [esi + l_anon.[ID].8-L4$pb] push eax push 43 push ecx @@ -311,8 +311,8 @@ L6$pb: push eax call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) add esp, 16 - lea ecx, [edi + l_anon.[ID].6-L6$pb] - lea edx, [edi + L_anon.[ID].5-L6$pb] + lea ecx, [edi + l_anon.[ID].12-L6$pb] + lea edx, [edi + L_anon.[ID].11-L6$pb] push ecx push 4 push edx @@ -324,8 +324,8 @@ L6$pb: push esi call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) add esp, 16 - lea ecx, [edi + l_anon.[ID].8-L6$pb] - lea edx, [edi + L_anon.[ID].7-L6$pb] + lea ecx, [edi + l_anon.[ID].2-L6$pb] + lea edx, [edi + L_anon.[ID].13-L6$pb] push ecx push 4 push edx @@ -362,7 +362,7 @@ L7$pb: jne LBB7_1 LBB7_2: sub esp, 8 - lea eax, [esi + l_anon.[ID].11-L7$pb] + lea eax, [esi + l_anon.[ID].16-L7$pb] push 15 push eax call SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) @@ -379,7 +379,7 @@ LBB7_1: lea eax, [ebp - 9] mov dword ptr [ebp - 16], eax sub esp, 12 - lea eax, [esi + l_anon.[ID].10-L7$pb] + lea eax, [esi + l_anon.[ID].15-L7$pb] lea ecx, [esi + l_anon.[ID].0-L7$pb] lea edx, [ebp - 16] lea edi, [esi + SYM(::class::REGISTER_CLASS, 0)-L7$pb] @@ -393,8 +393,8 @@ LBB7_1: jmp LBB7_2 LBB7_4: sub esp, 4 - lea eax, [esi + l_anon.[ID].10-L7$pb] - lea ecx, [esi + l_anon.[ID].2-L7$pb] + lea eax, [esi + l_anon.[ID].15-L7$pb] + lea ecx, [esi + l_anon.[ID].8-L7$pb] push eax push 43 push ecx @@ -417,8 +417,8 @@ L8$pb: push edi call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) add esp, 16 - lea ecx, [ebx + l_anon.[ID].8-L8$pb] - lea edx, [ebx + L_anon.[ID].7-L8$pb] + lea ecx, [ebx + l_anon.[ID].2-L8$pb] + lea edx, [ebx + L_anon.[ID].13-L8$pb] push ecx push 4 push edx @@ -480,8 +480,8 @@ L9$pb: push esi call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) add esp, 16 - lea ecx, [edi + l_anon.[ID].6-L9$pb] - lea edx, [edi + L_anon.[ID].5-L9$pb] + lea ecx, [edi + l_anon.[ID].12-L9$pb] + lea edx, [edi + L_anon.[ID].11-L9$pb] push ecx push 4 push edx @@ -493,8 +493,8 @@ L9$pb: push esi call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) add esp, 16 - lea ecx, [edi + l_anon.[ID].8-L9$pb] - lea edx, [edi + L_anon.[ID].7-L9$pb] + lea ecx, [edi + l_anon.[ID].2-L9$pb] + lea edx, [edi + L_anon.[ID].13-L9$pb] push ecx push 4 push edx @@ -552,8 +552,8 @@ L13$pb: push esi call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) add esp, 16 - lea ecx, [edi + l_anon.[ID].8-L13$pb] - lea edx, [edi + L_anon.[ID].7-L13$pb] + lea ecx, [edi + l_anon.[ID].2-L13$pb] + lea edx, [edi + L_anon.[ID].13-L13$pb] push ecx push 4 push edx @@ -599,9 +599,9 @@ L14$pb: mov ebx, dword ptr [ebp + 8] mov dword ptr [esp], ebx call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) - lea ecx, [edi + l_anon.[ID].8-L14$pb] + lea ecx, [edi + l_anon.[ID].2-L14$pb] mov dword ptr [esp + 12], ecx - lea ecx, [edi + L_anon.[ID].7-L14$pb] + lea ecx, [edi + L_anon.[ID].13-L14$pb] mov dword ptr [esp + 4], ecx mov dword ptr [esp], eax mov dword ptr [esp + 8], 4 @@ -651,8 +651,8 @@ L15$pb: mov ebx, eax call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) add esp, 16 - lea edx, [edi + l_anon.[ID].6-L15$pb] - lea ecx, [edi + L_anon.[ID].5-L15$pb] + lea edx, [edi + l_anon.[ID].12-L15$pb] + lea ecx, [edi + L_anon.[ID].11-L15$pb] push edx push 4 push ecx @@ -664,10 +664,10 @@ L15$pb: push esi call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) add esp, 16 - lea ecx, [edi + l_anon.[ID].6-L15$pb] + lea ecx, [edi + l_anon.[ID].12-L15$pb] push ecx push 4 - lea ecx, [edi + L_anon.[ID].5-L15$pb] + lea ecx, [edi + L_anon.[ID].11-L15$pb] push ecx push eax call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) @@ -677,8 +677,8 @@ L15$pb: push dword ptr [ebp + 8] call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) add esp, 16 - lea ecx, [edi + l_anon.[ID].8-L15$pb] - lea ebx, [edi + L_anon.[ID].7-L15$pb] + lea ecx, [edi + l_anon.[ID].2-L15$pb] + lea ebx, [edi + L_anon.[ID].13-L15$pb] mov dword ptr [ebp - 16], ecx push ecx push 4 @@ -732,86 +732,86 @@ l_anon.[ID].0: l_anon.[ID].1: .byte 0 + .p2align 2, 0x0 l_anon.[ID].2: - .ascii "called `Option::unwrap()` on a `None` value" + .byte 19 + .space 19 + .p2align 2, 0x0 l_anon.[ID].3: - .ascii "$RUSTC/library/std/src/sync/once.rs" + .byte 17 + .space 19 - .section __DATA,__const .p2align 2, 0x0 l_anon.[ID].4: - .long l_anon.[ID].3 - .asciz "p\000\000\000\225\000\000\0002\000\000" + .space 1 + .space 19 - .section __TEXT,__literal4,4byte_literals -L_anon.[ID].5: - .ascii "_foo" +l_anon.[ID].5: + .ascii "_NSZone" - .section __TEXT,__const + .section __DATA,__const .p2align 2, 0x0 l_anon.[ID].6: - .byte 5 - .space 19 + .byte 28 + .space 3 + .long l_anon.[ID].5 + .asciz "\007\000\000" + .long l_anon.[ID].1 + .space 4 - .section __TEXT,__literal4,4byte_literals -L_anon.[ID].7: - .ascii "_obj" + .p2align 2, 0x0 +l_anon.[ID].7: + .byte 25 + .space 3 + .long l_anon.[ID].6 + .space 12 .section __TEXT,__const - .p2align 2, 0x0 l_anon.[ID].8: - .byte 19 - .space 19 + .ascii "called `Option::unwrap()` on a `None` value" l_anon.[ID].9: - .ascii "crates/$DIR/lib.rs" + .ascii "$RUSTC/library/std/src/sync/once.rs" .section __DATA,__const .p2align 2, 0x0 l_anon.[ID].10: .long l_anon.[ID].9 - .asciz "5\000\000\000\013\000\000\000\001\000\000" + .asciz "p\000\000\000\225\000\000\0002\000\000" - .section __TEXT,__const -l_anon.[ID].11: - .ascii "CustomClassName" + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].11: + .ascii "_foo" -.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),4,2 + .section __TEXT,__const .p2align 2, 0x0 l_anon.[ID].12: - .byte 17 + .byte 5 .space 19 - .p2align 2, 0x0 -l_anon.[ID].13: - .space 1 - .space 19 + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].13: + .ascii "_obj" + .section __TEXT,__const l_anon.[ID].14: - .ascii "NSCopying" - -l_anon.[ID].15: - .ascii "_NSZone" + .ascii "crates/$DIR/lib.rs" .section __DATA,__const .p2align 2, 0x0 +l_anon.[ID].15: + .long l_anon.[ID].14 + .asciz "5\000\000\000\013\000\000\000\001\000\000" + + .section __TEXT,__const l_anon.[ID].16: - .byte 28 - .space 3 - .long l_anon.[ID].15 - .asciz "\007\000\000" - .long l_anon.[ID].1 - .space 4 + .ascii "CustomClassName" - .p2align 2, 0x0 +.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),4,2 l_anon.[ID].17: - .byte 25 - .space 3 - .long l_anon.[ID].16 - .space 12 + .ascii "NSCopying" - .section __TEXT,__const l_anon.[ID].18: .ascii "could not create new class " @@ -828,7 +828,7 @@ l_anon.[ID].20: .p2align 2, 0x0 l_anon.[ID].21: - .long l_anon.[ID].11 + .long l_anon.[ID].16 .asciz "\017\000\000" .section __DATA,__objc_imageinfo,regular,no_dead_strip diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-x86_64.s b/crates/test-assembly/crates/test_declare_class/expected/apple-x86_64.s index 3586c0da7..e0e3d301f 100644 --- a/crates/test-assembly/crates/test_declare_class/expected/apple-x86_64.s +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-x86_64.s @@ -22,22 +22,22 @@ SYM(::call_once::<::call_once::<::class::{closure#0}::__objc2_dealloc, 0)] mov rdi, rbx mov rdx, r15 @@ -77,7 +77,7 @@ SYM(::call_once::<::call_once::<::__add_protocol_methods::GENERATED_ID, 0) mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9] - lea rdx, [rip + l_anon.[ID].17] + lea rdx, [rip + l_anon.[ID].7] lea r9, [rip + _copy_with_zone] mov ecx, 1 mov rdi, rax @@ -121,8 +121,8 @@ SYM(::call_once::<::class::REGISTER_CLASS, 0)] lea rcx, [rip + l_anon.[ID].0] - lea r8, [rip + l_anon.[ID].10] + lea r8, [rip + l_anon.[ID].15] lea rdx, [rbp - 16] xor esi, esi call SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) jmp LBB4_2 LBB4_4: - lea rdi, [rip + l_anon.[ID].2] - lea rdx, [rip + l_anon.[ID].10] + lea rdi, [rip + l_anon.[ID].8] + lea rdx, [rip + l_anon.[ID].15] mov esi, 43 call SYM(core::panicking::panic::GENERATED_ID, 0) @@ -230,16 +230,16 @@ _access_ivars: mov rbx, rax mov rdi, rax call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) - lea rsi, [rip + L_anon.[ID].5] - lea rcx, [rip + l_anon.[ID].6] + lea rsi, [rip + L_anon.[ID].11] + lea rcx, [rip + l_anon.[ID].12] mov edx, 4 mov rdi, rax call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) movzx r14d, byte ptr [rbx + rax] mov rdi, rbx call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) - lea rsi, [rip + L_anon.[ID].7] - lea rcx, [rip + l_anon.[ID].8] + lea rsi, [rip + L_anon.[ID].13] + lea rcx, [rip + l_anon.[ID].2] mov edx, 4 mov rdi, rax call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) @@ -265,7 +265,7 @@ SYM(::class::REGISTER_CLASS, 0)] lea rcx, [rip + l_anon.[ID].0] - lea r8, [rip + l_anon.[ID].10] + lea r8, [rip + l_anon.[ID].15] lea rdx, [rbp - 16] xor esi, esi call SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) jmp LBB7_2 LBB7_4: - lea rdi, [rip + l_anon.[ID].2] - lea rdx, [rip + l_anon.[ID].10] + lea rdi, [rip + l_anon.[ID].8] + lea rdx, [rip + l_anon.[ID].15] mov esi, 43 call SYM(core::panicking::panic::GENERATED_ID, 0) @@ -300,8 +300,8 @@ SYM(::class::REGISTER_CLASS, 0),8,3 + .section __TEXT,__const .p2align 3, 0x0 l_anon.[ID].12: - .byte 17 + .byte 5 .space 39 - .p2align 3, 0x0 -l_anon.[ID].13: - .space 1 - .space 39 + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].13: + .ascii "_obj" + .section __TEXT,__const l_anon.[ID].14: - .ascii "NSCopying" - -l_anon.[ID].15: - .ascii "_NSZone" + .ascii "crates/$DIR/lib.rs" .section __DATA,__const .p2align 3, 0x0 +l_anon.[ID].15: + .quad l_anon.[ID].14 + .asciz "5\000\000\000\000\000\000\000\013\000\000\000\001\000\000" + + .section __TEXT,__const l_anon.[ID].16: - .byte 28 - .space 7 - .quad l_anon.[ID].15 - .asciz "\007\000\000\000\000\000\000" - .quad l_anon.[ID].1 - .space 8 + .ascii "CustomClassName" - .p2align 3, 0x0 +.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),8,3 l_anon.[ID].17: - .byte 25 - .space 7 - .quad l_anon.[ID].16 - .space 24 + .ascii "NSCopying" - .section __TEXT,__const l_anon.[ID].18: .ascii "could not create new class " @@ -642,7 +642,7 @@ l_anon.[ID].20: .p2align 3, 0x0 l_anon.[ID].21: - .quad l_anon.[ID].11 + .quad l_anon.[ID].16 .asciz "\017\000\000\000\000\000\000" .section __DATA,__objc_imageinfo,regular,no_dead_strip From b9933b50e193053c1281c5b008646c1d363860a7 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 8 Aug 2023 12:16:04 +0200 Subject: [PATCH 4/4] Allow warnings in MSRV build --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 314ae0e3f..9c0595d5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -181,6 +181,8 @@ jobs: $PUBLIC_CRATES --features=$INTERESTING_FEATURES --features=$LATEST_MACOS_FEATURE + env: + RUSTFLAGS: "--codegen=debuginfo=0" # Removed --deny=warnings ui: name: Compiler UI