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

rustup causes rustc invocation to automatically download toolchain #444

Open
arpandaze opened this issue Sep 25, 2023 · 5 comments
Open
Labels
🐛 bug Something isn't working

Comments

@arpandaze
Copy link

Describe the bug

If a rust folder contains rust-toolchain.toml requiring version that isn't installed, rustc --version automatically tries to install the toolchain. So if we quickly open nvim or any other cli program after switching to the folder, contents from stderr is displayed.

Steps to reproduce

  1. Create empty rust project with cargo init
  2. Create rust-toolchain.toml file with content as follows:
    [toolchain]
    # set channel to one that is not installed
    channel = "1.72"
  3. Switch to the directory and open any CLI program like nvim or top.

Screenshots

image

@arpandaze arpandaze added the 🐛 bug Something isn't working label Sep 25, 2023
@IlanCosman
Copy link
Owner

image

Can't reproduce. I have rustc installed through pacman as opposed to rustup or whatever, not sure if that makes the difference.

@arpandaze
Copy link
Author

I have installed rustup thorough pacman and it installs the rust toolchain. Rustup allows multiple versions of rust to be installed and it checks the rust-toolchain.toml for the required version for project. That's also probably why rustc --version is showing latest version and not installing the defined version in your case.

@IlanCosman
Copy link
Owner

Yah ok, doing things through rustup causes this behavior. I have to say I think this is terrible behavior on the part of rustup. If you try to get tab completion on rustc when you don't have the proper version installed, fish will lock up while it is silently downloading the correct version in the background.

I really don't want to have Tide causing a 30s download in the background. Is there any way to like, politely ask rustc/rustup if calling rustc will give you rustc, or if it will download something?

@arpandaze
Copy link
Author

I was also trying to find if there is some way to only ask for version and not download but didn't find one. Seems like this issue has been open since long time:
rust-lang/rustup#1397

@IlanCosman IlanCosman changed the title Stderr not redirected in rustc version display function rustup causes rustc invocation to automatically download toolchain Sep 30, 2023
@TonalidadeHidrica
Copy link

TonalidadeHidrica commented May 11, 2024

The issue has been resolved by rust-lang/rustup#3225 , and it will be released as 1.28.0. Once released, we can simply use rustup show active-toolchain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants