Skip to content
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

Quick addition to --version to mention rustc #2465

Merged
merged 4 commits into from Aug 27, 2020

Conversation

killercup
Copy link
Member

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 --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).

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).
Copy link
Member Author

@killercup killercup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.)

src/cli/rustup_mode.rs Show resolved Hide resolved
src/cli/rustup_mode.rs Show resolved Hide resolved
@rbtcollins
Copy link
Contributor

(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.

src/cli/rustup_mode.rs Outdated Show resolved Hide resolved
@kinnison
Copy link
Contributor

Functionalitywise this looks fine, it'll be worth ensuring in a test that this works though. Probably just a cli-misc test.

@killercup
Copy link
Member Author

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 :)

Copy link
Contributor

@kinnison kinnison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good enough for now. If we get unusual bug reports for --version we'll revisit more testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants