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

rustc --version should not trigger/initiate toolchain updates #3943

Closed
Tracked by #3635
rami3l opened this issue Jul 12, 2024 · 3 comments · Fixed by #3985
Closed
Tracked by #3635

rustc --version should not trigger/initiate toolchain updates #3943

rami3l opened this issue Jul 12, 2024 · 3 comments · Fixed by #3985
Milestone

Comments

@rami3l
Copy link
Member

rami3l commented Jul 12, 2024

Transferred from rust-lang/rust#127649.

I expect rustc --version to just output version information, like how --version would behave in any other application.

In my humble opinion, rustc --version should not be responsible for upgrading toolchains. The user should do that either explicitly or maybe when running rustc with any other flags for which it makes more sense for silent updates to be performed.

The --version argument should really just be a 'request' for version information and not trigger any other actions.

To be clear... I think it's ok to trigger silent updates for different calls to rustc with different arguments, but I believe --version should really only output the version (and maybe a hint that the current version is a mismatch by what is specified in rust-toolchain.toml).

Performing silent updates, and maybe even more actions, may even pose security risks to users that do not expect these actions to happen silently when running a command like rustc --version.

Originally posted by @Doineann in #3635 (comment)

@rami3l rami3l changed the title rustc --version should not trigger/initiate toolchain updates rustc --version should not trigger/initiate toolchain updates Jul 15, 2024
@panekj
Copy link

panekj commented Aug 2, 2024

When invoked via rustup proxy, it should not fail, it should show the resolved active rustc version (without downloading the toolchain), whichever that may be at the moment considering all override methods. Given that rustup already knows which toolchain version to pull, it shouldn't be impossible to present that info.

@rami3l
Copy link
Member Author

rami3l commented Aug 2, 2024

When invoked via rustup proxy, it should not fail, it should show the resolved active rustc version (without downloading the toolchain), whichever that may be at the moment considering all override methods. Given that rustup already knows which toolchain version to pull, it shouldn't be impossible to present that info.

@panekj I don't believe it can in general, as we have to take into account custom toolchains that are not distributed by (but linked against) rustup, as well as "moving targets" such as stable and 1.79. This action should in no way access the internet.

@rami3l
Copy link
Member Author

rami3l commented Aug 3, 2024

A note for myself:

let cmd = cfg.local_toolchain(toolchain).await?.command(arg0)?;

... calls:

None => self.find_or_install_active_toolchain().await?.0,

So modulo the tests this should be a simple change.

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

Successfully merging a pull request may close this issue.

2 participants