-
Notifications
You must be signed in to change notification settings - Fork 745
Avoid _bindgen_ty_ indirection #377
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
Comments
Ah, that annoying rust bug, thanks for filling. Yes, I think we can do multiple things here: First, when generating a typedef, if the inner type is an This should work fine given you can't have a templatized-enum in C/C++, so we shouldn't have issues there. Also, we can constrain it even more if we just do so for unnamed enums. Other thing we may do, is trying to detect that pattern ( Let me know if you'd be interested in fixing that. The relevant code is Thanks for reporting this! |
Awesome, looking forward to it - thanks! |
Fixed in #396. |
Hello,
I'm using
rust-bindgen
to generate bindings for libcouchbase. It works fine in general, but I noticed that for example this typedef enum:Gets abstracted as
_bindgen_ty_10
and then a type alias oftype lcb_KVBUFTYPE = _bindgen_ty_10;
is defined as well. It wouldn't be much of an issue (other than making the rustdoc very noisy since there are many similar types), but then later on in the code I can't pattern match/use the enum variants because of rust-lang/rust#26264 directly.As a result, I end up writing
_bindgen_ty_10::LCB_KV_COPY
which defeats the purpose of the alias mostly.So, is there either a workaround or an option to avoid this indirection and just name the enums/structs directly after what they are called in C code?
Note that this can be easily reproduced by cloning and building https://github.com/couchbaselabs/couchbase-rs/tree/master/couchbase-sys, and I'm happy to help getting it to run :)
Thanks!
The text was updated successfully, but these errors were encountered: