-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Environment variable for the Rust version #4408
Comments
Thanks for the report! I'm not sure we're quite ready to do this in the sense that it would entail parsing the output of |
For my purpose it will be OK to have a version in any format: I'm trying to form some "user agent" string in our application that should include the Rust version. But I understand that such solution may not be appropriate for the Cargo. I can still get the Rust version inside |
Nah I think eventually we may wish to expose this, but I'd prefer to ensure there's a stable method for Cargo to learn the compiler's version info (e.g. a structured format) before we expose it. |
RFC rust-lang/rfcs#2523 might be of interest, as it proposes |
See also the version_check crate. See the nom crate's build.rs for good example of using it. |
Looking back at this, this request is for the string being available for process and is independent of then using that in If we did this, I'd either want rust-lang/rfcs#2523 stabilized first and/or to disallow this env varaible in build scripts so it doesn't become an alternative mechanism to rust-lang/rfcs#2523 |
Cargo sets some environment variables, for example,
CARGO_PKG_VERSION
. I suppose it will be handy to have environment variable with the Rust version.I would like to try to add it if it is appropriate.
See also #2903
The text was updated successfully, but these errors were encountered: