我在试着升级铁 rust .我try 卸载(1.60.0)并重新安装.新版本为1.73.0.但当我运行rustc时,它会自动下载1.60.0并恢复到1.60.0.想知道我如何才能强制它使用新版本?

info: profile set to 'default'
info: default host triple is aarch64-apple-darwin
info: syncing channel updates for 'stable-aarch64-apple-darwin'
info: latest update on 2023-10-05, rust version 1.73.0 (cc66ad468 2023-10-03)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
 54.4 MiB /  54.4 MiB (100 %)  27.7 MiB/s in  2s ETA:  0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 13.8 MiB /  13.8 MiB (100 %)   5.5 MiB/s in  1s ETA:  0s
info: installing component 'rust-std'
 24.5 MiB /  24.5 MiB (100 %)  21.1 MiB/s in  1s ETA:  0s
info: installing component 'rustc'
 54.4 MiB /  54.4 MiB (100 %)  23.3 MiB/s in  2s ETA:  0s
info: installing component 'rustfmt'
info: default toolchain set to 'stable-aarch64-apple-darwin'

  stable-aarch64-apple-darwin installed - rustc 1.73.0 (cc66ad468 2023-10-03)


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, run:
source "$HOME/.cargo/env"

(base) % rustc -V
info: syncing channel updates for '1.60.0-aarch64-apple-darwin'
info: latest update on 2022-04-07, rust version 1.60.0 (7737e0b5c 2022-04-04)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
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-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
rustc 1.60.0 (7737e0b5c 2022-04-04)

推荐答案

有几种方法可以强制Ruust使用特定的编译器版本(overrides)

1. The 100 environment variable

2. A 100

可以为目录分配它们自己的 rust 蚀工具链,并使用 rust 蚀覆盖.如果某个目录有覆盖,则每当Rustc或Cargo在该目录或其子目录之一内运行时,都会调用覆盖工具链.

每个目录的覆盖存储在rustup主目录的配置文件中.

要查看激活的工具链,请使用rustup showrustup override unset将其移除.

3. The 100

(rust-toolchain.tomlrust-toolchain)可以设置特定的 rust 蚀版本.

例如

[toolchain]
channel = "nightly-2020-07-10"
...

4. The default version can be set directly.

使用rustup default可查看默认的全局工具链.

Rust相关问答推荐

如何使用Match比较 struct 中的值

返回的future 不是`发送`

为潜在的下游实现使用泛型绑定而不是没有泛型绑定的trait

在执行其他工作的同时,从共享裁判后面的VEC中删除重复项

使用铁 rust S还原对多个数组执行顺序kronecker积

如何计算迭代器适配器链中过滤的元素的数量

如何修复数组中NewType导致的运行时开销

如何初始化选项<;T>;数组Rust 了?

为什么将易错函数的泛型结果作为泛型参数传递 infer ()?不应该是暧昧的吗?

从管道读取后重置标准输入

为什么实现特征的对象期望比具体对象有更长的生命周期?

如何将一个矩阵的列分配给另一个矩阵,纳尔代数?

为什么 Rust 需要可变引用的显式生命周期而不是常规引用?

如何从 rust 中的同一父目录导入文件

Rust:`sort_by` 多个条件,冗长的模式匹配

为什么 &i32 可以与 Rust 中的 &&i32 进行比较?

如何在 Rust Polars 中可靠地连接 LazyFrames

没有通用参数的通用返回

如何重写这个通用参数?

为什么 Bevy 的 Trait 边界不满足 Rapier 物理插件?