File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
50
50
` MethodImplementation ` to ` Return ` and ` Arguments ` .
51
51
* ** BREAKING** : Make ` rc::Allocated ` allowed to be ` NULL ` internally, such
52
52
that uses of ` Option<Allocated<T>> ` is now simply ` Allocated<T> ` .
53
+ * ` AnyObject::class ` now returns a ` 'static ` reference to the class.
53
54
54
55
### Deprecated
55
56
* Soft deprecated using ` msg_send! ` without a comma between arguments (i.e.
Original file line number Diff line number Diff line change @@ -1052,9 +1052,11 @@ impl AnyObject {
1052
1052
1053
1053
/// Dynamically find the class of this object.
1054
1054
#[ doc( alias = "object_getClass" ) ]
1055
- pub fn class ( & self ) -> & AnyClass {
1055
+ pub fn class ( & self ) -> & ' static AnyClass {
1056
1056
let ptr: * const AnyClass = unsafe { ffi:: object_getClass ( self . as_ptr ( ) ) } . cast ( ) ;
1057
- // SAFETY: The class is not NULL because the object is not NULL.
1057
+ // SAFETY: The class is not NULL because the object is not NULL, and
1058
+ // it is safe as `'static` since classes are static, and it could be
1059
+ // retrieved via. `AnyClass::get(self.class().name())` anyhow.
1058
1060
unsafe { ptr. as_ref ( ) . unwrap_unchecked ( ) }
1059
1061
}
1060
1062
You can’t perform that action at this time.
0 commit comments