-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Introduce CARGO_PKG_EDITION
env var
#14873
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
base: master
Are you sure you want to change the base?
Conversation
a759287
to
e7f96b4
Compare
As a heads up, our contribution process asks that issues be accepted before moving on to PRs. There are two directions to go and this direction has non-obvious problems to work through. We should work through this first before looking at the implementation. |
☔ The latest upstream changes (presumably 2560340) made this pull request unmergeable. Please resolve the merge conflicts. |
This comment has been minimized.
This comment has been minimized.
@@ -239,6 +239,7 @@ corresponding environment variable is set to the empty string, `""`. | |||
* `CARGO_PKG_REPOSITORY` --- The repository from the manifest of your package. | |||
* `CARGO_PKG_LICENSE` --- The license from the manifest of your package. | |||
* `CARGO_PKG_LICENSE_FILE` --- The license file from the manifest of your package. | |||
* `CARGO_PKG_EDITION` --- The Rust language edition from the manifest of your package. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also warn people about the deprecated behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but not certain about @epage's "deprecated behavior"
That this would be insufficient for projects using the deprecated cargo test editions.
Unsure how important that would be considering it is deprecated, its use was very low, etc.
e7f96b4
to
1548a7e
Compare
@epage i rebased this PR. WRT your MSRV comments --- what kind of message do you think would be needed, and which version? Thx! |
This comment has been minimized.
This comment has been minimized.
4774130
to
cb33b41
Compare
cb33b41
to
92acf73
Compare
#[doc = requires_msrv!("1.91")] | ||
#[track_caller] | ||
pub fn cargo_pkg_edition() -> Option<String> { | ||
to_opt(var_or_panic("CARGO_PKG_EDITION")).map(to_string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this using to_opt
? Won;t the edition always have a non-empty value, like cargo_pkg_name
?
// FIXME: enable once released? | ||
// dbg!(cargo_pkg_edition()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If only we had cfg_version
...
How do we plan to track addressing this?
Add
CARGO_PKG_EDITION
environment variable, allowing build scripts to determine the language edition of the crate being compiled.Fixes #14872
TBD - EnvVar Name
CARGO_PKG_EDITION
CARGO_PKG_RUST_EDITION
CARGO_PKG_LANG_EDITION
CARGO_PKG_LANGUAGE_EDITION