Skip to content

Commit 4472e0a

Browse files
author
bors-servo
authored
Auto merge of #354 - Nashenas88:master, r=emilio
Followed Resolved Type Ref instead of panicking This could fix #353, but I would really want everyone to review in case I'm missing something important. The compilation continues for the code I'm working with. Also, should I add a regression test for this? I could simply use the code in the referenced issue.
2 parents 7615250 + a336b01 commit 4472e0a

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

libbindgen/src/codegen/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2013,7 +2013,11 @@ impl CodeGenerator for Function {
20132013
let signature = signature_item.kind().expect_type();
20142014
let signature = match *signature.kind() {
20152015
TypeKind::Function(ref sig) => sig,
2016-
_ => panic!("How?"),
2016+
TypeKind::ResolvedTypeRef(ref item_id) => {
2017+
let item = ctx.resolve_item(*item_id);
2018+
return self.codegen(ctx, result, _whitelisted_items, item);
2019+
},
2020+
_ => panic!("How?")
20172021
};
20182022

20192023
let fndecl = utils::rust_fndecl_from_signature(ctx, signature_item);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* automatically generated by rust-bindgen */
2+
3+
4+
#![allow(non_snake_case)]
5+
6+
7+
pub type FuncType = ::std::option::Option<unsafe extern "C" fn()>;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
typedef void (FuncType) ();
2+
extern FuncType Func;

0 commit comments

Comments
 (0)