-
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
Expose rustc version to build.rs #2903
Comments
I"m a little wary of piling too much information onto build script environment variables. Right now we added exposing |
Link to the crate for the lazy: https://crates.io/crates/rustc_version |
@alexcrichton that"s what I"m using currently to shell out to rustc. Just seems like not particularly the best idea to parse compiler output manually for something that I would assume is a common problem. Alternatively one could make the argument that rust itself should provide a macro maybe that exposes the version? |
Yeah I guess a macro would perhaps be better, one day Cargo may not always run |
#4408 tracks the more general idea of setting an env var for the rust version. |
I wonder if rust-lang/rfcs#2523 would be more appropriate. I feel like we should at least have a cohesive plan between cargo/lang on how we should be handled version detection. |
Considering rust-lang/rfcs#2523 is an approved RFC that is meant to target these kinds of use cases, I"m going to close in favor of that. If there is a reason we should reconsider this, let us know! Note that we still have #4408 for gathering the rustc version for reporting purposes (like a |
Currently the only way to find the rustc version is to invoke rustc. Which is for instance what the
rustc_version
crate does. It would be great ifRUSTC_VERSION
or something similar was set automatically so that build scripts could customize what happens based on the version of Rust it compiles with.See also #4408
The text was updated successfully, but these errors were encountered: