@@ -713,17 +713,6 @@ impl AnyClass {
713
713
}
714
714
}
715
715
716
- #[ allow( unused) ]
717
- #[ doc( alias = "class_getIvarLayout" ) ]
718
- fn instance_variable_layout ( & self ) -> Option < & [ u8 ] > {
719
- let layout: * const c_char = unsafe { ffi:: class_getIvarLayout ( self . as_ptr ( ) ) . cast ( ) } ;
720
- if layout. is_null ( ) {
721
- None
722
- } else {
723
- Some ( unsafe { CStr :: from_ptr ( layout) } . to_bytes ( ) )
724
- }
725
- }
726
-
727
716
#[ allow( unused) ]
728
717
#[ doc( alias = "class_getClassVariable" ) ]
729
718
fn class_variable ( & self , name : & str ) -> Option < & Ivar > {
@@ -798,7 +787,6 @@ impl AnyClass {
798
787
// fn properties(&self) -> Malloc<[&Property]>;
799
788
// unsafe fn replace_method(&self, name: Sel, imp: Imp, types: &str) -> Imp;
800
789
// unsafe fn replace_property(&self, name: &str, attributes: &[ffi::objc_property_attribute_t]);
801
- // unsafe fn set_ivar_layout(&mut self, layout: &[u8]);
802
790
// fn method_imp(&self, name: Sel) -> Imp; // + _stret
803
791
804
792
// fn get_version(&self) -> u32;
@@ -1285,7 +1273,7 @@ mod tests {
1285
1273
use super :: * ;
1286
1274
use crate :: runtime:: MessageReceiver ;
1287
1275
use crate :: test_utils;
1288
- use crate :: { msg_send, sel} ;
1276
+ use crate :: { class , msg_send, sel} ;
1289
1277
1290
1278
#[ test]
1291
1279
fn test_selector ( ) {
@@ -1576,4 +1564,22 @@ mod tests {
1576
1564
assert_eq ! ( size_of:: <Ivar >( ) , 0 ) ;
1577
1565
assert_eq ! ( size_of:: <Method >( ) , 0 ) ;
1578
1566
}
1567
+
1568
+ fn get_ivar_layout ( cls : & AnyClass ) -> * const u8 {
1569
+ let cls: * const AnyClass = cls;
1570
+ unsafe { ffi:: class_getIvarLayout ( cls. cast ( ) ) }
1571
+ }
1572
+
1573
+ #[ test]
1574
+ #[ cfg_attr(
1575
+ feature = "gnustep-1-7" ,
1576
+ ignore = "ivar layout is still used on GNUStep"
1577
+ ) ]
1578
+ fn test_layout_does_not_matter_any_longer ( ) {
1579
+ assert ! ( get_ivar_layout( class!( NSObject ) ) . is_null( ) ) ;
1580
+ assert ! ( get_ivar_layout( class!( NSArray ) ) . is_null( ) ) ;
1581
+ assert ! ( get_ivar_layout( class!( NSException ) ) . is_null( ) ) ;
1582
+ assert ! ( get_ivar_layout( class!( NSNumber ) ) . is_null( ) ) ;
1583
+ assert ! ( get_ivar_layout( class!( NSString ) ) . is_null( ) ) ;
1584
+ }
1579
1585
}
0 commit comments