Introduce CARGO_PKG_EDITION env var#14873
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.
| * `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.
Should this also warn people about the deprecated behavior?
There was a problem hiding this comment.
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.
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.
If only we had cfg_version...
How do we plan to track addressing this?
|
☔ The latest upstream changes (possibly bbac0ca) made this pull request unmergeable. Please resolve the merge conflicts. |
Add
CARGO_PKG_EDITIONenvironment variable, allowing build scripts to determine the language edition of the crate being compiled.Fixes #6408
TBD - EnvVar Name
CARGO_PKG_EDITIONCARGO_PKG_RUST_EDITIONCARGO_PKG_LANG_EDITIONCARGO_PKG_LANGUAGE_EDITION