Skip to content

Commit 7fe40e0

Browse files
author
bors-servo
authored
Auto merge of #229 - emilio:core-functions, r=fitzgen
Fix --use-core for functions, since we used the aster helper. r? @fitzgen, @nox or anyone else?
2 parents 108c4ca + 6645bbc commit 7fe40e0

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/codegen/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1489,7 +1489,8 @@ impl ToRustTy for Type {
14891489
}
14901490
TypeKind::Function(ref fs) => {
14911491
let ty = fs.to_rust_ty(ctx, item);
1492-
aster::AstBuilder::new().ty().option().build(ty)
1492+
let prefix = ctx.trait_prefix();
1493+
quote_ty!(ctx.ext_cx(), ::$prefix::option::Option<$ty>)
14931494
}
14941495
TypeKind::Array(item, len) => {
14951496
let inner = item.to_rust_ty(ctx);

tests/expectations/tests/use-core.rs

+2
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ fn bindgen_test_layout_foo() {
2020
impl Clone for foo {
2121
fn clone(&self) -> Self { *self }
2222
}
23+
pub type fooFunction =
24+
::core::option::Option<unsafe extern "C" fn(bar: ::std::os::raw::c_int)>;

tests/headers/use-core.h

+2
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ struct foo {
44
int a, b;
55
void* bar;
66
};
7+
8+
typedef void (*fooFunction)(int bar);

0 commit comments

Comments
 (0)