We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
@trobanga pointed out that PR #2059 (implementing #1089) doesn't seem to work if we try to add a custom derive to an enum instead of a struct.
enum
I can see the problem if I try to extend the unit test from #2059 like this:
enum my_rustified_enum { ELEVEN = 11, TWELVE, THIRTEEN, };
#[test] fn test_custom_derive() { use std::cmp::{PartialEq, Ordering}; let test3 = unsafe { bindings::my_rustified_enum::ELEVEN }; let test4 = unsafe { bindings::my_rustified_enum::TWELVE }; assert!(test3 < test4); }
I tested this using cargo test within bindgen-integration/, with the custom derives specified like this:
cargo test
bindgen-integration/
fn add_derives(&self, name: &str) -> Vec<String> { if name == "my_rustified_enum" { vec!["PartialOrd".into()] } else { vec![] } }
$ cargo test Compiling bindgen-integration v0.1.0 (.../rust-bindgen/bindgen-integration) error[E0369]: binary operation `<` cannot be applied to type `root::my_rustified_enum` --> src/lib.rs:289:19 | 289 | assert!(test3 < test4); | ----- ^ ----- root::my_rustified_enum | | | root::my_rustified_enum | = note: an implementation of `std::cmp::PartialOrd` might be missing for `root::my_rustified_enum`
PartialOrd should have been added to the #[derive(...) attribute, allowing this test to compile.
PartialOrd
#[derive(...)
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
@trobanga pointed out that PR #2059 (implementing #1089) doesn't seem to work if we try to add a custom derive to an
enum
instead of a struct.I can see the problem if I try to extend the unit test from #2059 like this:
Input C/C++ Header
Bindgen Invocation
I tested this using
cargo test
withinbindgen-integration/
, with the custom derives specified like this:Actual Results
Expected Results
PartialOrd
should have been added to the#[derive(...)
attribute, allowing this test to compile.The text was updated successfully, but these errors were encountered: