diff options
-rwxr-xr-x | src/codegen/mod.rs | 3 | ||||
-rw-r--r-- | tests/expectations/tests/use-core.rs | 2 | ||||
-rw-r--r-- | tests/headers/use-core.h | 2 |
3 files changed, 6 insertions, 1 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index bf6af82b..7fa8b19c 100755 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -1489,7 +1489,8 @@ impl ToRustTy for Type { } TypeKind::Function(ref fs) => { let ty = fs.to_rust_ty(ctx, item); - aster::AstBuilder::new().ty().option().build(ty) + let prefix = ctx.trait_prefix(); + quote_ty!(ctx.ext_cx(), ::$prefix::option::Option<$ty>) } TypeKind::Array(item, len) => { let inner = item.to_rust_ty(ctx); diff --git a/tests/expectations/tests/use-core.rs b/tests/expectations/tests/use-core.rs index 484105ea..b0900f5f 100644 --- a/tests/expectations/tests/use-core.rs +++ b/tests/expectations/tests/use-core.rs @@ -20,3 +20,5 @@ fn bindgen_test_layout_foo() { impl Clone for foo { fn clone(&self) -> Self { *self } } +pub type fooFunction = + ::core::option::Option<unsafe extern "C" fn(bar: ::std::os::raw::c_int)>; diff --git a/tests/headers/use-core.h b/tests/headers/use-core.h index 535d2b15..42bb10d9 100644 --- a/tests/headers/use-core.h +++ b/tests/headers/use-core.h @@ -4,3 +4,5 @@ struct foo { int a, b; void* bar; }; + +typedef void (*fooFunction)(int bar); |