Skip to content
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

Introduce --rust-edition #3002

Merged
merged 3 commits into from
Nov 30, 2024
Merged

Introduce --rust-edition #3002

merged 3 commits into from
Nov 30, 2024

Conversation

pvdrz
Copy link
Contributor

@pvdrz pvdrz commented Nov 29, 2024

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 and Builder::rust_edition method.
  • Update bindgen internals to filter features based on the set edition.
  • Gate the literal_cstr feature behind the 2021 edition.

cc @nyurik @emilio

@nyurik
Copy link
Contributor

nyurik commented Nov 29, 2024

@pvdrz this is a dup of #3000 ?

@pvdrz pvdrz force-pushed the pvdrz/rust-editions branch 3 times, most recently from b1e35b1 to 6717966 Compare November 29, 2024 22:21
@pvdrz
Copy link
Contributor Author

pvdrz commented Nov 29, 2024

@pvdrz this is a dup of #3000 ?

yes 😱 but I cherry-picked your changes that were not included on mine and tagged you as Co-Author 😅. Hopefully I'll coordinate this better next time

@pvdrz pvdrz requested a review from emilio November 29, 2024 22:22
bindgen-cli/main.rs Outdated Show resolved Hide resolved
bindgen/features.rs Outdated Show resolved Hide resolved
@pvdrz
Copy link
Contributor Author

pvdrz commented Nov 30, 2024

Blocked by #3006

@pvdrz pvdrz force-pushed the pvdrz/rust-editions branch 2 times, most recently from 94472e3 to fd6ba69 Compare November 30, 2024 03:28
@pvdrz pvdrz marked this pull request as draft November 30, 2024 03:35
@pvdrz pvdrz marked this pull request as ready for review November 30, 2024 15:21
@pvdrz pvdrz added this pull request to the merge queue Nov 30, 2024
@pvdrz pvdrz linked an issue Nov 30, 2024 that may be closed by this pull request
Merged via the queue into main with commit c4440b3 Nov 30, 2024
28 checks passed
@pvdrz pvdrz deleted the pvdrz/rust-editions branch November 30, 2024 15:39
@nyurik
Copy link
Contributor

nyurik commented Nov 30, 2024

thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Supporting 2021-edition features
3 participants