Skip to content

libbindgen fails with "How?" #353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Nashenas88 opened this issue Dec 21, 2016 · 1 comment · Fixed by #354
Closed

libbindgen fails with "How?" #353

Nashenas88 opened this issue Dec 21, 2016 · 1 comment · Fixed by #354
Labels

Comments

@Nashenas88
Copy link
Contributor

The following code:

typedef void (Tcl_FSDupInternalRepProc) ();
extern Tcl_FSDupInternalRepProc TclNativeDupInternalRep;

Triggers the "How?" panic in libbindgen/src/codegen/mod.rs:2008 reproduced here:

        let signature = match *signature.kind() {
            TypeKind::Function(ref sig) => sig,
            _ => panic!("How?"), // << This line
        };

Changing it to:

        let signature = match *signature.kind() {
            TypeKind::Function(ref sig) => sig,
            ref ty => panic!("How? {} {:?}", name, ty), // << This line
        };

Outputs: How? TclNativeDupInternalRep ResolvedTypeRef(ItemId(1))

I was hoping to use libbindgen to move away from Tcl without needed to jump to C++, but the above declaration style is used all over the Tcl headers. (It's of course been cleaned up, macros and extra typedefs removed).

@fitzgen fitzgen added the bug label Dec 21, 2016
@fitzgen
Copy link
Member

fitzgen commented Dec 21, 2016

Thanks for the bug report!

bors-servo pushed a commit that referenced this issue Dec 22, 2016
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.
jethrogb pushed a commit to jethrogb/rust-bindgen that referenced this issue Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants