summaryrefslogtreecommitdiff
path: root/src/codegen/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen/mod.rs')
-rw-r--r--src/codegen/mod.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 62cebf46..8d5f453f 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -1380,7 +1380,16 @@ impl ToRustTy for Type {
TypeKind::Pointer(inner) |
TypeKind::Reference(inner) => {
let inner = ctx.resolve_item(inner);
- inner.to_rust_ty(ctx).to_ptr(inner.expect_type().is_const(), ctx.span())
+ let inner_ty = inner.expect_type();
+ let ty = inner.to_rust_ty(ctx);
+
+ // Avoid the first function pointer level, since it's already
+ // represented in Rust.
+ if inner_ty.canonical_type(ctx).is_function() {
+ ty
+ } else {
+ ty.to_ptr(inner.expect_type().is_const(), ctx.span())
+ }
}
TypeKind::Named(..) => {
let name = item.canonical_name(ctx);