Skip to content

Commit 3d9ebc5

Browse files
committed
Don't include objc headers in exception.m
To fix cross compile issues (and also, it's faster to call objc_retain directly instead of using a selector)
1 parent c86ad3a commit 3d9ebc5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

extern/exception.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include <objc/objc.h>
2-
#include <objc/NSObject.h>
1+
// Available from `objc`
2+
id objc_retain(id value);
33

44
void RustObjCExceptionThrow(id exception) {
55
@throw exception;
@@ -9,12 +9,12 @@ int RustObjCExceptionTryCatch(void (*try)(void *), void *context, id *error) {
99
@try {
1010
try(context);
1111
if (error) {
12-
*error = nil;
12+
*error = (id)0; // nil
1313
}
1414
return 0;
1515
} @catch (id exception) {
1616
if (error) {
17-
*error = [exception retain];
17+
*error = objc_retain(exception);
1818
}
1919
return 1;
2020
}

0 commit comments

Comments
 (0)