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

Export CARGO_PKG_EDITION variable to build environment #14872

Closed
nyurik opened this issue Nov 29, 2024 · 1 comment · May be fixed by #14873
Closed

Export CARGO_PKG_EDITION variable to build environment #14872

nyurik opened this issue Nov 29, 2024 · 1 comment · May be fixed by #14873
Labels
A-editions Area: edition-specific issues C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage.

Comments

@nyurik
Copy link
Contributor

nyurik commented Nov 29, 2024

Problem

Some tools like bindgen may need to know the Rust language edition of the root crate, especially when executing as part of build.rs. For example, bindgen needs to know if the -sys package uses edition 2021 (so it can use C-string literals), or older (in which case it must generate some unsafe code with the same literals). Requiring the user to always pass in bindgen args that match their environment is less than ideal if the default could be computed on the fly using environment variables.

See rust-lang/rust-bindgen#3000

Proposed Solution

Publish CARGO_PKG_EDITION or CARGO_PKG_RUST_EDITION or CARGO_PKG_LANG_EDITION or ... (naming tbd)

Notes

No response

@nyurik nyurik added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels Nov 29, 2024
nyurik added a commit to nyurik/cargo that referenced this issue Nov 29, 2024
nyurik added a commit to nyurik/cargo that referenced this issue Nov 29, 2024
nyurik added a commit to nyurik/cargo that referenced this issue Nov 29, 2024
nyurik added a commit to nyurik/cargo that referenced this issue Nov 29, 2024
@weihanglo
Copy link
Member

Probably a dup of #6408?

@weihanglo weihanglo added the A-editions Area: edition-specific issues label Nov 29, 2024
@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-editions Area: edition-specific issues C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants