File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -211,7 +211,8 @@ impl<T> Unpin for Retained<T> {}
211
211
212
212
#[ cfg( test) ]
213
213
mod tests {
214
- use std:: mem:: size_of;
214
+ use core:: mem:: size_of;
215
+ use core:: ptr:: NonNull ;
215
216
216
217
use super :: Retained ;
217
218
use crate :: runtime:: Object ;
@@ -232,7 +233,9 @@ mod tests {
232
233
#[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
233
234
#[ test]
234
235
fn test_clone ( ) {
235
- let obj: Retained < Object > = unsafe { Retained :: new ( msg_send ! [ class!( NSObject ) , new] ) } ;
236
+ // TODO: Maybe make a way to return `Retained` directly?
237
+ let obj: * mut Object = unsafe { msg_send ! [ class!( NSObject ) , new] } ;
238
+ let obj: Retained < Object > = unsafe { Retained :: new ( NonNull :: new ( obj) . unwrap ( ) ) } ;
236
239
assert ! ( obj. retain_count( ) == 1 ) ;
237
240
238
241
let cloned = obj. clone ( ) ;
You can’t perform that action at this time.
0 commit comments