Rocket 每晚需要最低版本的 Rust,但已经安装了更高的稳定版本

Rocket requires a minimum version of Rust nightly, but a higher stable version is already installed

我正在尝试 运行 Rocket 但我在第一个障碍上就失败了。尝试 cargo run 时,出现以下错误:

error: failed to run custom build command for `pear_codegen v0.1.2`
Error: Pear requires a nightly or dev version of Rust.
Installed version is: 1.33.0 (2019-02-28). Minimum required: 1.31.0-nightly (2018-10-05).

我是 Rust 的新手,但来自其他语言,这毫无意义。它至少需要 1.31.0 版本,但我安装了 1.33.0 版本。

我做错了什么?

如果软件需要每晚构建 Rust,则没有稳定版本的 Rust 可以替代:您需要每晚使用。

Rust 的夜间频道是稳定版 Rust 的超集。尚未完成或尚未证明其价值的功能包含在 Rust 的夜间构建中。您通过 crate attribute.

选择使用给定的功能

这些不稳定的功能随时可能完全改变甚至被删除。换句话说,不稳定的特性 never 保证存在于任何特定的 Rust 稳定版本中。

如果有帮助,您可以将夜间版本视为 "alternate reality" 开发轨道。 nightly 的版本号只是它们存在时间的一个松散指示器;编译日期和 git 提交哈希提供了更多信息。

I would have thought the nightly code from 1.31.0 would be pushed into the stable 1.31.0+ versions once tested

这就是 beta 频道的工作方式 — 1.x.y-beta 中的任何内容都将处于 1.x.y-稳定(假设没有发生重大紧急情况)。

另请参阅:

  • What is the stabilization process?
  • What is a crate attribute and where do I add it?

你没有做错任何事,Rocket 只是需要 Nightly 构建,所以它可以访问 Rust 可能尚未稳定的新功能。

根据 the documentation:

,您可以选择只为您的 Rocket 项目使用每晚构建
rustup override set nightly

Getting started guide