1<!-- START doctoc generated TOC please keep comment here to allow auto update --> 2<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> 3 4- [Unreleased](#unreleased) 5 - [Added](#added) 6 - [Changed](#changed) 7 - [Removed](#removed) 8 - [Fixed](#fixed) 9 - [Security](#security) 10- [0.64.0](#0640) 11 - [Added](#added-1) 12 - [Changed](#changed-1) 13 - [Removed](#removed-1) 14 - [Fixed](#fixed-1) 15 - [Security](#security-1) 16- [0.63.0](#0630) 17 - [Added](#added-2) 18 - [Changed](#changed-2) 19 - [Removed](#removed-2) 20- [0.62.0](#0620) 21 - [Added](#added-3) 22 - [Changed](#changed-3) 23 - [Fixed](#fixed-2) 24- [0.61.0](#0610) 25 - [Added](#added-4) 26 - [Changed](#changed-4) 27 - [Fixed](#fixed-3) 28- [0.60.1](#0601) 29 - [Fixed](#fixed-4) 30- [0.60.0](#0600) 31 - [Added](#added-5) 32 - [Fixed](#fixed-5) 33 - [Changed](#changed-5) 34 - [Removed](#removed-3) 35- [0.59.2](#0592) 36- [0.59.1](#0591) 37 - [Fixed](#fixed-6) 38- [0.59.0](#0590) 39 - [Added](#added-6) 40 - [Fixed](#fixed-7) 41 - [Changed](#changed-6) 42- [0.58.1](#0581) 43 - [Added](#added-7) 44- [0.58.0](#0580) 45 - [Added](#added-8) 46 - [Fixed](#fixed-8) 47 - [Changed](#changed-7) 48 - [Deprecated](#deprecated) 49 - [Removed](#removed-4) 50 - [Fixed](#fixed-9) 51 - [Security](#security-2) 52- [0.57.0](#0570) 53 - [Added](#added-9) 54 - [Fixed](#fixed-10) 55- [0.56.0](#0560) 56 - [Added](#added-10) 57 - [Changed](#changed-8) 58 - [Fixed](#fixed-11) 59- [0.55.1](#0551) 60 - [Fixed](#fixed-12) 61- [0.55.0](#0550) 62 - [Removed](#removed-5) 63 - [Added](#added-11) 64 - [Changed](#changed-9) 65 - [Fixed](#fixed-13) 66- [0.54.1](#0541) 67 - [Added](#added-12) 68 - [Changed](#changed-10) 69 - [Fixed](#fixed-14) 70- [0.54.0](#0540) 71 - [Added](#added-13) 72 - [Changed](#changed-11) 73 - [Fixed](#fixed-15) 74- [0.53.3](#0533) 75 - [Added](#added-14) 76 - [Fixed](#fixed-16) 77- [0.53.2](#0532) 78 - [Changed](#changed-12) 79- [0.53.1](#0531) 80 - [Added](#added-15) 81- [0.53.0](#0530) 82 - [Added](#added-16) 83 - [Changed](#changed-13) 84 - [Fixed](#fixed-17) 85- [0.52.0](#0520) 86 - [Added](#added-17) 87 - [Changed](#changed-14) 88 - [Fixed](#fixed-18) 89- [0.51.1](#0511) 90 - [Fixed](#fixed-19) 91 - [Changed](#changed-15) 92- [0.51.0](#0510) 93 - [Fixed](#fixed-20) 94 - [Changed](#changed-16) 95 - [Added](#added-18) 96- [0.50.0](#0500) 97 - [Added](#added-19) 98- [0.49.3](#0493) 99 - [Added](#added-20) 100- [0.49.2](#0492) 101 - [Changed](#changed-17) 102- [0.49.1](#0491) 103 - [Fixed](#fixed-21) 104 - [Changed](#changed-18) 105- [0.49.0](#0490) 106 - [Added](#added-21) 107 - [Fixed](#fixed-22) 108 - [Changed](#changed-19) 109- [0.48.1](#0481) 110 - [Fixed](#fixed-23) 111- [0.48.0](#0480) 112 - [Changed](#changed-20) 113 - [Fixed](#fixed-24) 114- [0.47.4](#0474) 115 - [Added](#added-22) 116- [0.47.3](#0473) 117 - [Changed](#changed-21) 118- [0.47.2](#0472) 119 - [Fixed](#fixed-25) 120- [0.47.1](#0471) 121 - [Changed](#changed-22) 122 - [Fixed](#fixed-26) 123- [0.47.0](#0470) 124 - [Changed](#changed-23) 125 - [Fixed](#fixed-27) 126- [0.33.1 .. 0.46.0](#0331--0460) 127 - [Added](#added-23) 128 - [Removed](#removed-6) 129 - [Changed](#changed-24) 130 - [Fixed](#fixed-28) 131- [0.33.1](#0331) 132 - [Fixed](#fixed-29) 133- [0.33.0](#0330) 134- [0.32.2](#0322) 135 - [Fixed](#fixed-30) 136- [0.32.1](#0321) 137 - [Fixed](#fixed-31) 138- [0.32.0](#0320) 139 - [Added](#added-24) 140 - [Changed](#changed-25) 141 - [Fixed](#fixed-32) 142- [0.31.0](#0310) 143 - [Added](#added-25) 144 - [Changed](#changed-26) 145 - [Deprecated](#deprecated-1) 146 - [Removed](#removed-7) 147 - [Fixed](#fixed-33) 148- [0.30.0](#0300) 149 - [Added](#added-26) 150 - [Changed](#changed-27) 151 - [Deprecated](#deprecated-2) 152 - [Fixed](#fixed-34) 153- [0.29.0](#0290) 154 - [Added](#added-27) 155 - [Changed](#changed-28) 156 - [Fixed](#fixed-35) 157 158<!-- END doctoc generated TOC please keep comment here to allow auto update --> 159 160-------------------------------------------------------------------------------- 161 162# Unreleased 163 164## Added 165 166## Changed 167 168## Removed 169 170## Fixed 171 172## Security 173 174# 0.64.0 175 176## Added 177 * Added a new set of flags `--with-derive-custom`, 178 `--with-derive-custom-struct`, `--with-derive-custom-enum` and 179 `--with-derive-custom-enum` to add custom derives from the CLI. 180 * Added the `--experimental` flag on `bindgen-cli` and the `experimental` 181 feature on `bindgen` to gate experimental features whose implementation is 182 incomplete or are prone to change in a non-backwards compatible manner. 183 * Added a new set of flags and their equivalent builder methods 184 `--wrap-static-fns`, `--wrap-static-fns-suffix` and `--wrap-static-fns-path` 185 to generate C function wrappers for `static` or `static inline` functions. 186 This feature is experimental. 187 188## Changed 189 * Fixed name collisions when having a C `enum` and a `typedef` with the same 190 name. 191 * The `ParseCallbacks::generated_name_override` method now receives `ItemInfo<'_>` as 192 argument instead of a `&str`. 193 * Updated the `clang-sys` crate version to 1.4.0 to support clang 15. 194 * The return type is now ommited in signatures of functions returning `void`. 195 * Updated the `clap` dependency for `bindgen-cli` to 4. 196 * Rewrote the `bindgen-cli` argument parser which could introduce unexpected 197 behavior changes. 198 * The `ParseCallbacks::add_derives` method now receives `DeriveInfo<'_>` as 199 argument instead of a `&str`. This type also includes the kind of target type. 200 201## Removed 202 203## Fixed 204 205## Security 206 207# 0.63.0 208 209## Added 210 * new feature: `process_comments` method to the `ParseCallbacks` trait to 211 handle source code comments. 212 213## Changed 214 * Only wrap unsafe operations in unsafe blocks if the `--wrap_unsafe_ops` 215 option is enabled. 216 * Replace the `name: &str` argument for `ParseCallbacks::add_derives` by 217 `info: DeriveInfo`. 218 * All the rust targets equal or lower than `1.30` are being deprecated and 219 will be removed in the future. If you have a good reason to use any of these 220 targets, please report it in the issue tracker. 221 222## Removed 223 224 * The following deprecated methods and their equivalent CLI arguments were 225 removed: `whitelist_recursively`, `hide_type`, `blacklist_type`, 226 `blacklist_function`, `blacklist_item`, `whitelisted_type`, 227 `whitelist_type`, `whitelist_function`, `whitelisted_function`, 228 `whitelist_var`, `whitelisted_var`, `unstable_rust`. 229 230# 0.62.0 231 232## Added 233 234 * new feature: `--override-abi` flag to override the ABI used by functions 235 matching a regular expression. 236 * new feature: allow using the `C-unwind` ABI in `--override-abi` on nightly 237 rust. 238 239## Changed 240 241 * Regex inputs are sanitized so alternation (`a|b`) is handled correctly but 242 wildcard patterns (`*`) are now considered invalid. The `.*` pattern can be 243 used as a replacement. 244 * the `ParseCallbacks`trait does not require to implement `UnwindSafe`. 245 * the `Builder::parse_callbacks` method no longer overwrites previously added 246 callbacks and composes them in a last-to-first manner. 247 * any generated rust code containing unsafe operations inside unsafe functions 248 is wrapped in unsafe blocks now. 249 250## Fixed 251 252 * Various issues with upcoming clang/libclang versions have been fixed. 253 254# 0.61.0 255 256Released 2022/10/16 257 258## Added 259 260 * new feature: `--sort-semantically` flag to sort the output in a predefined 261 manner [(#1743)]. 262 * new feature: `Bindgen::emit_warnings` method to emit warnings to stderr in 263 build scripts. 264 * new feature: `--newtype-global-enum` flag to generate enum variants as 265 global constants. 266 * new feature: `--default-non-copy-union-style` flag to set the default style 267 of code used to generate unions with non-`Copy` members. 268 * new feature: `--bindgen-wrapper-union` flag to mark any union that matches a 269 regex and has a non-Copy member to use a bindgen-generated wrapper for its 270 fields. 271 * new feature: `--manually-drop-union` flag to mark any union that matches a 272 regex and has a non-`Copy` member to use `ManuallyDrop`. 273 * new feature: `--merge-extern-blocks` flag to merge several `extern` blocks 274 that have the same ABI. 275 * new feature: `--no-size_t-is-usize` flag to not bind `size_t` as `usize`. 276 * new feature: `Builder` implements `Clone`. 277 278## Changed 279 280 * clap and regex have been updated, new msrv is 1.57. 281 * The `--enable-function-attribute-detection` flag is also used to detect 282 diverging functions so the generated bindings use `!` as the return type. 283 * The `--size_t-is-usize` flag is enabled by default. 284 * Unused type aliases for `<stdint.h>` types are no longer emitted. 285 * The `blocklist` options now can be used to block objective-C methods. 286 * The `core::ffi` module is used the sized raw integer types 287 instead of `std::os::raw` if the Rust target version is `1.64` or higher and 288 the `--use-core` flag is enabled. 289 * The `bindgen` CLI utility must be installed using `cargo install 290 bindgen-cli` now. 291 * Using `bindgen` as a library no longer pulls clap and any other CLI 292 related dependencies. 293 294## Fixed 295 296 * Const correctness of incomplete arrays has been fixed. (#2301) 297 * C++ inline namespaces don't panic. (#2294) 298 299[(#1743)]: https://github.com/rust-lang/rust-bindgen/issues/1743 300 301# 0.60.1 302 303Released 2022/06/06 304 305## Fixed 306 307 * Fixed stack overflow in generated tests for structs with many fields (#2219). 308 309# 0.60.0 310 311Released 2022/06/05 312 313## Added 314 315 * Objective-C structs now derive `Debug` and `Copy` to support C and Objective-C structs. [(#2176)][] 316 * Allow fully-qualified derives. (#2156) 317 * Bindings generation now returns a more suitable error (#2125) 318 * `--version --verbose` now prints clang version (#2140). 319 * Experimental vtable generation (#2145). 320 * Added an `--allowlist-file` option (#2122). 321 * Support for vectorcall ABI (#2177). 322 323## Fixed 324 325 * Fixed lifetimes with Objective-C trait templates. [(#2176)][] 326 * Fixed objc imports for non-`#[macro_use]` use. [(#2176)][] 327 * Handle differences between clang and rustc targets for RISCV (#2137). 328 * `BINDGEN_EXTRA_CLANG_ARGS` is respected on the CLI now (#1723). 329 * Use common type alias for anonymous enums in consts mode (#2191) 330 * Look for `#[must_use]` in typedefs (#2206). 331 * Fixed derive on packed structs (#2083). 332 * Fixed warnings on layout tests (#2203). 333 334## Changed 335 336 * cexpr, clap, and nom have been updated, new msrv is 1.54. 337 338## Removed 339 340 * Support for ancient libclang versions has been removed. 341 342 [(#2176)]: https://github.com/rust-lang/rust-bindgen/pull/2176 343 344# 0.59.2 345 346Released 2021/11/26 347 348 * cexpr+env_logger bump. 349 * Various fixes for C++ crashes / hangs. 350 * Enums now respect annotations and derives properly in more cases. 351 * Some more APIs (blocklist-file, etc). 352 * 'static lifetime is elided when appropriate. 353 354# 0.59.1 355 356Released 2021/07/26 357 358## Fixed 359 360 * Fixed incorrect bitfield constructors generated for very large bitfields (#2082). 361 362# 0.59.0 363 364Released 2021/07/20 365 366## Added 367 368 * Support emitting Makefile-syntax depfiles (#2026) 369 * Add a C naming option (#2045) 370 * Allow explicit padding (#2060) 371 * Add custom derives callback (#2059) 372 * Let Rust derive everything but Default for large arrays in 1.47 and later (#2070). 373 374## Fixed 375 376 * Constants now have docstrings (#2027) 377 * Don't generate bindings for deleted member functions. (#2044) 378 * Zero out padding in custom Default trait implementations (#2051) 379 * Identify forward declarations in params. (#2052) 380 * Add env var EXTRA_CLANG_ARGS_<target>. (#2031) 381 382## Changed 383 384 * cexpr and nom have been updated, new msrv is 1.44 (#2073). 385 386# 0.58.1 387 388Released 2021/04/06 389 390## Added 391 392 * Re-introduced unintentionally removed 393 `bindgen::Builder::whitelist_recursively` (deprecated in favor of 394 `bindgen::Builder::allowlist_recursively`). [#2022][] 395 396# 0.58.0 397 398Released 2021/04/03 399 400## Added 401 402 * Add option to translate enum integer types to native Rust integer types. 403 [#2004][] 404 * Add callback to check derives for blocklisted types. [#2007][] 405 * Add a flag to ensure all symbols are resolved when a library is loaded. 406 [#2013][] 407 * Add from_library for generated dynamic library structs [#2011][]. 408 409## Fixed 410 411 * Track union layout more accurately. Fixes [an AArch64 bug] and [makes the 412 bindings more portable] where unions could return garbage data ([#1984]) 413 * Use original name when checking allowlist for anonymous enum variants. [#2006][] 414 415## Changed 416 417## Deprecated 418 419* `bindgen::Builder::whitelist_type` is deprecated in favor of 420 `bindgen::Builder::allowlist_type`. [#1812][] 421 422* `bindgen::Builder::whitelist_function` is deprecated in favor of 423 `bindgen::Builder::allowlist_function`. [#1812][] 424 425* `bindgen::Builder::whitelist_var` is deprecated in favor of 426 `bindgen::Builder::allowlist_var`. [#1812][] 427 428* `--whitelist-type` is deprecated in favor of 429 `--allowlist-type`. [#1812][] 430 431* `--whitelist-function` is deprecated in favor of 432 `--allowlist-function`. [#1812][] 433 434* `--whitelist-var` is deprecated in favor of 435 `--allowlist-var`. [#1812][] 436 437* `bindgen::Builder::blacklist_type` is deprecated in favor of 438 `bindgen::Builder::blocklist_type`. [#1812][] 439 440* `bindgen::Builder::blacklist_function` is deprecated in favor of 441 `bindgen::Builder::blocklist_function`. [#1812][] 442 443* `bindgen::Builder::blacklist_item` is deprecated in favor of 444 `bindgen::Builder::blocklist_item`. [#1812][] 445 446* `--blacklist-type` is deprecated in favor of 447 `--blocklist-type`. [#1812][] 448 449* `--blacklist-function` is deprecated in favor of 450 `--blocklist-function`. [#1812][] 451 452* `--blacklist-item` is deprecated in favor of 453 `--blocklist-item`. [#1812][] 454 455[#1984]: https://github.com/rust-lang/rust-bindgen/pull/1984 456[an AArch64 bug]: https://github.com/rust-lang/rust-bindgen/issues/1973 457[makes the bindings more portable]: https://github.com/rust-lang/rust-bindgen/issues/1983 458 459## Removed 460 461## Fixed 462 463## Security 464 465--- 466 467# 0.57.0 468 469Released 2021/02/01 470 471## Added 472 473* Expose module-raw-lines to the CLI (#1936) 474* Added an option to fit macro constants to smaller types (#1945) 475* Add an option to respect C++ access specifiers on fields (#1968) 476 477## Fixed 478 479* Improved C++ auto-detection (#1933) 480* Fixed layout of bitfields in some edge cases (#1950) 481* Escape the dyn keyword properly (#1951) 482* Use absolute paths for unsaved files passed to clang (#1857). 483 484# 0.56.0 485 486Released 2020/11/26 487 488## Added 489 490* Objective-c bindings generate `From<ChildClass> for ParentClass` as well as `TryFrom<ParentClass> for ChildClass` ([#1883][]). 491* Experimental dynamic library support via `dynamic_library_name` (#1846). 492* Option to disable deriving `Default` on a per-struct basis (#1930). 493 494## Changed 495 496* Objective-c bindings borrow self rather than take ownership ([#1883][]). 497* Templates and enums now correctly use the same naming scheme as other types 498 (#1891). 499 500## Fixed 501 502* Constructors in wasm32 now return a value. (#1877). 503* Fixed objective-c protocol impl blocks for parent classes's protocols ([#1883][]). 504 505[#1883]: https://github.com/rust-lang/rust-bindgen/issues/1883 506 507-------------------------------------------------------------------------------- 508 509# 0.55.1 510 511Released 2020/08/24. 512 513## Fixed 514 515 * Fixed a regression where anonymous enums referenced by members or such won't 516 generate valid Rust code. (#1882). 517 518-------------------------------------------------------------------------------- 519 520# 0.55.0 521 522Released 2020/08/23. 523 524## Removed 525 526 * Support for libclang 3.8 has been removed (#1830). 527 528## Added 529 530 * Added options to avoid deriving the Debug trait (#1858). 531 532 * Added options to allow to override the default anonymous field prefix (#1859). 533 534 * Added options to allow to override the default macro integer type from the 535 command line (#1863). 536 537## Changed 538 539 * Typed anonymous enums now generate better code (#1850). 540 541 * Objective-C bindings are more idiomatic now (#1847). 542 543 * Updated to clang-sys 1.0. Minimum supported rust version is 1.40 as 544 a consequence of that change. 545 546## Fixed 547 548 * Fixed constness of multi-dimensional arrays in some cases (#1861). 549 550 * Fixed wrong target given to clang when compiling with a target which doesn't 551 match the target clang expects (#1870, #1878). 552 553 * Fixed wrong flags being computed for cross-compilation cases where the target 554 wasn't explicitly provided via clang flags (#1872). 555 556Thanks again to all the awesome contributors that sent patches included in this 557release! 558 559-------------------------------------------------------------------------------- 560 561# 0.54.1 562 563Released 2020/07/06. 564 565**Yanked**: The change in #1798 is technically breaking, see PR for details. 566 567## Added 568 569 * Added ParseCallbacks::func_macro to be able to process function-like macros. 570 (#1792). 571 572 * Allowed IntKind::Custom to represent paths instead of idents (#1800). 573 574## Changed 575 576 * Generated comment now includes the bindgen version, and can be disabled 577 (#1814). 578 579 * Various documentation improvements. 580 581## Fixed 582 583 * Typedefs for types with the same names as rust primitive types compiles 584 (#1798). 585 586 * Bindgen dependencies will now get rebuilt when various environment variables 587 that affect bindgen change (#1809, #1813). 588 589 * Various fixes to command_line_flags (#1816, #1819, #1821). 590 591 * Functions that start with `operator` now get properly generated (#1817). 592 593 594Thanks to all the awesome contributors that sent patches included in this 595release! 596 597-------------------------------------------------------------------------------- 598 599# 0.54.0 600 601Released 2020/05/21. 602 603## Added 604 605 * New command line flag to allow disabling untagged unions (#1789). 606 607## Changed 608 609 * Various documentation improvements (#1764, #1751, #1757). 610 * Better Objective-C support (#1722, #1750). 611 612## Fixed 613 614 * Rust method wrappers are not emitted for blacklisted functions (#1775). 615 * Fixed function signatures in some edge cases involving Objective-C or 616 `__stdcall` (#1781). 617 618-------------------------------------------------------------------------------- 619 620# 0.53.3 621 622Released 2020/05/21. 623 624*Note: This release contains the same fixes and additions as 0.54.0, but without 625the Objective-C breaking changes* 626 627## Added 628 629 * New command line flag to allow disabling untagged unions (#1789). 630 631## Fixed 632 633 * Rust method wrappers are not emitted for blacklisted functions (#1775). 634 * Fixed function signatures in some edge cases involving Objective-C or 635 `__stdcall` (#1781). 636 637-------------------------------------------------------------------------------- 638 639# 0.53.2 640 641Released 2020/03/10. 642 643## Changed 644 645 * clang-sys and cexpr have been updated (#1741 and #1744). 646 * Runtime of some commands has been improved (#1737) 647 * Some error messages have been improved (#1734). 648 649-------------------------------------------------------------------------------- 650 651# 0.53.1 652 653Released 2020/02/03. 654 655## Added 656 657 * Opt-in to convert size_t to usize again (#1720). 658 659-------------------------------------------------------------------------------- 660 661# 0.53.0 662 663Released 2020/02/02. 664 665## Added 666 667 * Support for wasm_import_module. (#1691). 668 * non_exhaustive feature is now stable (#1698). 669 * Various objective-C improvements (#1702). 670 671## Changed 672 673 * Removed size_t to usize conversion rule (#1688). 674 675## Fixed 676 677 * Various unneeded padding fields shouldn't be generated anymore (#1710). 678 * Bitfields on packed structs should generate correct layout (#1717). 679 * Too large bitfield blocks now generate compiling code (#1719). 680 681-------------------------------------------------------------------------------- 682 683# 0.52.0 684 685Released 2019/11/19. 686 687## Added 688 689 * Added `newtype` enum style, much like `bitfield` but without the bitwise ops 690 (#1677). 691 * Added support for `MaybeUninit` rather than `mem::uninitialized()` (#1666). 692 * Allowed static linking (#1620) behind a feature. Note that **if you're using 693 `default-features = false`, you probably want to use the `"runtime"` feature 694 to get the same behavior as before**. 695 696## Changed 697 698 * Use c_void from core when --use-core is specified and available (#1634). 699 * Various dependencies and features are non-default now (like `regex` unicode 700 features). 701 702## Fixed 703 704 * Fixed crash when unknown keywords are used before a namespace (#1678). 705 * Do not generate implementation for clone for flexible array members (#1664). 706 * Fixed `#[must_use]` support for libclang 9+ (#1646). 707 * Fixed `BitfieldUnit` constructor to handle 64 bit wide bitfields on 32 bit (#1640). 708 * Added a `ParseCallbacks` handler for included files. (#1637). 709 710# 0.51.1 711 712Released 2019/09/23. 713 714## Fixed 715 716 * Mismatched `Ord` and `PartialOrd` implementations were fixed, which regresses 717 bindgen in funny ways when using rustc nightly. Dot releases for a few of the 718 previous versions of bindgen will be created with this fix. Also, 719 a `v0.51.1-oldsyn` version was uploaded without the syn update. [#1627][] 720 721## Changed 722 723 * Syn and related dependencies have been updated. [#1611][] 724 725 * Switches added to allow less dependencies. In 726 particular: It won't pull `failure` and related dependencies by default, and 727 there's a default-on `which-rustfmt` feature which allows to get rid of 728 `which` altogether. [#1615][] / [#1625][] 729 730 * `fxhash` dependency was switched to `rustc-hash`. [#1626][] 731 732[#1627]: https://github.com/rust-lang/rust-bindgen/issues/1627 733[#1611]: https://github.com/rust-lang/rust-bindgen/issues/1611 734[#1615]: https://github.com/rust-lang/rust-bindgen/issues/1615 735[#1625]: https://github.com/rust-lang/rust-bindgen/issues/1625 736[#1626]: https://github.com/rust-lang/rust-bindgen/issues/1626 737[#1627]: https://github.com/rust-lang/rust-bindgen/issues/1627 738 739# 0.51.0 740 741Released 2019/07/26. 742 743## Fixed 744 745 * Improve workaround for LLVM stack overflow when evaluating value-dependent 746 expressions. [#1591][] 747 748 * Bindgen will properly detect the layout of incomplete arrays. [#1592][] 749 750 * Bindgen will properly detect the layout of empty unions and forward 751 declarations of unions. [#1593][] and [#1595][]. Thanks @pmarks! 752 753## Changed 754 755 * Refactored the way layout of `wchar_t` is computed. This is a breaking change 756 since `IntKind::WChar` (exposed in `ParseCallbacks`) no longer needs a `size` 757 member. [#1596][] 758 759## Added 760 761 * Bindgen now reads `RUSTFMT` in the environment to try to find a suitable 762 `rustfmt` binary. [#1602][] 763 764[#1591]: https://github.com/rust-lang/rust-bindgen/issues/1591 765[#1592]: https://github.com/rust-lang/rust-bindgen/issues/1592 766[#1593]: https://github.com/rust-lang/rust-bindgen/issues/1593 767[#1595]: https://github.com/rust-lang/rust-bindgen/issues/1595 768[#1596]: https://github.com/rust-lang/rust-bindgen/issues/1596 769[#1602]: https://github.com/rust-lang/rust-bindgen/issues/1602 770 771# 0.50.0 772 773Released 2019/07/01. 774 775## Added 776 777* Fixed pointers to Objective C blocks [#1582][]. 778 779* Various bindgen auto-generated types are now constructible in `const fn` 780 contexts [#1571][] 781 782* It is possible to generate `#[non_exhaustive]` enums for rust nightly targets. 783 [#1575][] 784 785* It is possible to avoid building clap now if you're using bindgen as 786 a library. [#1581][]. 787 788[#1571]: https://github.com/rust-lang/rust-bindgen/issues/1571 789[#1575]: https://github.com/rust-lang/rust-bindgen/issues/1575 790[#1581]: https://github.com/rust-lang/rust-bindgen/issues/1581 791[#1582]: https://github.com/rust-lang/rust-bindgen/issues/1582 792 793# 0.49.3 794 795Released 2019/06/25. **YANKED** 796 797## Added 798 799* Various bindgen auto-generated types are now constructible in `const fn` 800 contexts [#1571][] 801 802* It is possible to generate `#[non_exhaustive]` enums for rust nightly targets. 803 [#1575][] 804 805* It is possible to avoid building clap now if you're using bindgen as 806 a library. [#1581][]. 807 808[#1571]: https://github.com/rust-lang/rust-bindgen/issues/1571 809[#1575]: https://github.com/rust-lang/rust-bindgen/issues/1575 810[#1581]: https://github.com/rust-lang/rust-bindgen/issues/1581 811 812# 0.49.2 813 814Released 2019/05/22 815 816## Changed 817 818* Bindgen now has an option to generate array arguments as pointer to the array, 819 not to the element (so `void foo(int arr[2])` would be generated as 820 `arr: *mut [c_int; 2]` rather than `arr: *mut c_int`. Thanks @elichai! 821 [#1564][]. 822 823[#1564]: https://github.com/rust-lang/rust-bindgen/issues/1564 824 825# 0.49.1 826 827Released 2019/05/16 828 829## Fixed 830 831* Bindgen will not emit `#[link_name]` attributes in win32 and macos for 832 C functions and constants where it can detect it's not needed (thanks 833 @michaelwoerister!). [#1558][] 834 835## Changed 836 837* Bindgen will no longer use `hashbrown` internally, and will use fxhash 838 and `std::HashMap`. This is equivalent for newer `rustc`s since `hashbrown` 839 was merged in libstd, and the performance difference should be close to zero 840 for older rustcs. 841 842[#1558]: https://github.com/rust-lang/rust-bindgen/issues/1558 843 844# 0.49.0 845 846Released 2019/03/27 847 848## Added 849 850* BINDGEN_EXTRA_CLANG_ARGS environment variable was added (thanks @jhwgh1968!). [#1537][] 851 852## Fixed 853 854* Bindgen will properly name parameters inside nested function pointer 855 declarations (thanks @flowbish!). [#1535][] 856 857## Changed 858 859* Derive code was greatly improved by @jethrogb. [#1540][] 860* Derive analysis now handles trivial types more gracefully. [#1492][] 861* clang-sys was updated by @eclipseo. [#1539][] 862* bindgen should now get include paths correctly even when `--target` is 863 specified. The `detect_include_paths` option can be used to opt-out of this 864 behavior. 865 866[#1535]: https://github.com/rust-lang/rust-bindgen/issues/1535 867[#1537]: https://github.com/rust-lang/rust-bindgen/issues/1537 868[#1540]: https://github.com/rust-lang/rust-bindgen/issues/1540 869[#1492]: https://github.com/rust-lang/rust-bindgen/issues/1492 870 871# 0.48.1 872 873Released 2019/03/06 874 875## Fixed 876 877* Bindgen will properly lay out types that use reference members. [#1531][] 878 879[#1531]: https://github.com/rust-lang/rust-bindgen/issues/1531 880 881-------------------------------------------------------------------------------- 882 883# 0.48.0 884 885Released 2019/03/04 886 887## Changed 888 889* Default rust target was changed to 1.33, which means that bindgen can get much 890 more often the layout of structs right. [#1529][] 891 892## Fixed 893 894* Bindgen will output repr(align) just when needed for unions. [#1498][] 895 896[#1529]: https://github.com/rust-lang/rust-bindgen/issues/1529 897[#1498]: https://github.com/rust-lang/rust-bindgen/issues/1498 898 899-------------------------------------------------------------------------------- 900 901# 0.47.4 902 903Released 2020/11/13 904 905## Added 906 907* Backported BINDGEN_EXTRA_CLANG_ARGS support per request (#1910). 908 909-------------------------------------------------------------------------------- 910 911# 0.47.3 912 913Released 2019/02/25 914 915## Changed 916 917* Allowed to build with which 1.0. 918 919-------------------------------------------------------------------------------- 920 921# 0.47.2 922 923Released 2019/02/22 924 925## Fixed 926 927* @flowbish fixed code generation for nested function prototypes. [#1508][] 928* Some complex C++ constructs no longer panic on code generation [#1513][] 929* Implicit template parameters are now appended to base classes [#1515][] 930* @flier fixed single-argument block pointers [#1519][] 931* Bindgen won't panic when parsing an undeduced auto type [#1525][] 932 933[#1508]: https://github.com/rust-lang/rust-bindgen/issues/1508 934[#1513]: https://github.com/rust-lang/rust-bindgen/issues/1513 935[#1515]: https://github.com/rust-lang/rust-bindgen/issues/1515 936[#1519]: https://github.com/rust-lang/rust-bindgen/issues/1519 937[#1525]: https://github.com/rust-lang/rust-bindgen/issues/1525 938 939-------------------------------------------------------------------------------- 940 941# 0.47.1 942 943Released 2019/02/02 944 945## Changed 946 947* @luser improved the error message when rustfmt cannot be found [#1501][] 948 949## Fixed 950 951* Reverted `clang-sys` update for regressions [#1505][] 952 953[#1505]: https://github.com/rust-lang/rust-bindgen/issues/1505 954[#1501]: https://github.com/rust-lang/rust-bindgen/issues/1501 955 956-------------------------------------------------------------------------------- 957 958# 0.47.0 959 960Released 2019/01/19 961 962## Changed 963 964- `#pragma pack(n)` is now translated to `#[repr(C, packed(n))]` when targeting Rust 1.33+. [#537][] 965 966[#537]: https://github.com/rust-lang/rust-bindgen/issues/537 967 968* Bitfield enums now use `#[repr(transparent)]` instead of `#[repr(C)]` when targeting Rust 1.28+. [#1474][] 969 970[#1474]: https://github.com/rust-lang/rust-bindgen/issues/1474 971 972## Fixed 973 974* `#[repr(packed)]` is now properly added if the struct only contains a vtable. 975 [#1495][] 976 977[#1495]: https://github.com/rust-lang/rust-bindgen/pull/1495 978 979* `clang-sys` should now more accurately find libclang versions when multiple 980 of them are available. [#1489][] 981 982[#1489]: https://github.com/rust-lang/rust-bindgen/pull/1489 983 984-------------------------------------------------------------------------------- 985 986# 0.33.1 .. 0.46.0 987 988https://github.com/rust-lang/rust-bindgen/compare/v0.32.2...v0.46.0 989 990(Just a sneak peek, since a lot of stuff has changed :D) 991 992## Added 993 994* APIs to add lines to specific rust modules / C++ namespaces exist now. 995 [#1307][] 996 997[#1307]: https://github.com/rust-lang/rust-bindgen/issues/1307 998 999## Removed 1000 1001* The link options (`link`, `link_framework`, `link_static`) have been removed. 1002 They did nothing already, see [#104][] 1003 1004[#104]: https://github.com/rust-lang/rust-bindgen/issues/104 1005 1006## Changed 1007 1008* Associated constants are used now for bitfield enums when available. [#1166][] 1009 1010[#1166]: https://github.com/rust-lang/rust-bindgen/issues/1166 1011 1012* New versions of a bunch of dependencies (syn / quote / etc.). 1013 1014## Fixed 1015 1016* Better target information from clang to properly generate types when 1017 cross-compiling [#1289][]. 1018 1019[#1289]: https://github.com/rust-lang/rust-bindgen/issues/1289 1020 1021* Pointer constness was fixed in a bunch of cases when using `int const*` and 1022 such. [#1311][] [#1312][]. 1023 1024[#1311]: https://github.com/rust-lang/rust-bindgen/issues/1311 1025[#1312]: https://github.com/rust-lang/rust-bindgen/issues/1312 1026 1027* Bitfields now work properly on big-endian machines. [#1340][] 1028 1029[#1340]: https://github.com/rust-lang/rust-bindgen/issues/1340 1030 1031* `wchar_t` layout works properly now. [#1345][] 1032 1033[#1345]: https://github.com/rust-lang/rust-bindgen/issues/1345 1034 1035* Functions can be blacklisted now. [#1364][] 1036 1037[#1364]: https://github.com/rust-lang/rust-bindgen/issues/1364 1038 1039* ... Lot's more! 1040 1041-------------------------------------------------------------------------------- 1042 1043# 0.33.1 1044 1045Released 2018/02/14 1046 1047## Fixed 1048 1049* Reverted the dependency update to `quote = "0.4"` and addition of the 1050 `proc_macro2` dependency. The `proc_macro2` crate depends on `rustc` internal 1051 libraries, which means that CLIs which use it must be run under `rustup`, 1052 which is not acceptable for `bindgen`. [#1248][] 1053 1054[#1248]: https://github.com/rust-lang/rust-bindgen/issues/1248 1055 1056-------------------------------------------------------------------------------- 1057 1058# 0.33.0 1059 1060-------------------------------------------------------------------------------- 1061 1062# 0.32.2 1063 1064Released 2018/01/22 1065 1066## Fixed 1067 1068* Avoid symbol generation for pure virtual functions. [#1197][] 1069* Handling of `_Complex _Float128`. [#1087][] 1070* Regression on code generation for variadic functions. [#1216][] 1071* Enum code generation generates conflicting repr hint warning. [#1224][] 1072* Constified code generation for enums with an explicit type of `bool`. [#1145][] 1073* Bindgen will now call `rustfmt` directly instead of via `rustup`. [#1184][] 1074 1075[#1197]: https://github.com/rust-lang/rust-bindgen/issues/1197 1076[#1087]: https://github.com/rust-lang/rust-bindgen/issues/1087 1077[#1216]: https://github.com/rust-lang/rust-bindgen/issues/1216 1078[#1224]: https://github.com/rust-lang/rust-bindgen/issues/1224 1079[#1145]: https://github.com/rust-lang/rust-bindgen/issues/1145 1080[#1184]: https://github.com/rust-lang/rust-bindgen/issues/1184 1081 1082# 0.32.1 1083 1084Released 2017/12/18 1085 1086## Fixed 1087 1088* When translating C/C++ `enum`s into Rust `enum`s using `rustified_enum` / 1089 `--rustified-enum`, properly add `#[repr(C)]` to the emitted `enum`. [#1183][] 1090 1091[#1183]: https://github.com/rust-lang/rust-bindgen/issues/1183 1092 1093-------------------------------------------------------------------------------- 1094 1095# 0.32.0 1096 1097Released 2017/12/08 1098 1099## Added 1100 1101* Added support for bit-field allocation units that are larger than 64 bits 1102 wide. Note that individual bit-fields within such units are still restricted 1103 to being no wider than 64 bits. [#1158][] 1104 1105* We can now generate random C header files and test that `bindgen` can process 1106 them with the `quickcheck` crate. Initial support landed in [#1159][] with a 1107 few more additions in follow up pull requests. 1108 1109## Changed 1110 1111* The `bindgen::Builder::{constified_enum_module,{bitfield,rustified}_enum}` 1112 builder methods and their corresponding CLI flags now compare their argument 1113 to the C/C++ `enum`'s "canonical path", which includes leading namespaces, 1114 rather than its "canonical name", which does not. This is a breaking change 1115 that requires callers which target a namespaced C++ enum to call e.g. 1116 `bitfield_enum("<namespace>::<enum_name>")` rather than e.g. 1117 `bitfield_enum("<enum_name>")`. [#1162][] 1118 1119* When a struct is packed to a smaller alignment that is still greater than one, 1120 `bindgen` cannot emit Rust bindings that match the input source. Before, it 1121 would emit `#[repr(packed)]` anyways, which packs to an alignment of one, but 1122 this can lead to misalignment and UB. Now, `bindgen` will detect these 1123 situations and convert the struct into an opaque blob of bytes with the proper 1124 alignment. We are eagerly awaiting support for `#[repr(packed(N))]` in 1125 Rust. [#1136][] 1126 1127## Fixed 1128 1129* There was a perfect storm of conditions that could cause `bindgen` not to emit 1130 any bindings if spawning `rustfmt` to format the bindings failed. This is now 1131 fixed. [#1112][] 1132 1133* In some circumstances, `bindgen` would emit type parameters twice for 1134 references to template instantiations. This is now fixed. [#1113][] 1135 1136* When a C/C++ struct had a field named with a Rust keyword, and `impl_debug` 1137 was enabled, the generated `impl Debug for ...` blocks could reference the 1138 field by the Rust keyword name, rather than the non-keyword field name we 1139 actually end up generating. This is now fixed. [#1123][] 1140 1141* There was a regression in 0.31.0 where C++ template aliases to opaque types 1142 would sometimes not treat the aliased type as opaque. This is now 1143 fixed. [#1118][] 1144 1145* There was a regression in 0.31.0 that could cause `bindgen` to panic when 1146 parsing nested template classes. This is now fixed. [#1127][] 1147 1148* Unnamed bit-fields do not affect alignment of their struct or class in C/C++, 1149 however `bindgen` interpreted them as doing so, which could generate 1150 `#[repr(C)]` structs expecting to have an incorrect alignment. This is now 1151 fixed. [#1076][] 1152 1153* When a zero-sized type was used in a bit-field, `bindgen` could 1154 divide-by-zero. This is now fixed. [#1137][] 1155 1156* When a template parameter is used in a bit-field, `bindgen` would panic. This 1157 is now fixed. [#1140][] 1158 1159* There was a regression in 0.31.0 where if `bindgen` was given a header file 1160 that did not exist, it would panic. This is now fixed, and it will instead 1161 properly report the error. [#1146][] 1162 1163* In some cases, generated bit-field getters and setters could access memory 1164 beyond `self`. This is now fixed. [#954][] 1165 1166[#1162]: https://github.com/rust-lang/rust-bindgen/issues/1162 1167[#1113]: https://github.com/rust-lang/rust-bindgen/issues/1113 1168[#1112]: https://github.com/rust-lang/rust-bindgen/issues/1112 1169[#1123]: https://github.com/rust-lang/rust-bindgen/issues/1123 1170[#1127]: https://github.com/rust-lang/rust-bindgen/issues/1127 1171[#1136]: https://github.com/rust-lang/rust-bindgen/issues/1136 1172[#1137]: https://github.com/rust-lang/rust-bindgen/issues/1137 1173[#1140]: https://github.com/rust-lang/rust-bindgen/issues/1140 1174[#1146]: https://github.com/rust-lang/rust-bindgen/issues/1146 1175[#1118]: https://github.com/rust-lang/rust-bindgen/issues/1118 1176[#1076]: https://github.com/rust-lang/rust-bindgen/issues/1076 1177[#1158]: https://github.com/rust-lang/rust-bindgen/issues/1158 1178 1179-------------------------------------------------------------------------------- 1180 1181# 0.31.0 1182 1183Released 2017/10/27 1184 1185## Added 1186 1187* **A new `bindgen` reviewer: [@pepyakin](https://github.com/pepyakin)** 1188 You can ask @pepyakin to review all your future pull requests with `r? 1189 @pepyakin` from now on 1190 1191* Timers for seeing which phases `bindgen` is spending its time in. On the 1192 command line, use the `--time-phases` flag. From a builder, use the 1193 `bindgen::Builder::time_phases(true)` method. [#938][] 1194 1195* You can now disable `#[derive(Copy)]` for all types with `--no-derive-copy` 1196 and `bindgen::Builder::derive_copy(false)`. [#948][] 1197 1198* We now have an overview of `bindgen`'s code base and architecture for 1199 newcomers in `CONTRIBUTING.md`. [#988][] 1200 1201* Derive `PartialOrd` with the `--with-derive-partialord` CLI flag or 1202 `bindgen::Builder::derive_partialord(true)` builder method. [#882][] 1203 1204* Derive `Ord` with the `--with-derive-ord` CLI flag or 1205 `bindgen::Builder::derive_ord(true)` builder method. [#884][] 1206 1207* When `PartialEq` cannot be derived because of an array larger than Rust's 1208 array-derive limit, `bindgen` can emit an `impl PartialEq for ...` 1209 block. Enable this behavior with the `--impl-partialeq` CLI flag or the 1210 `bindgen::Builder::impl_partialeq(true)` method. [#1012][] 1211 1212* When deriving `PartialEq` for all types, you can now specify particular types 1213 that shouldn't `derive(PartialEq)` with the `--no-partialeq <regex>` CLI flag 1214 or `bindgen::Builder::no_partialeq("<regex>")` builder method. [#996][] 1215 1216* Specify types that should not derive `Copy` with the `--no-copy <regex>` CLI 1217 flag or `bindgen::Builder::no_copy("<regex>")` builder method. This 1218 functionality was previously only available via comment annotations in the 1219 header sources. [#1099][] 1220 1221* When deriving `Hash` for all types, you can now specify particular types that 1222 shouldn't `derive(Hash)` with the `--no-hash <regex>` CLI flag or 1223 `bindgen::Builder::no_hash("<regex>")` builder method. [#1105][] 1224 1225* The `bindgen` users guide now has an [FAQ section][faq]! If you have any FAQ 1226 suggestions to put up there, please open a pull request. [#1020][] 1227 1228* Added `csmith` fuzzing infrastructure. `csmith` generates random C and C++ 1229 programs, we feed those into `bindgen` as headers to generate bindings to, 1230 then test that the generated bindings compile and that their layout tests 1231 pass. This infrastructure landed in 1232 [many small bits](https://github.com/rust-lang/rust-bindgen/issues?utf8=%E2%9C%93&q=label%3AA-csmith%20is%3Aclosed). 1233 1234 We <3 folks who [help us find and fix issues via fuzzing][fuzzing]! *hint 1235 hint* 1236 1237* Added experimental support for the `thiscall` ABI when targetting Rust 1238 nightly. [#1065][] 1239 1240## Changed 1241 1242* If the user does not explicitly pass a `--target` argument for `libclang`, 1243 `bindgen` will insert such an argument itself. See [#942][], [#947][], and 1244 [#953][] for details. 1245 1246* C/C++ `enum`s are now translated into constants by default, rather than Rust 1247 `enum`s. The old behavior was a big footgun because `rustc` assumes that the 1248 only values of an `enum` are its variants, whereas a lot of C/C++ code uses 1249 random values as `enum`s. Put these two things and it leads to *undefined 1250 behavior*. Translating C/C++ `enum`s into Rust `enum`s is still available with 1251 the `--rustified-enum <regex>` CLI flag and 1252 `bindgen::Builder::rustified_enum("<regex>")` builder method. [#758][] 1253 1254* Generated bindings are now pretty printed with `rustfmt` by default. 1255 Previously, this option existed, but was off by default because `syntex` did 1256 an OK job at pretty printing the bindings. Now that we are using `quote! { 1257 ... }` instead of `syntex`, we lost that pretty printing, and now rely on 1258 `rustfmt`. You can disable `rustfmt`ing with `--no-rustfmt-bindings` or 1259 `bindgen::Builder::rustfmt_bindings(false)`. See [#925][] and [#1022][] for 1260 details. 1261 1262## Deprecated 1263 1264* `bindgen::Builder::hide_type` is deprecated in favor of 1265 `bindgen::Builder::blacklist_type`. [#987][] 1266 1267* `bindgen::Builder::whitelisted_type` is deprecated in favor of 1268 `bindgen::Builder::whitelist_type`. [#987][] 1269 1270* `bindgen::Builder::whitelisted_function` is deprecated in favor of 1271 `bindgen::Builder::whitelist_function`. [#985][] 1272 1273* `bindgen::Builder::whitelisted_var` is deprecated in favor of 1274 `bindgen::Builder::whitelist_var`. [#989][] 1275 1276## Removed 1277 1278* Removed the dependency on (unmaintained) `syntex`, and **build times are cut 1279 in half**! 1280 1281 Before: 1282 1283 ``` 1284 $ cargo clean; cargo build 1285 <snip> 1286 Finished dev [unoptimized + debuginfo] target(s) in 98.75 secs 1287 ``` 1288 1289 After: 1290 1291 ``` 1292 $ cargo clean; cargo build 1293 <snip> 1294 Finished dev [unoptimized + debuginfo] target(s) in 46.26 secs 1295 ``` 1296 1297 [#925][] 1298 1299* The `BindgenOptions` type is no longer public. It had been deprecated in 1300 previous releases. Use `bindgen::Builder` instead. [#1000][] 1301 1302## Fixed 1303 1304* Under certain conditions, a globally scoped `enum` could end up with bindings 1305 in the wrong namespace module. [#888][] 1306 1307* Blacklisted types were incorrectly assumed to always be `Copy`able (and 1308 assumed to implement other traits as well). `bindgen` is now conservatively 1309 pessimistic about the traits that blacklisted types implement. [#944][] 1310 1311* When bitfields have a ridiculously large number of bits (for example, 1312 `unsigned : 632;`) then `bindgen` was incorrectly deriving traits that 1313 couldn't be derived, resulting in errors when compiling the bindings, and was 1314 also generating `struct`s with an incorrect layout. Both issues have been 1315 fixed. [#982][] 1316 1317* `_` is a valid identifier in some C++ contexts, but can't be referenced in 1318 Rust, as it is the "throwaway identifier" (a term I just made up, if you use 1319 it now, then you owe me money). `bindgen` will now translate `_` into `__` so 1320 that it can be used on the Rust side. [#1008][] 1321 1322* Nested class definitions were sometimes being emitted in the wrong namespace 1323 module in the generated bindings. [#1048][] 1324 1325* `bindgen` was mis-handling `union`s that contained bitfield members. This has 1326 been fixed. [#744][] 1327 1328* Unsigned constants that were greater than `u32::MAX` were being mis-translated 1329 by `bindgen`. This is now fixed. [#1040][] 1330 1331* When given a directory as an input file, or a file to which we don't have read 1332 permissions, then `bindgen` will print a more useful error message 1333 now. [#1029][] 1334 1335* `bindgen` previously attempted to derive `Hash` for structures with 1336 flexibly-sized array members, but knowing how many elements exist in such 1337 arrays requires program-specific knowledge that `bindgen` cannot 1338 have. [#1094][] 1339 1340[faq]: https://rust-lang.github.io/rust-bindgen/faq.html 1341[fuzzing]: https://github.com/rust-lang/rust-bindgen/blob/main/csmith-fuzzing/README.md 1342 1343[#938]: https://github.com/rust-lang/rust-bindgen/issues/938 1344[#888]: https://github.com/rust-lang/rust-bindgen/issues/888 1345[#944]: https://github.com/rust-lang/rust-bindgen/issues/944 1346[#942]: https://github.com/rust-lang/rust-bindgen/issues/942 1347[#947]: https://github.com/rust-lang/rust-bindgen/issues/947 1348[#953]: https://github.com/rust-lang/rust-bindgen/issues/953 1349[#948]: https://github.com/rust-lang/rust-bindgen/issues/948 1350[#925]: https://github.com/rust-lang/rust-bindgen/issues/925 1351[#758]: https://github.com/rust-lang/rust-bindgen/issues/758 1352[#988]: https://github.com/rust-lang/rust-bindgen/issues/988 1353[#987]: https://github.com/rust-lang/rust-bindgen/issues/987 1354[#985]: https://github.com/rust-lang/rust-bindgen/issues/985 1355[#989]: https://github.com/rust-lang/rust-bindgen/issues/989 1356[#1000]: https://github.com/rust-lang/rust-bindgen/issues/1000 1357[#882]: https://github.com/rust-lang/rust-bindgen/issues/882 1358[#884]: https://github.com/rust-lang/rust-bindgen/issues/884 1359[#996]: https://github.com/rust-lang/rust-bindgen/issues/996 1360[#982]: https://github.com/rust-lang/rust-bindgen/issues/982 1361[#1008]: https://github.com/rust-lang/rust-bindgen/issues/1008 1362[#1022]: https://github.com/rust-lang/rust-bindgen/issues/1022 1363[#1048]: https://github.com/rust-lang/rust-bindgen/issues/1048 1364[#1012]: https://github.com/rust-lang/rust-bindgen/issues/1012 1365[#744]: https://github.com/rust-lang/rust-bindgen/issues/744 1366[#1065]: https://github.com/rust-lang/rust-bindgen/issues/1065 1367[#1040]: https://github.com/rust-lang/rust-bindgen/issues/1040 1368[#1029]: https://github.com/rust-lang/rust-bindgen/issues/1029 1369[#1094]: https://github.com/rust-lang/rust-bindgen/issues/1094 1370[#1099]: https://github.com/rust-lang/rust-bindgen/issues/1099 1371[#1105]: https://github.com/rust-lang/rust-bindgen/issues/1105 1372 1373-------------------------------------------------------------------------------- 1374 1375# 0.30.0 1376 1377Released 2017/08/28 1378 1379## Added 1380 1381* Explicit control over choosing which Rust version (specific stable versions or 1382 nightly Rust) to target. This defaults to the latest stable Rust 1383 version. [#832][] 1384 1385```rust 1386bindgen::Builder::default() 1387 .rust_target(bindgen::RustTarget::Stable_1_19) 1388 // or `.rust_target(bindgen::RustTarget::Nightly)` to use unstable features 1389``` 1390 1391or 1392 1393``` 1394$ bindgen --rust-target 1.19 1395# or `--rust-target nightly` to use unstable features 1396``` 1397 1398* Started adding `derive(Copy)` for large arrays of `Copy` things, even when the 1399 array is too large to `derive(Clone)` because Rust doesn't implement `Clone` 1400 for arrays of length greater than 32. [#874][] 1401 1402* `bindgen` can now determine which types are hashable and add `derive(Hash)` to 1403 those types that support it. This is disabled by default, but can be enabled 1404 via `bindgen::Builder::derive_hash` or `--with-derive-hash`. [#876][] 1405 1406* `bindgen` can now generate `impl Debug for Blah` trait implementations for 1407 types that contain non-`Debug` types, and therefore cannot 1408 `derive(Debug)`. This behavior can be enabled with 1409 `bindgen::Builder::impl_debug` and `--impl-debug`. [#875][] 1410 1411* `bindgen` can now invoke `rustfmt` on the generated bindings. The bindings 1412 have historically been fairly pretty printed, but sometimes this is not the 1413 case, especially with the new `impl Debug for Blah` feature. Have `bindgen` 1414 run `rustfmt` with `bindgen::Builder::rustfmt_bindings` and 1415 `--rustfmt-bindings`, and use non-default `rustfmt` configuration files with 1416 `bindgen::Builder::rustfmt_configuration_file` and 1417 `--rustfmt-configuration-file`. [#900][] 1418 1419* `bindgen` can now determine which types can be compared with `==` and add 1420 `derive(PartialEq)` to those types that support it. This is disabled by 1421 default, but can be enabled via `bindgen::Builder::derive_partialeq` or 1422 `--with-derive-partialeq`. [#878][] 1423 1424* Additionally, `bindgen` can also add `derive(Eq)` to those types which we 1425 determined we could `derive(PartialEq)` and do not transitively contain any 1426 floats. Enable this behavior with `bindgen::Builder::derive_eq` or 1427 `--with-derive-eq`. [#880][] 1428 1429## Changed 1430 1431* Started emitting Rust `union`s when targeting stable Rust >= 1.19, not just 1432 unstable nightly Rust. [#832][] 1433 1434* Emitted layout `#[test]`s no longer contain internal IDs for template 1435 instantiations including pointers and arrays. This should make generated 1436 bindings more stable across updates to unrelated parts of the input 1437 headers. [#871][] 1438 1439* Determining whether a type can derive `Copy` or not was ported from an ad-hoc 1440 algorithm to our fix-point framework. [#766][] 1441 1442* Determining whether a type has a destructor or not was also ported from an 1443 ad-hoc algorithm to our fix-point framework. [#927][] 1444 1445## Deprecated 1446 1447* `bindgen::Builder::unstable_rust`/`--unstable-rust` is deprecated, in favor of 1448 targeting explicit Rust versions with 1449 `bindgen::Builder::rust_target`/`--rust-target` instead. [#832][] 1450 1451## Fixed 1452 1453* Fixed a regression in the `derive(Default)` analysis that resulted in some 1454 opaque types deriving `Default` when they shouldn't have. [#889][] 1455 1456* Fixed a regression where template instantiation layout `#[test]`s were being 1457 generated with invalid Rust identifiers. [#906][] 1458 1459[#832]: https://github.com/rust-lang/rust-bindgen/issues/832 1460[#871]: https://github.com/rust-lang/rust-bindgen/issues/871 1461[#874]: https://github.com/rust-lang/rust-bindgen/pull/874 1462[#889]: https://github.com/rust-lang/rust-bindgen/pull/874 1463[#766]: https://github.com/rust-lang/rust-bindgen/issues/766 1464[#876]: https://github.com/rust-lang/rust-bindgen/issues/876 1465[#875]: https://github.com/rust-lang/rust-bindgen/issues/875 1466[#906]: https://github.com/rust-lang/rust-bindgen/pull/906 1467[#900]: https://github.com/rust-lang/rust-bindgen/issues/900 1468[#878]: https://github.com/rust-lang/rust-bindgen/issues/878 1469[#880]: https://github.com/rust-lang/rust-bindgen/issues/880 1470[#927]: https://github.com/rust-lang/rust-bindgen/issues/927 1471 1472-------------------------------------------------------------------------------- 1473 1474# 0.29.0 1475 1476Released 2017/07/31 1477 1478## Added 1479 1480* ["Constified enum modules"](https://github.com/rust-lang/rust-bindgen/pull/741) 1481 translating C/C++ `enum`s into constants within a module for namespacing, 1482 rather than mangling the name of the generated constants. 1483 1484 For example, it turns this: 1485 1486 ```c++ 1487 // bindgen-flags: --constified-enum-module PetKind 1488 1489 enum PetKind { 1490 Doggo, 1491 Kitty, 1492 Hamster 1493 }; 1494 1495 struct Pet { 1496 PetKind kind; 1497 char* noise; 1498 }; 1499 ``` 1500 1501 Into this: 1502 1503 ```rust 1504 /* automatically generated by rust-bindgen */ 1505 1506 pub mod PetKind { 1507 pub type Type = ::std::os::raw::c_uint; 1508 pub const Doggo: Type = 0; 1509 pub const Kitty: Type = 1; 1510 pub const Hamster: Type = 2; 1511 } 1512 #[repr(C)] 1513 #[derive(Debug, Copy)] 1514 pub struct Pet { 1515 pub kind: PetKind::Type, 1516 pub noise: *mut ::std::os::raw::c_char, 1517 } 1518 ``` 1519 1520 The default translation strategy for `enum`s will generate constants with 1521 names like `PetKind_Hamster` instead. 1522 1523 Use `bindgen::Builder::constified_enum_module` or `--constified-enum-module`. 1524 1525* You can now 1526 [mark particular template instantiations as "opaque"](https://github.com/rust-lang/rust-bindgen/pull/773), 1527 so that `bindgen` emits a blob of bytes with the correct size and alignment 1528 rather than creating generic Rust types. This is useful as a workaround for 1529 when a template has a specialization for the given type arguments, which 1530 `bindgen` does not yet support. Previously, it was all of a templates' 1531 instantiations would be opaque or none of them would be. Use 1532 `bindgen::Builder::opaque_type("SomeTemplate<Foo, Bar>")` or `--opaque-type 1533 "SomeTemplate<Foo, Bar>"`. 1534 1535* Added the ability to 1536 [preprocess and dump](https://github.com/rust-lang/rust-bindgen/pull/812) 1537 the input headers given to `bindgen` to a file. This should make creating 1538 reproducible, system independent, standalone test cases much easier! Bring on 1539 the new issues! Use `bindgen::Builder::dump_preprocessed_input` or 1540 `--dump-preprocessed-input`. 1541 1542* We now use a fix-point analysis to determine whether any given type can derive 1543 `Debug`, or whether it has an explicit virtual table pointer. Previously we 1544 were using an ad-hoc algorithm that had at various times suffered from things 1545 like going into infinite loops when coming across cycles. Hopefully those 1546 kinds of bugs are a thing of the past! 1547 [#767](https://github.com/rust-lang/rust-bindgen/issues/767) 1548 [#765](https://github.com/rust-lang/rust-bindgen/issues/765) 1549 1550## Changed 1551 1552* The `bindgen` repository has moved under the `rust-lang-nursery` umbrella! The 1553 new repository URL is https://github.com/rust-lang-nursery/rust-bindgen 1554 1555## Fixed 1556 1557* No longer generating layout tests for template instantiations using type 1558 arguments that we didn't generate bindings for (which then caused compilation 1559 errors). [#679](https://github.com/rust-lang/rust-bindgen/issues/769) 1560 1561* Fixed function name mangling when cross compiling bindings for 1562 iOS. [#776](https://github.com/rust-lang/rust-bindgen/pull/776) 1563 1564* Don't include parent `inline namespace`s' names in types' names. Names of 1565 types from some STLs were showing up like `std___cxx11_basic_string` when they 1566 should have been 1567 `std_basic_string`. [#789](https://github.com/rust-lang/rust-bindgen/issues/789) 1568 1569* Fixed a bug where we wouldn't generate type definitions for some types 1570 referenced by an opaque type's methods, causing compilation 1571 errors. [#807](https://github.com/rust-lang/rust-bindgen/issues/807) 1572 1573* Fixed function name mangling issues for win32 1574 targets. [#819](https://github.com/rust-lang/rust-bindgen/issues/819) 1575 1576* Fixed a bug where `bindgen` was generating a generic type alias that didn't 1577 use its type parameter, which is illegal Rust code and caused compilation 1578 errors. [#820](https://github.com/rust-lang/rust-bindgen/issues/820) 1579 1580* The generated size, alignment, and field offset unit tests now have stable 1581 names rather than sometimes including an internal identifier which is 1582 inherently unstable. This was causing unnecessary diffs when folks were 1583 checking in new versions of bindings into their VCS. 1584 [#394](https://github.com/rust-lang/rust-bindgen/issues/394) 1585 1586* Fixed a bug where we would try and `derive(Debug, Default)` on structs that 1587 had padding like `[u8; 33]`, which is larger than the largest array length for 1588 which Rust will derive traits. This would cause compilation errors when 1589 compiling the emitted bindings. 1590 [#648](https://github.com/rust-lang/rust-bindgen/issues/648) 1591