Introduce --rust-edition
by pvdrz · Pull Request #3002 · rust-lang/rust-bindgen (original) (raw)
This PR introduces the concept of Rust editions to bindgen so it can generate appropriate code based on the desired edition.
The motivation behind this PR comes from #2996 which allows bindgen to generate code with C-String literals, a feature that has been available since rust 1.77 but are gated behind the 2021 edition.
The changes in this PR are:
- Introduce the
--rust-edition
CLI argument andBuilder::rust_edition
method. - Update bindgen internals to filter features based on the set edition.
- Gate the
literal_cstr
feature behind the 2021 edition.