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

Add rust language editions support #3000

Closed
wants to merge 2 commits into from
Closed

Conversation

nyurik
Copy link
Contributor

@nyurik nyurik commented Nov 29, 2024

Introduce a new --rust-edition parameter with allowed values 2015, 2018, 2021, and 2024. This allows different code generation depending on the language target.

In this PR, the C-string literals are now generated differently depending on the language edition (literals like c"example" are not available before 2021)

The default language edition uses logic:

  • if --rust-target is before 1.31.0, use 2015
  • if --rust-target version is before 1.56.0, use 2018
  • use 2018 as default otherwise

In the future, it would be good to add these, if possible:

  • if compiled as a cli utility, use 2018 to reduce compatibility issues (?)
  • if used as a lib from build.rs, detect current edition (is this possible?), and use the one of the build.rs

@nyurik nyurik force-pushed the editions branch 6 times, most recently from a750f6c to 1032dfa Compare November 29, 2024 18:33
Introduce a new `--rust-edition` parameter with allowed values 2015, 2018, 2021, and 2024.

This allows different code generation depending on the language target.  In this PR, the C-string literals are now generated differently depending on the language edition (literals like `c"example"` are not available before 2021)
@nyurik nyurik force-pushed the editions branch 3 times, most recently from b98eb08 to b4d00c4 Compare November 29, 2024 19:57
@pvdrz
Copy link
Contributor

pvdrz commented Nov 30, 2024

closed in favor of #3002 (sorry again 😱)

@pvdrz pvdrz closed this Nov 30, 2024
@nyurik nyurik deleted the editions branch November 30, 2024 18:19
@nyurik
Copy link
Contributor Author

nyurik commented Nov 30, 2024

no worries, thx for getting it done so fast!

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.

2 participants