Rust/Rocket 无法编译 `state` 和 `pear_codegen`

Rust/Rocket can't compile `state` and `pear_codegen`

我开始使用 Rust 和 Rocket。

我正在按照 Rocket Getting Started 的说明进行操作,我得到了 "error: Could not compile state." 完整的日志在这里:`

~/.cargo/bin/cargo run Updating registry https://github.com/rust-lang/crates.io-index Downloading rocket_codegen v0.3.3 Downloading rocket v0.3.3
Compiling gcc v0.3.54 Compiling smallvec v0.4.4 Compiling libc v0.2.34 Compiling version_check v0.1.3 Compiling language-tags v0.2.2 Compiling serde v1.0.23 Compiling state v0.3.2 error[E0554]: #![feature] may not be used on the stable release channel --> /Users/ktenjin/.cargo/registry/src/github.com-1ecc6299db9ec823/state-0.3.2/src/lib.rs:1:1 | 1 | #![feature(const_fn)] | ^^^^^^^^^^^^^^^^^^^^^

error[E0554]: #![feature] may not be used on the stable release channel --> /Users/ktenjin/.cargo/registry/src/github.com-1ecc6299db9ec823/state-0.3.2/src/lib.rs:2:1 | 2 | #![feature(const_unsafe_cell_new)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: #![feature] may not be used on the stable release channel --> /Users/ktenjin/.cargo/registry/src/github.com-1ecc6299db9ec823/state-0.3.2/src/lib.rs:3:1 | 3 | #![feature(const_atomic_usize_new)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: #![feature] may not be used on the stable release channel --> /Users/ktenjin/.cargo/registry/src/github.com-1ecc6299db9ec823/state-0.3.2/src/lib.rs:4:1 | 4 | #![feature(const_atomic_bool_new)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 4 previous errors

error: Could not compile state. warning: build failed, waiting for other jobs to finish... error: build failed

我又运行了,我得到了

error: Could not compile pear_codegen.

我该如何解决这个问题。请帮忙!谢谢!

教程中的rocket tutorial states that you need rust nightly in order to compile it. In order to install nightly, you do as they say in this page他们link:

  1. install rustup
  2. rustup default nightly

这些都在文档中,所以应该很明显。但根据我自己的经验,我经常会错过那些显而易见的事情,因为从一门新语言开始很难,而且你已经跳过了很多障碍,而这些可能只是让你跌跌撞撞的一个障碍。