-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
cargo rustc --version should print the version of rustc called by cargo #13611
Comments
|
@weihanglo it works, but it also builds the project in the current dir, and it only prints the version number if the build is successful. which is a problem, because the main reason you would want to run this is to debug issues that are causing your build to fail (in my case it was a strange problem, because just updating rustc wasn't enough, i had to also run |
From what I understand, this seems to be a problem, and the build should not be performed if it only outputs the version. |
from
it compiles the current package because that's what |
From reading the issue description, there seems to be two different output you want:
Before proposing a change to the entire Cargo team, I think we should flesh out the desired output that captures things people want. Also, However, before that, I'd like to have more background of situation you want to learn the rustc version. Also why |
just the output of
could be useful for some, but it wasn't what i had in mind, no.
only works inside of a cargo crate, also not at all obvious that would print the rust version and not just build logs. |
This somehow contradicts to what I understood. Not mean to turn this down, but Cargo is cautious of adding new flags, since once they've added they stay like forever. A specialized flag for only one purpose with no interaction with other parts is unlikely to be accepted by the team. If people want to move things forward, somebody needs to drive this with a proposal considering different parts in Cargo holistically, and with some practical use cases. See RFC 3180 for reference. Not every flag needs to go through the RFC process, but still needs a fair amount of use cases. See |
i see. i was under the impression that an isolated feature would be less likely to cause problems for other pieces of code later down the line, but i'm not the one designing toolchains. |
Problem
it is difficult to check if the version of rustc called by cargo and the version of rustc in the users environment are the same, either due to RUSTC or RUSTC_WRAPPER being set, or due to cargo being patched by a package manager such as nix.
Proposed Solution
when
cargo rustc --version
is run, cargo should invokerustc --version
following all the usual rules of how to find rustc, such as checking RUSTC and RUSTC_WRAPPERNotes
you an kind of get the desired effect with
RUSTFLAGS=--version
, but it's a bit of a hack.`cargo rustc -- --version also doesn't exist for some reason.
The text was updated successfully, but these errors were encountered: