summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSebastian Imlay <sebastian.imlay@gmail.com>2022-03-07 16:14:52 -0500
committerEmilio Cobos Álvarez <emilio@crisal.io>2022-03-15 03:38:57 +0100
commit6a169f21344d541ab4790dee894d2cc9e51a0345 (patch)
treefb9c316035bacc2f38640d81493051ed7b02fb40 /tests
parentf34e4103f304500c96d332f5cecc9067c980d0f9 (diff)
Fix macOS test expectations
* Updated tests/expectations/Cargo.toml to use 2018 rust. * Added Debug and Copy to objective-c structs. * Fixed lifetimes in objective-c trait templates. * Fixed imports for objective-c expectations tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/expectations/Cargo.toml1
-rw-r--r--tests/expectations/tests/libclang-4/objc_inheritance.rs15
-rw-r--r--tests/expectations/tests/libclang-4/objc_template.rs15
-rw-r--r--tests/expectations/tests/libclang-5/objc_inheritance.rs15
-rw-r--r--tests/expectations/tests/libclang-5/objc_template.rs15
-rw-r--r--tests/expectations/tests/libclang-9/objc_inheritance.rs15
-rw-r--r--tests/expectations/tests/libclang-9/objc_template.rs15
-rw-r--r--tests/expectations/tests/objc_allowlist.rs48
-rw-r--r--tests/expectations/tests/objc_category.rs7
-rw-r--r--tests/expectations/tests/objc_class.rs7
-rw-r--r--tests/expectations/tests/objc_class_method.rs7
-rw-r--r--tests/expectations/tests/objc_interface.rs7
-rw-r--r--tests/expectations/tests/objc_interface_type.rs7
-rw-r--r--tests/expectations/tests/objc_method.rs7
-rw-r--r--tests/expectations/tests/objc_method_clash.rs7
-rw-r--r--tests/expectations/tests/objc_pointer_return_types.rs11
-rw-r--r--tests/expectations/tests/objc_property_fnptr.rs7
-rw-r--r--tests/expectations/tests/objc_protocol.rs7
-rw-r--r--tests/expectations/tests/objc_protocol_inheritance.rs11
-rw-r--r--tests/expectations/tests/objc_sel_and_id.rs3
-rw-r--r--tests/headers/objc_allowlist.h2
-rw-r--r--tests/headers/objc_category.h2
-rw-r--r--tests/headers/objc_class.h2
-rw-r--r--tests/headers/objc_class_method.h2
-rw-r--r--tests/headers/objc_inheritance.h2
-rw-r--r--tests/headers/objc_interface.h2
-rw-r--r--tests/headers/objc_interface_type.h2
-rw-r--r--tests/headers/objc_method.h2
-rw-r--r--tests/headers/objc_method_clash.h2
-rw-r--r--tests/headers/objc_pointer_return_types.h2
-rw-r--r--tests/headers/objc_property_fnptr.h2
-rw-r--r--tests/headers/objc_protocol.h2
-rw-r--r--tests/headers/objc_protocol_inheritance.h2
-rw-r--r--tests/headers/objc_sel_and_id.h2
-rw-r--r--tests/headers/objc_template.h2
35 files changed, 142 insertions, 115 deletions
diff --git a/tests/expectations/Cargo.toml b/tests/expectations/Cargo.toml
index c78cc09a..f8006afe 100644
--- a/tests/expectations/Cargo.toml
+++ b/tests/expectations/Cargo.toml
@@ -7,6 +7,7 @@ authors = [
"Emilio Cobos Álvarez <emilio@crisal.io>",
"The Servo project developers",
]
+edition = "2018"
[dependencies]
objc = "0.2"
diff --git a/tests/expectations/tests/libclang-4/objc_inheritance.rs b/tests/expectations/tests/libclang-4/objc_inheritance.rs
index 5f07dbaa..f1c2a88c 100644
--- a/tests/expectations/tests/libclang-4/objc_inheritance.rs
+++ b/tests/expectations/tests/libclang-4/objc_inheritance.rs
@@ -6,12 +6,11 @@
)]
#![cfg(target_os = "macos")]
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
@@ -22,13 +21,13 @@ impl std::ops::Deref for Foo {
unsafe impl objc::Message for Foo {}
impl Foo {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ Self(unsafe { msg_send!(class!(Foo), alloc) })
}
}
impl IFoo for Foo {}
pub trait IFoo: Sized + std::ops::Deref {}
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Bar(pub id);
impl std::ops::Deref for Bar {
type Target = objc::runtime::Object;
@@ -39,7 +38,7 @@ impl std::ops::Deref for Bar {
unsafe impl objc::Message for Bar {}
impl Bar {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Bar), alloc) })
+ Self(unsafe { msg_send!(class!(Bar), alloc) })
}
}
impl IFoo for Bar {}
@@ -63,7 +62,7 @@ impl std::convert::TryFrom<Foo> for Bar {
impl IBar for Bar {}
pub trait IBar: Sized + std::ops::Deref {}
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Baz(pub id);
impl std::ops::Deref for Baz {
type Target = objc::runtime::Object;
@@ -74,7 +73,7 @@ impl std::ops::Deref for Baz {
unsafe impl objc::Message for Baz {}
impl Baz {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Baz), alloc) })
+ Self(unsafe { msg_send!(class!(Baz), alloc) })
}
}
impl IBar for Baz {}
diff --git a/tests/expectations/tests/libclang-4/objc_template.rs b/tests/expectations/tests/libclang-4/objc_template.rs
index 36b7d22b..53caa661 100644
--- a/tests/expectations/tests/libclang-4/objc_template.rs
+++ b/tests/expectations/tests/libclang-4/objc_template.rs
@@ -6,12 +6,11 @@
)]
#![cfg(target_os = "macos")]
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
@@ -22,11 +21,11 @@ impl std::ops::Deref for Foo {
unsafe impl objc::Message for Foo {}
impl Foo {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ Self(unsafe { msg_send!(class!(Foo), alloc) })
}
}
impl<ObjectType: 'static> IFoo<ObjectType> for Foo {}
-pub trait IFoo<ObjectType>: Sized + std::ops::Deref {
+pub trait IFoo<ObjectType: 'static>: Sized + std::ops::Deref {
unsafe fn get(&self) -> *mut ObjectType
where
<Self as std::ops::Deref>::Target: objc::Message + Sized,
@@ -35,7 +34,7 @@ pub trait IFoo<ObjectType>: Sized + std::ops::Deref {
}
}
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct FooMultiGeneric(pub id);
impl std::ops::Deref for FooMultiGeneric {
type Target = objc::runtime::Object;
@@ -46,14 +45,14 @@ impl std::ops::Deref for FooMultiGeneric {
unsafe impl objc::Message for FooMultiGeneric {}
impl FooMultiGeneric {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(FooMultiGeneric), alloc) })
+ Self(unsafe { msg_send!(class!(FooMultiGeneric), alloc) })
}
}
impl<KeyType: 'static, ObjectType: 'static>
IFooMultiGeneric<KeyType, ObjectType> for FooMultiGeneric
{
}
-pub trait IFooMultiGeneric<KeyType, ObjectType>:
+pub trait IFooMultiGeneric<KeyType: 'static, ObjectType: 'static>:
Sized + std::ops::Deref
{
unsafe fn objectForKey_(&self, key: *mut KeyType) -> *mut ObjectType
diff --git a/tests/expectations/tests/libclang-5/objc_inheritance.rs b/tests/expectations/tests/libclang-5/objc_inheritance.rs
index 5f07dbaa..f1c2a88c 100644
--- a/tests/expectations/tests/libclang-5/objc_inheritance.rs
+++ b/tests/expectations/tests/libclang-5/objc_inheritance.rs
@@ -6,12 +6,11 @@
)]
#![cfg(target_os = "macos")]
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
@@ -22,13 +21,13 @@ impl std::ops::Deref for Foo {
unsafe impl objc::Message for Foo {}
impl Foo {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ Self(unsafe { msg_send!(class!(Foo), alloc) })
}
}
impl IFoo for Foo {}
pub trait IFoo: Sized + std::ops::Deref {}
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Bar(pub id);
impl std::ops::Deref for Bar {
type Target = objc::runtime::Object;
@@ -39,7 +38,7 @@ impl std::ops::Deref for Bar {
unsafe impl objc::Message for Bar {}
impl Bar {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Bar), alloc) })
+ Self(unsafe { msg_send!(class!(Bar), alloc) })
}
}
impl IFoo for Bar {}
@@ -63,7 +62,7 @@ impl std::convert::TryFrom<Foo> for Bar {
impl IBar for Bar {}
pub trait IBar: Sized + std::ops::Deref {}
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Baz(pub id);
impl std::ops::Deref for Baz {
type Target = objc::runtime::Object;
@@ -74,7 +73,7 @@ impl std::ops::Deref for Baz {
unsafe impl objc::Message for Baz {}
impl Baz {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Baz), alloc) })
+ Self(unsafe { msg_send!(class!(Baz), alloc) })
}
}
impl IBar for Baz {}
diff --git a/tests/expectations/tests/libclang-5/objc_template.rs b/tests/expectations/tests/libclang-5/objc_template.rs
index 36b7d22b..53caa661 100644
--- a/tests/expectations/tests/libclang-5/objc_template.rs
+++ b/tests/expectations/tests/libclang-5/objc_template.rs
@@ -6,12 +6,11 @@
)]
#![cfg(target_os = "macos")]
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
@@ -22,11 +21,11 @@ impl std::ops::Deref for Foo {
unsafe impl objc::Message for Foo {}
impl Foo {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ Self(unsafe { msg_send!(class!(Foo), alloc) })
}
}
impl<ObjectType: 'static> IFoo<ObjectType> for Foo {}
-pub trait IFoo<ObjectType>: Sized + std::ops::Deref {
+pub trait IFoo<ObjectType: 'static>: Sized + std::ops::Deref {
unsafe fn get(&self) -> *mut ObjectType
where
<Self as std::ops::Deref>::Target: objc::Message + Sized,
@@ -35,7 +34,7 @@ pub trait IFoo<ObjectType>: Sized + std::ops::Deref {
}
}
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct FooMultiGeneric(pub id);
impl std::ops::Deref for FooMultiGeneric {
type Target = objc::runtime::Object;
@@ -46,14 +45,14 @@ impl std::ops::Deref for FooMultiGeneric {
unsafe impl objc::Message for FooMultiGeneric {}
impl FooMultiGeneric {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(FooMultiGeneric), alloc) })
+ Self(unsafe { msg_send!(class!(FooMultiGeneric), alloc) })
}
}
impl<KeyType: 'static, ObjectType: 'static>
IFooMultiGeneric<KeyType, ObjectType> for FooMultiGeneric
{
}
-pub trait IFooMultiGeneric<KeyType, ObjectType>:
+pub trait IFooMultiGeneric<KeyType: 'static, ObjectType: 'static>:
Sized + std::ops::Deref
{
unsafe fn objectForKey_(&self, key: *mut KeyType) -> *mut ObjectType
diff --git a/tests/expectations/tests/libclang-9/objc_inheritance.rs b/tests/expectations/tests/libclang-9/objc_inheritance.rs
index 5f07dbaa..f1c2a88c 100644
--- a/tests/expectations/tests/libclang-9/objc_inheritance.rs
+++ b/tests/expectations/tests/libclang-9/objc_inheritance.rs
@@ -6,12 +6,11 @@
)]
#![cfg(target_os = "macos")]
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
@@ -22,13 +21,13 @@ impl std::ops::Deref for Foo {
unsafe impl objc::Message for Foo {}
impl Foo {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ Self(unsafe { msg_send!(class!(Foo), alloc) })
}
}
impl IFoo for Foo {}
pub trait IFoo: Sized + std::ops::Deref {}
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Bar(pub id);
impl std::ops::Deref for Bar {
type Target = objc::runtime::Object;
@@ -39,7 +38,7 @@ impl std::ops::Deref for Bar {
unsafe impl objc::Message for Bar {}
impl Bar {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Bar), alloc) })
+ Self(unsafe { msg_send!(class!(Bar), alloc) })
}
}
impl IFoo for Bar {}
@@ -63,7 +62,7 @@ impl std::convert::TryFrom<Foo> for Bar {
impl IBar for Bar {}
pub trait IBar: Sized + std::ops::Deref {}
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Baz(pub id);
impl std::ops::Deref for Baz {
type Target = objc::runtime::Object;
@@ -74,7 +73,7 @@ impl std::ops::Deref for Baz {
unsafe impl objc::Message for Baz {}
impl Baz {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Baz), alloc) })
+ Self(unsafe { msg_send!(class!(Baz), alloc) })
}
}
impl IBar for Baz {}
diff --git a/tests/expectations/tests/libclang-9/objc_template.rs b/tests/expectations/tests/libclang-9/objc_template.rs
index 88cf209b..3c615035 100644
--- a/tests/expectations/tests/libclang-9/objc_template.rs
+++ b/tests/expectations/tests/libclang-9/objc_template.rs
@@ -6,12 +6,11 @@
)]
#![cfg(target_os = "macos")]
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
@@ -22,11 +21,11 @@ impl std::ops::Deref for Foo {
unsafe impl objc::Message for Foo {}
impl Foo {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ Self(unsafe { msg_send!(class!(Foo), alloc) })
}
}
impl<ObjectType: 'static> IFoo<ObjectType> for Foo {}
-pub trait IFoo<ObjectType>: Sized + std::ops::Deref {
+pub trait IFoo<ObjectType: 'static>: Sized + std::ops::Deref {
unsafe fn get(&self) -> u64
where
<Self as std::ops::Deref>::Target: objc::Message + Sized,
@@ -35,7 +34,7 @@ pub trait IFoo<ObjectType>: Sized + std::ops::Deref {
}
}
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct FooMultiGeneric(pub id);
impl std::ops::Deref for FooMultiGeneric {
type Target = objc::runtime::Object;
@@ -46,14 +45,14 @@ impl std::ops::Deref for FooMultiGeneric {
unsafe impl objc::Message for FooMultiGeneric {}
impl FooMultiGeneric {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(FooMultiGeneric), alloc) })
+ Self(unsafe { msg_send!(class!(FooMultiGeneric), alloc) })
}
}
impl<KeyType: 'static, ObjectType: 'static>
IFooMultiGeneric<KeyType, ObjectType> for FooMultiGeneric
{
}
-pub trait IFooMultiGeneric<KeyType, ObjectType>:
+pub trait IFooMultiGeneric<KeyType: 'static, ObjectType: 'static>:
Sized + std::ops::Deref
{
unsafe fn objectForKey_(&self, key: u64) -> u64
diff --git a/tests/expectations/tests/objc_allowlist.rs b/tests/expectations/tests/objc_allowlist.rs
index dcec0fd1..370cab93 100644
--- a/tests/expectations/tests/objc_allowlist.rs
+++ b/tests/expectations/tests/objc_allowlist.rs
@@ -6,9 +6,53 @@
)]
#![cfg(target_os = "macos")]
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
+pub trait PSomeProtocol: Sized + std::ops::Deref {
+ unsafe fn protocolMethod(&self)
+ where
+ <Self as std::ops::Deref>::Target: objc::Message + Sized,
+ {
+ msg_send!(*self, protocolMethod)
+ }
+ unsafe fn protocolClassMethod()
+ where
+ <Self as std::ops::Deref>::Target: objc::Message + Sized,
+ {
+ msg_send!(class!(SomeProtocol), protocolClassMethod)
+ }
+}
+#[repr(transparent)]
+#[derive(Debug, Copy, Clone)]
+pub struct AllowlistMe(pub id);
+impl std::ops::Deref for AllowlistMe {
+ type Target = objc::runtime::Object;
+ fn deref(&self) -> &Self::Target {
+ unsafe { &*self.0 }
+ }
+}
+unsafe impl objc::Message for AllowlistMe {}
+impl AllowlistMe {
+ pub fn alloc() -> Self {
+ Self(unsafe { msg_send!(class!(AllowlistMe), alloc) })
+ }
+}
+impl PSomeProtocol for AllowlistMe {}
+impl IAllowlistMe for AllowlistMe {}
+pub trait IAllowlistMe: Sized + std::ops::Deref {
+ unsafe fn method(&self)
+ where
+ <Self as std::ops::Deref>::Target: objc::Message + Sized,
+ {
+ msg_send!(*self, method)
+ }
+ unsafe fn classMethod()
+ where
+ <Self as std::ops::Deref>::Target: objc::Message + Sized,
+ {
+ msg_send!(class!(AllowlistMe), classMethod)
+ }
+}
impl AllowlistMe_InterestingCategory for AllowlistMe {}
pub trait AllowlistMe_InterestingCategory: Sized + std::ops::Deref {}
diff --git a/tests/expectations/tests/objc_category.rs b/tests/expectations/tests/objc_category.rs
index e0328c70..9d60233b 100644
--- a/tests/expectations/tests/objc_category.rs
+++ b/tests/expectations/tests/objc_category.rs
@@ -6,12 +6,11 @@
)]
#![cfg(target_os = "macos")]
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
@@ -22,7 +21,7 @@ impl std::ops::Deref for Foo {
unsafe impl objc::Message for Foo {}
impl Foo {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ Self(unsafe { msg_send!(class!(Foo), alloc) })
}
}
impl IFoo for Foo {}
diff --git a/tests/expectations/tests/objc_class.rs b/tests/expectations/tests/objc_class.rs
index 5a8a71d1..b322bddc 100644
--- a/tests/expectations/tests/objc_class.rs
+++ b/tests/expectations/tests/objc_class.rs
@@ -6,15 +6,14 @@
)]
#![cfg(target_os = "macos")]
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
extern "C" {
pub static mut fooVar: Foo;
}
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
@@ -25,7 +24,7 @@ impl std::ops::Deref for Foo {
unsafe impl objc::Message for Foo {}
impl Foo {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ Self(unsafe { msg_send!(class!(Foo), alloc) })
}
}
impl IFoo for Foo {}
diff --git a/tests/expectations/tests/objc_class_method.rs b/tests/expectations/tests/objc_class_method.rs
index 26f2110f..29e70256 100644
--- a/tests/expectations/tests/objc_class_method.rs
+++ b/tests/expectations/tests/objc_class_method.rs
@@ -6,12 +6,11 @@
)]
#![cfg(target_os = "macos")]
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
@@ -22,7 +21,7 @@ impl std::ops::Deref for Foo {
unsafe impl objc::Message for Foo {}
impl Foo {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ Self(unsafe { msg_send!(class!(Foo), alloc) })
}
}
impl IFoo for Foo {}
diff --git a/tests/expectations/tests/objc_interface.rs b/tests/expectations/tests/objc_interface.rs
index c5ba2758..89e64d86 100644
--- a/tests/expectations/tests/objc_interface.rs
+++ b/tests/expectations/tests/objc_interface.rs
@@ -6,12 +6,11 @@
)]
#![cfg(target_os = "macos")]
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
@@ -22,7 +21,7 @@ impl std::ops::Deref for Foo {
unsafe impl objc::Message for Foo {}
impl Foo {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ Self(unsafe { msg_send!(class!(Foo), alloc) })
}
}
impl IFoo for Foo {}
diff --git a/tests/expectations/tests/objc_interface_type.rs b/tests/expectations/tests/objc_interface_type.rs
index cef29c8c..4ffb15d3 100644
--- a/tests/expectations/tests/objc_interface_type.rs
+++ b/tests/expectations/tests/objc_interface_type.rs
@@ -6,12 +6,11 @@
)]
#![cfg(target_os = "macos")]
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
@@ -22,7 +21,7 @@ impl std::ops::Deref for Foo {
unsafe impl objc::Message for Foo {}
impl Foo {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ Self(unsafe { msg_send!(class!(Foo), alloc) })
}
}
impl IFoo for Foo {}
diff --git a/tests/expectations/tests/objc_method.rs b/tests/expectations/tests/objc_method.rs
index af5c6093..593fd277 100644
--- a/tests/expectations/tests/objc_method.rs
+++ b/tests/expectations/tests/objc_method.rs
@@ -6,12 +6,11 @@
)]
#![cfg(target_os = "macos")]
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
@@ -22,7 +21,7 @@ impl std::ops::Deref for Foo {
unsafe impl objc::Message for Foo {}
impl Foo {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ Self(unsafe { msg_send!(class!(Foo), alloc) })
}
}
impl IFoo for Foo {}
diff --git a/tests/expectations/tests/objc_method_clash.rs b/tests/expectations/tests/objc_method_clash.rs
index 8370f33f..ac77cc19 100644
--- a/tests/expectations/tests/objc_method_clash.rs
+++ b/tests/expectations/tests/objc_method_clash.rs
@@ -6,12 +6,11 @@
)]
#![cfg(target_os = "macos")]
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
@@ -22,7 +21,7 @@ impl std::ops::Deref for Foo {
unsafe impl objc::Message for Foo {}
impl Foo {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ Self(unsafe { msg_send!(class!(Foo), alloc) })
}
}
impl IFoo for Foo {}
diff --git a/tests/expectations/tests/objc_pointer_return_types.rs b/tests/expectations/tests/objc_pointer_return_types.rs
index c9b6b52a..1ec8494d 100644
--- a/tests/expectations/tests/objc_pointer_return_types.rs
+++ b/tests/expectations/tests/objc_pointer_return_types.rs
@@ -6,12 +6,11 @@
)]
#![cfg(target_os = "macos")]
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Bar(pub id);
impl std::ops::Deref for Bar {
type Target = objc::runtime::Object;
@@ -22,13 +21,13 @@ impl std::ops::Deref for Bar {
unsafe impl objc::Message for Bar {}
impl Bar {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Bar), alloc) })
+ Self(unsafe { msg_send!(class!(Bar), alloc) })
}
}
impl IBar for Bar {}
pub trait IBar: Sized + std::ops::Deref {}
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
@@ -39,7 +38,7 @@ impl std::ops::Deref for Foo {
unsafe impl objc::Message for Foo {}
impl Foo {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ Self(unsafe { msg_send!(class!(Foo), alloc) })
}
}
impl IFoo for Foo {}
diff --git a/tests/expectations/tests/objc_property_fnptr.rs b/tests/expectations/tests/objc_property_fnptr.rs
index 85f18e9c..9f3fabd2 100644
--- a/tests/expectations/tests/objc_property_fnptr.rs
+++ b/tests/expectations/tests/objc_property_fnptr.rs
@@ -6,12 +6,11 @@
)]
#![cfg(target_os = "macos")]
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
@@ -22,7 +21,7 @@ impl std::ops::Deref for Foo {
unsafe impl objc::Message for Foo {}
impl Foo {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ Self(unsafe { msg_send!(class!(Foo), alloc) })
}
}
impl IFoo for Foo {}
diff --git a/tests/expectations/tests/objc_protocol.rs b/tests/expectations/tests/objc_protocol.rs
index e68ddcc1..5bd7d433 100644
--- a/tests/expectations/tests/objc_protocol.rs
+++ b/tests/expectations/tests/objc_protocol.rs
@@ -6,13 +6,12 @@
)]
#![cfg(target_os = "macos")]
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
pub trait PFoo: Sized + std::ops::Deref {}
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
@@ -23,7 +22,7 @@ impl std::ops::Deref for Foo {
unsafe impl objc::Message for Foo {}
impl Foo {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ Self(unsafe { msg_send!(class!(Foo), alloc) })
}
}
impl PFoo for Foo {}
diff --git a/tests/expectations/tests/objc_protocol_inheritance.rs b/tests/expectations/tests/objc_protocol_inheritance.rs
index 598273ba..f5f80e2e 100644
--- a/tests/expectations/tests/objc_protocol_inheritance.rs
+++ b/tests/expectations/tests/objc_protocol_inheritance.rs
@@ -6,13 +6,12 @@
)]
#![cfg(target_os = "macos")]
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
pub trait PFoo: Sized + std::ops::Deref {}
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
@@ -23,14 +22,14 @@ impl std::ops::Deref for Foo {
unsafe impl objc::Message for Foo {}
impl Foo {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ Self(unsafe { msg_send!(class!(Foo), alloc) })
}
}
impl PFoo for Foo {}
impl IFoo for Foo {}
pub trait IFoo: Sized + std::ops::Deref {}
#[repr(transparent)]
-#[derive(Clone)]
+#[derive(Debug, Copy, Clone)]
pub struct Bar(pub id);
impl std::ops::Deref for Bar {
type Target = objc::runtime::Object;
@@ -41,7 +40,7 @@ impl std::ops::Deref for Bar {
unsafe impl objc::Message for Bar {}
impl Bar {
pub fn alloc() -> Self {
- Self(unsafe { msg_send!(objc::class!(Bar), alloc) })
+ Self(unsafe { msg_send!(class!(Bar), alloc) })
}
}
impl IFoo for Bar {}
diff --git a/tests/expectations/tests/objc_sel_and_id.rs b/tests/expectations/tests/objc_sel_and_id.rs
index 2a389093..0017eab0 100644
--- a/tests/expectations/tests/objc_sel_and_id.rs
+++ b/tests/expectations/tests/objc_sel_and_id.rs
@@ -6,8 +6,7 @@
)]
#![cfg(target_os = "macos")]
-#[macro_use]
-extern crate objc;
+use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
extern "C" {
diff --git a/tests/headers/objc_allowlist.h b/tests/headers/objc_allowlist.h
index 8c939960..b5406d0a 100644
--- a/tests/headers/objc_allowlist.h
+++ b/tests/headers/objc_allowlist.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate --allowlist-type AllowlistMe --allowlist-type AllowlistMe_InterestingCategory -- -x objective-c
+// bindgen-flags: --allowlist-type IAllowlistMe --allowlist-type AllowlistMe_InterestingCategory -- -x objective-c
// bindgen-osx-only
diff --git a/tests/headers/objc_category.h b/tests/headers/objc_category.h
index c464b72e..b8e60d5f 100644
--- a/tests/headers/objc_category.h
+++ b/tests/headers/objc_category.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
// bindgen-osx-only
@interface Foo
diff --git a/tests/headers/objc_class.h b/tests/headers/objc_class.h
index cea72e78..f5ec9507 100644
--- a/tests/headers/objc_class.h
+++ b/tests/headers/objc_class.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
// bindgen-osx-only
@class Foo;
diff --git a/tests/headers/objc_class_method.h b/tests/headers/objc_class_method.h
index ddda742e..1a68ed3e 100644
--- a/tests/headers/objc_class_method.h
+++ b/tests/headers/objc_class_method.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
// bindgen-osx-only
@interface Foo
diff --git a/tests/headers/objc_inheritance.h b/tests/headers/objc_inheritance.h
index 8f96e45b..985f1597 100644
--- a/tests/headers/objc_inheritance.h
+++ b/tests/headers/objc_inheritance.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
// bindgen-osx-only
@interface Foo
diff --git a/tests/headers/objc_interface.h b/tests/headers/objc_interface.h
index af84bf92..df16e921 100644
--- a/tests/headers/objc_interface.h
+++ b/tests/headers/objc_interface.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
// bindgen-osx-only
@interface Foo
diff --git a/tests/headers/objc_interface_type.h b/tests/headers/objc_interface_type.h
index 31d33664..4667ce2a 100644
--- a/tests/headers/objc_interface_type.h
+++ b/tests/headers/objc_interface_type.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
// bindgen-osx-only
@interface Foo
diff --git a/tests/headers/objc_method.h b/tests/headers/objc_method.h
index c4d375ba..b89d1621 100644
--- a/tests/headers/objc_method.h
+++ b/tests/headers/objc_method.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
// bindgen-osx-only
@interface Foo
diff --git a/tests/headers/objc_method_clash.h b/tests/headers/objc_method_clash.h
index a56e39db..d99d3691 100644
--- a/tests/headers/objc_method_clash.h
+++ b/tests/headers/objc_method_clash.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
// bindgen-osx-only
@interface Foo
diff --git a/tests/headers/objc_pointer_return_types.h b/tests/headers/objc_pointer_return_types.h
index e289a8a5..4d1a6dea 100644
--- a/tests/headers/objc_pointer_return_types.h
+++ b/tests/headers/objc_pointer_return_types.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
// bindgen-osx-only
@interface Bar
diff --git a/tests/headers/objc_property_fnptr.h b/tests/headers/objc_property_fnptr.h
index bac0c779..fe3e7fcc 100644
--- a/tests/headers/objc_property_fnptr.h
+++ b/tests/headers/objc_property_fnptr.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
// bindgen-osx-only
@interface Foo
diff --git a/tests/headers/objc_protocol.h b/tests/headers/objc_protocol.h
index 0c760fa5..46978a3b 100644
--- a/tests/headers/objc_protocol.h
+++ b/tests/headers/objc_protocol.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
// bindgen-osx-only
@protocol Foo
diff --git a/tests/headers/objc_protocol_inheritance.h b/tests/headers/objc_protocol_inheritance.h
index d5f3a490..13135fdd 100644
--- a/tests/headers/objc_protocol_inheritance.h
+++ b/tests/headers/objc_protocol_inheritance.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
// bindgen-osx-only
@protocol Foo
diff --git a/tests/headers/objc_sel_and_id.h b/tests/headers/objc_sel_and_id.h
index 3c8c6561..6491a541 100644
--- a/tests/headers/objc_sel_and_id.h
+++ b/tests/headers/objc_sel_and_id.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
// bindgen-osx-only
id object;
diff --git a/tests/headers/objc_template.h b/tests/headers/objc_template.h
index a4d0055c..b616da01 100644
--- a/tests/headers/objc_template.h
+++ b/tests/headers/objc_template.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-flags: -- -x objective-c
// bindgen-osx-only
@interface Foo<__covariant ObjectType>