-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Closed
Labels
C-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.
Description
rustc --version should, in my humble opinion, not perform any unexpected behavior like initiating toolchain updates.
As a user I expect just the current active version of rustc to be returned and nothing else to happen.
Instead running rustc --version within a newly cloned rust-project triggers installation of a toolchain.
I ran into this issue within an application like oh-my-posh which uses rustc --version to display rustc's version number in the command prompt.
The issue can easily be replicated by cloning a project that require a toolchain update and then running rustc --version:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source .bashrc
rustc --version
git clone https://github.com/zed-industries/zed.git
cd zed
rustc --versionoutput:
user@machine:~$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer
Welcome to Rust!
This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.
Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:
/home/ray/.rustup
This can be modified with the RUSTUP_HOME environment variable.
The Cargo home directory is located at:
/home/ray/.cargo
This can be modified with the CARGO_HOME environment variable.
The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:
/home/ray/.cargo/bin
This path will then be added to your PATH environment variable by
modifying the profile files located at:
/home/ray/.profile
/home/ray/.bashrc
You can uninstall at any time with rustup self uninstall and
these changes will be reverted.
Current installation options:
default host triple: x86_64-unknown-linux-gnu
default toolchain: stable (default)
profile: default
modify PATH variable: yes
1) Proceed with standard installation (default - just press enter)
2) Customize installation
3) Cancel installation
>1
info: profile set to 'default'
info: default host triple is x86_64-unknown-linux-gnu
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2024-06-13, rust version 1.79.0 (129f3b996 2024-06-10)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
63.8 MiB / 63.8 MiB (100 %) 63.1 MiB/s in 1s ETA: 0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
15.3 MiB / 15.3 MiB (100 %) 8.0 MiB/s in 1s ETA: 0s
info: installing component 'rust-std'
24.4 MiB / 24.4 MiB (100 %) 15.5 MiB/s in 1s ETA: 0s
info: installing component 'rustc'
63.8 MiB / 63.8 MiB (100 %) 17.5 MiB/s in 3s ETA: 0s
info: installing component 'rustfmt'
info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'
stable-x86_64-unknown-linux-gnu installed - rustc 1.79.0 (129f3b996 2024-06-10)
Rust is installed now. Great!
To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).
To configure your current shell, you need to source
the corresponding env file under $HOME/.cargo.
This is usually done by running one of the following (note the leading DOT):
. "$HOME/.cargo/env" # For sh/bash/zsh/ash/dash/pdksh
source "$HOME/.cargo/env.fish" # For fish
user@machine:~$ source .bashrc
user@machine:~$ rustc --version
rustc 1.79.0 (129f3b996 2024-06-10)
user@machine:~$ git clone https://github.com/zed-industries/zed.git
Cloning into 'zed'...
remote: Enumerating objects: 247512, done.
remote: Counting objects: 100% (19933/19933), done.
remote: Compressing objects: 100% (617/617), done.
remote: Total 247512 (delta 19597), reused 19443 (delta 19316), pack-reused 227579
Receiving objects: 100% (247512/247512), 101.19 MiB | 25.22 MiB/s, done.
Resolving deltas: 100% (181420/181420), done.
user@machine:~$ rustc --version
rustc 1.79.0 (129f3b996 2024-06-10)
user@machine:~$ cd zed
user@machine:~/zed$ rustc --version
info: syncing channel updates for '1.79-x86_64-unknown-linux-gnu'
info: latest update on 2024-06-13, rust version 1.79.0 (129f3b996 2024-06-10)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-std' for 'aarch64-apple-darwin'
info: downloading component 'rust-std' for 'wasm32-wasi'
info: downloading component 'rust-std' for 'x86_64-apple-darwin'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-std' for 'aarch64-apple-darwin'
info: installing component 'rust-std' for 'wasm32-wasi'
info: installing component 'rust-std' for 'x86_64-apple-darwin'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
rustc 1.79.0 (129f3b996 2024-06-10)
user@machine:~/zed$
Meta
rustc --version --verbose:
rustc 1.79.0 (129f3b996 2024-06-10)
binary: rustc
commit-hash: 129f3b9964af4d4a709d1383930ade12dfe7c081
commit-date: 2024-06-10
host: x86_64-unknown-linux-gnu
release: 1.79.0
LLVM version: 18.1.7
Metadata
Metadata
Assignees
Labels
C-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.