-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libbpf-cargo: Generate C enums as custom types with const fields
Rather than generating Rust enums from C enums, which might not be correct, as for example, C allows enum variants to share a value while Rust does not. This fixes #982. Test Plan ========= Added regression test where a C defined enum with duplicated values is converted to Rust using BTF and then successfully compiled with Rustc. Verified that tests pass in CI in my fork and that my project compiles fine and works well with this change.
- Loading branch information
1 parent
288befd
commit e241983
Showing
3 changed files
with
69 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters