IlanCosman / tide

🌊 The ultimate Fish prompt.
MIT License
2.73k stars 102 forks source link

rustup causes `rustc` invocation to automatically download toolchain #444

Open arpandaze opened 9 months ago

arpandaze commented 9 months ago

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

IlanCosman commented 9 months ago

image

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

arpandaze commented 9 months ago

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 commented 9 months ago

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 commented 9 months ago

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: https://github.com/rust-lang/rustup/issues/1397

TonalidadeHidrica commented 1 month ago

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