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)
Run Code Online (Sandbox Code Playgroud)
我安装了以下工具链
stable-x86_64-unknown-linux-gnu (default)
nightly-2019-09-05-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu
master
Run Code Online (Sandbox Code Playgroud)
我试图解决 rust-clippy 的问题,所以我不得不安装主工具链。尽管将稳定设置为我的默认工具链,但我当前的工具链是主工具链,我想切换回稳定。如何在不卸载主工具链的情况下执行此操作?
没有 switch 子命令吗?
我用brew命令安装了rustup,但仍然说找不到rustup命令。我不确定我是否缺少任何安装步骤。任何帮助,将不胜感激。
我跑来rustup update更新我的工具链并看到两个警告:
warning: tool `rustfmt` is already installed, remove it from `/Users/<username>/.cargo/bin`, then run `rustup update` to have rustup manage this tool.
warning: tool `cargo-fmt` is already installed, remove it from `/Users/<username>/.cargo/bin`, then run `rustup update` to have rustup manage this tool.
Run Code Online (Sandbox Code Playgroud)
我按照警告信息中的说明操作,然后rustfmt再次尝试运行.我收到了错误
error: toolchain 'stable-x86_64-apple-darwin' does not have the binary rustfmt`
Run Code Online (Sandbox Code Playgroud)
出了什么问题,我该如何解决?
我正在编写 rust 宏,但遇到了有关我无法理解的宏的错误。为了更好地理解它,我尝试通过设置-Z macro-backtrace不稳定选项并再次编译来遵循编译器的建议。这是说的建议:
note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
Run Code Online (Sandbox Code Playgroud)
但是这样做:
cargo run -Z macro-backtrace
Run Code Online (Sandbox Code Playgroud)
结果如下:
error: unknown `-Z` flag specified: macro-backtrace
Run Code Online (Sandbox Code Playgroud)
我已经通过rustup override nightly在项目目录中运行并rustup default nightly为将来使用此功能而完全切换到夜间工具链,但错误仍然存在。
在通过网络挖掘时,我找到了一种列出所有-Z选项的方法cargo -Z help:
Available unstable (nightly-only) flags:
-Z avoid-dev-deps -- Avoid installing dev-dependencies if possible
-Z minimal-versions -- Install minimal dependency versions instead of maximum
-Z no-index-update -- Do not update the …Run Code Online (Sandbox Code Playgroud) Rustup文档显示了如何每晚安装Rust,但不知道如何删除它.
虽然文档确实显示了如何rustup完全卸载,但我想保留稳定的分支.
我怎么能每晚卸载Rust?
请注意,我尝试与rustup install nightly...(rustup uninstall nightly,rustup remove nightly&rustup delete nightly)相反,但没有用.
即使我阅读文档,也不清楚nightly是a toolchain,a channel......还是别的什么.
我尝试使用推荐的安装脚本在 Raspberrypi 4 上安装 rust:
pi@raspberrypi:/tmp $ curl https://sh.rustup.rs -sSf | sh
Run Code Online (Sandbox Code Playgroud)
但重启后,cargo找不到:
pi@raspberrypi:~ $ cargo
error: command failed: 'cargo'
error: caused by: No such file or directory (os error 2)
Run Code Online (Sandbox Code Playgroud)
这可能与安装过程中报告的情况有关(error reading rustc version)(完整的安装日志位于底部):
info: default toolchain set to 'stable-aarch64-unknown-linux-gnu'
stable-aarch64-unknown-linux-gnu installed - (error reading rustc version)
Run Code Online (Sandbox Code Playgroud)
以下是完整的安装日志:
pi@raspberrypi:/tmp $ curl https://sh.rustup.rs -sSf | sh
info: downloading installer
Welcome to Rust!
This will download and install the official compiler for the Rust
programming language, and …Run Code Online (Sandbox Code Playgroud) 使用 创建新项目时cargo new,我希望 Cargo.toml 文件自动包含预定义authors字段。
Rust书中说:
接下来的四行设置 Cargo 编译程序所需的配置信息:名称、版本、编写者以及要使用的 Rust 版本。Cargo 从您的环境中获取您的姓名和电子邮件信息,因此如果该信息不正确,请立即修复信息,然后保存文件。
实在是太模糊了,所以我就去查了一下。首先,我尝试将CARGO_NAME和添加CARGO_EMAIL到我的环境变量中。没用。
然后我尝试在配置文件的字段中添加变量name和,并得知它已被弃用。email[cargo-new].cargo/config.toml
还有其他方法可以做到这一点吗?我做错什么了吗?
[package]
name = "hello_world"
version = "0.1.0"
edition = "2018"
authors = ["foo <bar@gmail.com>"] # Add this line automatically
[dependencies]
Run Code Online (Sandbox Code Playgroud)
我在 Arch Linux 上使用工具链rustup。nightly
我在我的Ubuntu 16.04机器上安装了Rust
curl https://sh.rustup.rs -sSf | sh
Run Code Online (Sandbox Code Playgroud)
可以在安装页面上看到.
我现在如何卸载Rust?
我正在尝试使用 clippy 安装 rustup,但我正在寻找为所有用户安装的方法。
我在 /opt/setup 中安装了 rustup。每当我切换用户时,我都会得到以下信息:
error: no default toolchain configured
Run Code Online (Sandbox Code Playgroud)
如果我尝试安装工具链,它不需要/opt/setup但是/home/user. 我在我的文件中指定了RUSTUP_HOMEand但它仍然选择. 有没有办法实现这一目标?CARGO_HOME.bashrc/home/user
我见过rustup被称为“工具链安装程序”,但很难找到 Rust 认为“工具链”是什么以及该概念的范围是什么的确切定义。
我已经安装了 Rust 编译器和 Cargo。还能rustup带来什么?它只是一个 Rust 版本切换器吗?
作为 .NET 开发人员,也许有一个相似之处可以让我更容易掌握这个概念?