我是 Rust 新手,第一次遇到 rustup 问题。 关键是它不允许我使用该语言的不稳定功能,尽管我明确使用
nightly
修饰符 rustup run nightly cargo build -Z build-std=core --target <Target>
运行它
我已经尝试过了
rustup override set nightly
和
rustup default nightly
它更改了 ~/.rustup/settings.toml 中的配置,但当我尝试使用 [unstable] 或 -Z 时,我仍然会收到此错误:
error: the
-Zflag is only accepted on the nightly channel of Cargo, but this is the
稳定 channel
或者不同的错误(在 .cargo/config 中出现[不稳定]的情况下),这表明使用的是稳定通道而不是夜间通道
非常感谢任何帮助和建议!
非常感谢所有试图帮助我解决这个问题的人。 我在 .bashrc 中覆盖了一个 $PATH,以公开 rust 稳定版本,以便 VSCode 在 rust-analyzer 插件中使用它,因此每次对 Cargo 或 rustc 的调用都会代理到稳定版本,这些版本在 $PATH 中公开,删除后 rustup 可以工作正如预期的那样。但我仍然必须设法让我的 VSCode rust-analyzer 插件再次工作,而无需在 $PATH 变量中显式暴露 Rust)