Skip to content

Commit 834014f

Browse files
committed
Added Bindgen names to objective-c pointer return types
* Took advantage of the repr transparent to use Bindgen return type names. * Updated unit tests and book
1 parent 7ee6eb6 commit 834014f

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/codegen/mod.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3464,18 +3464,23 @@ impl TryToRustTy for Type {
34643464

34653465
let inner =
34663466
inner.into_resolver().through_type_refs().resolve(ctx);
3467+
let is_objc_pointer = if let Some(ty) = inner.kind().as_type() {
3468+
match ty.kind() {
3469+
TypeKind::ObjCInterface(..) => true,
3470+
_ => false,
3471+
}
3472+
} else {
3473+
false
3474+
};
34673475
let inner_ty = inner.expect_type();
34683476

3469-
let is_objc_pointer = inner.kind().as_type().map_or(false, |ty| {
3470-
match ty.kind() {
3471-
TypeKind::ObjCInterface(..) => {
3472-
true
3473-
},
3474-
_ => {
3475-
false
3477+
let is_objc_pointer =
3478+
inner.kind().as_type().map_or(false, |ty| {
3479+
match ty.kind() {
3480+
TypeKind::ObjCInterface(..) => true,
3481+
_ => false,
34763482
}
3477-
}
3478-
});
3483+
});
34793484

34803485
// Regardless if we can properly represent the inner type, we
34813486
// should always generate a proper pointer here, so use

0 commit comments

Comments
 (0)