如何在 Rust 工具链之间切换? [英] How to switch between Rust toolchains?

查看:58
本文介绍了如何在 Rust 工具链之间切换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

rustup help toolchain 列出以下子命令

SUBCOMMANDS:
    list         List installed toolchains
    install      Install or update a given toolchain
    uninstall    Uninstall a toolchain
    link         Create a custom toolchain by symlinking to a directory
    help         Prints this message or the help of the given subcommand(s)

我安装了以下工具链

stable-x86_64-unknown-linux-gnu (default)
nightly-2019-09-05-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu
master

我试图解决 rust-clippy 的问题,所以我不得不安装主工具链.尽管将稳定设置为我的默认工具链,但我当前的工具链是主工具链,我想切换回稳定.如何在不卸载主工具链的情况下执行此操作?

I was trying to solve an issue for rust-clippy so I had to install the master toolchain. Even though stable is set as my default toolchain, my current toolchain is master and I would like to switch back to stable. How do I do it without uninstalling the master toolchain?

有没有switch子命令?

Is there no switch subcommand?

推荐答案

使用 rustup default 更改默认工具链.您可以使用全名(例如 rustup default stable-x86_64-unknown-linux-gnu)或短别名(例如 rustup default stable).

Use rustup default <toolchain> to change the default toolchain. You can use the full name (e.g. rustup default stable-x86_64-unknown-linux-gnu) or a short alias (e.g. rustup default stable).

rustup 也有方法以更广泛的方式覆盖默认值.请参阅 rustup 书中的 Overrides.

rustup also has methods to override the default in a more scoped manner. See Overrides in the rustup book.

这篇关于如何在 Rust 工具链之间切换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆