Quick addition to --version to mention rustc#2465
Conversation
As discussed in rust-lang#2447, rustup versions are getting closer to rustc versions (because the rustup maintainers are working too much I'm sure). This leads to confusion when running `rustup --version` while intending to run `rustc --version`. The change introduced here will print two additional (stderr) lines after rustup's default `--version` output. The first mentions this issue, and the second will print the output of `rustc --version` as a hint (by trivially calling out to `rustc`, whatever binary that may be).
There was a problem hiding this comment.
r? @kinnison
For your entertainment I want to also quote this snippet from my testing:
$ env RUSTUP_FORCE_ARG0=rustup $CARGO_TARGET_DIR/debug/rustup-init --version
Compiling rustup v1.22.1 (/home/pascal/code/rust-lang/rustup)
Finished dev [unoptimized + debuginfo] target(s) in 9.35s
rustup 1.22.1+103 (000079b11 2020-08-19) dirty 3 modifications
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustup 1.22.1 (1980-01-01)`(Renaming the binary to rustup instead of setting the env var fixes this of course.)
That suggests to me that you're invoking the proxy rather than grabbing the current active toolchain and invoking rustc via it, which won't have this defect at all, and will be measurably faster on windows, where process creation isn't as cheap as it is on Unix systems. |
|
Functionalitywise this looks fine, it'll be worth ensuring in a test that this works though. Probably just a cli-misc test. |
|
Test added. Don't know how granular you test these kinds of things, so I hope the one simple test case is fine. I can always add more tests for edge cases if you want :) |
kinnison
left a comment
There was a problem hiding this comment.
I think this is good enough for now. If we get unusual bug reports for --version we'll revisit more testing.
As discussed in #2447, rustup versions are getting closer to rustc
versions (because the rustup maintainers are working too much I'm sure).
This leads to confusion when running
rustup --versionwhile intendingto run
rustc --version.The change introduced here will print two additional (stderr) lines
after rustup's default
--versionoutput. The first mentions thisissue, and the second will print the output of
rustc --versionas ahint (by trivially calling out to
rustc, whatever binary that may be).