Skip to content

Commit bb7fd33

Browse files
committed
Add debug and copy to objective-c derive
1 parent 9a2d1bd commit bb7fd33

19 files changed

+30
-30
lines changed

src/codegen/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4145,7 +4145,7 @@ impl CodeGenerator for ObjCInterface {
41454145
if !self.is_category() && !self.is_protocol() {
41464146
let struct_block = quote! {
41474147
#[repr(transparent)]
4148-
#[derive(Clone)]
4148+
#[derive(Debug, Copy, Clone)]
41494149
pub struct #class_name(pub id);
41504150
impl std::ops::Deref for #class_name {
41514151
type Target = objc::runtime::Object;

tests/expectations/tests/libclang-4/objc_inheritance.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
1010
#[allow(non_camel_case_types)]
1111
pub type id = *mut objc::runtime::Object;
1212
#[repr(transparent)]
13-
#[derive(Clone)]
13+
#[derive(Debug, Copy, Clone)]
1414
pub struct Foo(pub id);
1515
impl std::ops::Deref for Foo {
1616
type Target = objc::runtime::Object;
@@ -27,7 +27,7 @@ impl Foo {
2727
impl IFoo for Foo {}
2828
pub trait IFoo: Sized + std::ops::Deref {}
2929
#[repr(transparent)]
30-
#[derive(Clone)]
30+
#[derive(Debug, Copy, Clone)]
3131
pub struct Bar(pub id);
3232
impl std::ops::Deref for Bar {
3333
type Target = objc::runtime::Object;
@@ -62,7 +62,7 @@ impl std::convert::TryFrom<Foo> for Bar {
6262
impl IBar for Bar {}
6363
pub trait IBar: Sized + std::ops::Deref {}
6464
#[repr(transparent)]
65-
#[derive(Clone)]
65+
#[derive(Debug, Copy, Clone)]
6666
pub struct Baz(pub id);
6767
impl std::ops::Deref for Baz {
6868
type Target = objc::runtime::Object;

tests/expectations/tests/libclang-4/objc_template.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
1010
#[allow(non_camel_case_types)]
1111
pub type id = *mut objc::runtime::Object;
1212
#[repr(transparent)]
13-
#[derive(Clone)]
13+
#[derive(Debug, Copy, Clone)]
1414
pub struct Foo(pub id);
1515
impl std::ops::Deref for Foo {
1616
type Target = objc::runtime::Object;
@@ -34,7 +34,7 @@ pub trait IFoo<ObjectType: 'static>: Sized + std::ops::Deref {
3434
}
3535
}
3636
#[repr(transparent)]
37-
#[derive(Clone)]
37+
#[derive(Debug, Copy, Clone)]
3838
pub struct FooMultiGeneric(pub id);
3939
impl std::ops::Deref for FooMultiGeneric {
4040
type Target = objc::runtime::Object;

tests/expectations/tests/libclang-5/objc_inheritance.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
1010
#[allow(non_camel_case_types)]
1111
pub type id = *mut objc::runtime::Object;
1212
#[repr(transparent)]
13-
#[derive(Clone)]
13+
#[derive(Debug, Copy, Clone)]
1414
pub struct Foo(pub id);
1515
impl std::ops::Deref for Foo {
1616
type Target = objc::runtime::Object;
@@ -27,7 +27,7 @@ impl Foo {
2727
impl IFoo for Foo {}
2828
pub trait IFoo: Sized + std::ops::Deref {}
2929
#[repr(transparent)]
30-
#[derive(Clone)]
30+
#[derive(Debug, Copy, Clone)]
3131
pub struct Bar(pub id);
3232
impl std::ops::Deref for Bar {
3333
type Target = objc::runtime::Object;
@@ -62,7 +62,7 @@ impl std::convert::TryFrom<Foo> for Bar {
6262
impl IBar for Bar {}
6363
pub trait IBar: Sized + std::ops::Deref {}
6464
#[repr(transparent)]
65-
#[derive(Clone)]
65+
#[derive(Debug, Copy, Clone)]
6666
pub struct Baz(pub id);
6767
impl std::ops::Deref for Baz {
6868
type Target = objc::runtime::Object;

tests/expectations/tests/libclang-5/objc_template.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
1010
#[allow(non_camel_case_types)]
1111
pub type id = *mut objc::runtime::Object;
1212
#[repr(transparent)]
13-
#[derive(Clone)]
13+
#[derive(Debug, Copy, Clone)]
1414
pub struct Foo(pub id);
1515
impl std::ops::Deref for Foo {
1616
type Target = objc::runtime::Object;
@@ -34,7 +34,7 @@ pub trait IFoo<ObjectType: 'static>: Sized + std::ops::Deref {
3434
}
3535
}
3636
#[repr(transparent)]
37-
#[derive(Clone)]
37+
#[derive(Debug, Copy, Clone)]
3838
pub struct FooMultiGeneric(pub id);
3939
impl std::ops::Deref for FooMultiGeneric {
4040
type Target = objc::runtime::Object;

tests/expectations/tests/libclang-9/objc_inheritance.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
1010
#[allow(non_camel_case_types)]
1111
pub type id = *mut objc::runtime::Object;
1212
#[repr(transparent)]
13-
#[derive(Clone)]
13+
#[derive(Debug, Copy, Clone)]
1414
pub struct Foo(pub id);
1515
impl std::ops::Deref for Foo {
1616
type Target = objc::runtime::Object;
@@ -27,7 +27,7 @@ impl Foo {
2727
impl IFoo for Foo {}
2828
pub trait IFoo: Sized + std::ops::Deref {}
2929
#[repr(transparent)]
30-
#[derive(Clone)]
30+
#[derive(Debug, Copy, Clone)]
3131
pub struct Bar(pub id);
3232
impl std::ops::Deref for Bar {
3333
type Target = objc::runtime::Object;
@@ -62,7 +62,7 @@ impl std::convert::TryFrom<Foo> for Bar {
6262
impl IBar for Bar {}
6363
pub trait IBar: Sized + std::ops::Deref {}
6464
#[repr(transparent)]
65-
#[derive(Clone)]
65+
#[derive(Debug, Copy, Clone)]
6666
pub struct Baz(pub id);
6767
impl std::ops::Deref for Baz {
6868
type Target = objc::runtime::Object;

tests/expectations/tests/libclang-9/objc_template.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
1010
#[allow(non_camel_case_types)]
1111
pub type id = *mut objc::runtime::Object;
1212
#[repr(transparent)]
13-
#[derive(Clone)]
13+
#[derive(Debug, Copy, Clone)]
1414
pub struct Foo(pub id);
1515
impl std::ops::Deref for Foo {
1616
type Target = objc::runtime::Object;
@@ -34,7 +34,7 @@ pub trait IFoo<ObjectType: 'static>: Sized + std::ops::Deref {
3434
}
3535
}
3636
#[repr(transparent)]
37-
#[derive(Clone)]
37+
#[derive(Debug, Copy, Clone)]
3838
pub struct FooMultiGeneric(pub id);
3939
impl std::ops::Deref for FooMultiGeneric {
4040
type Target = objc::runtime::Object;

tests/expectations/tests/objc_allowlist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub trait PSomeProtocol: Sized + std::ops::Deref {
2424
}
2525
}
2626
#[repr(transparent)]
27-
#[derive(Clone)]
27+
#[derive(Debug, Copy, Clone)]
2828
pub struct AllowlistMe(pub id);
2929
impl std::ops::Deref for AllowlistMe {
3030
type Target = objc::runtime::Object;

tests/expectations/tests/objc_category.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
1010
#[allow(non_camel_case_types)]
1111
pub type id = *mut objc::runtime::Object;
1212
#[repr(transparent)]
13-
#[derive(Clone)]
13+
#[derive(Debug, Copy, Clone)]
1414
pub struct Foo(pub id);
1515
impl std::ops::Deref for Foo {
1616
type Target = objc::runtime::Object;

tests/expectations/tests/objc_class.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ extern "C" {
1313
pub static mut fooVar: Foo;
1414
}
1515
#[repr(transparent)]
16-
#[derive(Clone)]
16+
#[derive(Debug, Copy, Clone)]
1717
pub struct Foo(pub id);
1818
impl std::ops::Deref for Foo {
1919
type Target = objc::runtime::Object;

tests/expectations/tests/objc_class_method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
1010
#[allow(non_camel_case_types)]
1111
pub type id = *mut objc::runtime::Object;
1212
#[repr(transparent)]
13-
#[derive(Clone)]
13+
#[derive(Debug, Copy, Clone)]
1414
pub struct Foo(pub id);
1515
impl std::ops::Deref for Foo {
1616
type Target = objc::runtime::Object;

tests/expectations/tests/objc_interface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
1010
#[allow(non_camel_case_types)]
1111
pub type id = *mut objc::runtime::Object;
1212
#[repr(transparent)]
13-
#[derive(Clone)]
13+
#[derive(Debug, Copy, Clone)]
1414
pub struct Foo(pub id);
1515
impl std::ops::Deref for Foo {
1616
type Target = objc::runtime::Object;

tests/expectations/tests/objc_interface_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
1010
#[allow(non_camel_case_types)]
1111
pub type id = *mut objc::runtime::Object;
1212
#[repr(transparent)]
13-
#[derive(Clone)]
13+
#[derive(Debug, Copy, Clone)]
1414
pub struct Foo(pub id);
1515
impl std::ops::Deref for Foo {
1616
type Target = objc::runtime::Object;

tests/expectations/tests/objc_method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
1010
#[allow(non_camel_case_types)]
1111
pub type id = *mut objc::runtime::Object;
1212
#[repr(transparent)]
13-
#[derive(Clone)]
13+
#[derive(Debug, Copy, Clone)]
1414
pub struct Foo(pub id);
1515
impl std::ops::Deref for Foo {
1616
type Target = objc::runtime::Object;

tests/expectations/tests/objc_method_clash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
1010
#[allow(non_camel_case_types)]
1111
pub type id = *mut objc::runtime::Object;
1212
#[repr(transparent)]
13-
#[derive(Clone)]
13+
#[derive(Debug, Copy, Clone)]
1414
pub struct Foo(pub id);
1515
impl std::ops::Deref for Foo {
1616
type Target = objc::runtime::Object;

tests/expectations/tests/objc_pointer_return_types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
1010
#[allow(non_camel_case_types)]
1111
pub type id = *mut objc::runtime::Object;
1212
#[repr(transparent)]
13-
#[derive(Clone)]
13+
#[derive(Debug, Copy, Clone)]
1414
pub struct Bar(pub id);
1515
impl std::ops::Deref for Bar {
1616
type Target = objc::runtime::Object;
@@ -27,7 +27,7 @@ impl Bar {
2727
impl IBar for Bar {}
2828
pub trait IBar: Sized + std::ops::Deref {}
2929
#[repr(transparent)]
30-
#[derive(Clone)]
30+
#[derive(Debug, Copy, Clone)]
3131
pub struct Foo(pub id);
3232
impl std::ops::Deref for Foo {
3333
type Target = objc::runtime::Object;

tests/expectations/tests/objc_property_fnptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
1010
#[allow(non_camel_case_types)]
1111
pub type id = *mut objc::runtime::Object;
1212
#[repr(transparent)]
13-
#[derive(Clone)]
13+
#[derive(Debug, Copy, Clone)]
1414
pub struct Foo(pub id);
1515
impl std::ops::Deref for Foo {
1616
type Target = objc::runtime::Object;

tests/expectations/tests/objc_protocol.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
1111
pub type id = *mut objc::runtime::Object;
1212
pub trait PFoo: Sized + std::ops::Deref {}
1313
#[repr(transparent)]
14-
#[derive(Clone)]
14+
#[derive(Debug, Copy, Clone)]
1515
pub struct Foo(pub id);
1616
impl std::ops::Deref for Foo {
1717
type Target = objc::runtime::Object;

tests/expectations/tests/objc_protocol_inheritance.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
1111
pub type id = *mut objc::runtime::Object;
1212
pub trait PFoo: Sized + std::ops::Deref {}
1313
#[repr(transparent)]
14-
#[derive(Clone)]
14+
#[derive(Debug, Copy, Clone)]
1515
pub struct Foo(pub id);
1616
impl std::ops::Deref for Foo {
1717
type Target = objc::runtime::Object;
@@ -29,7 +29,7 @@ impl PFoo for Foo {}
2929
impl IFoo for Foo {}
3030
pub trait IFoo: Sized + std::ops::Deref {}
3131
#[repr(transparent)]
32-
#[derive(Clone)]
32+
#[derive(Debug, Copy, Clone)]
3333
pub struct Bar(pub id);
3434
impl std::ops::Deref for Bar {
3535
type Target = objc::runtime::Object;

0 commit comments

Comments
 (0)