我开始使用 Rust 和 Rocket。
我正在按照火箭的说明进行操作 Getting Started我收到“错误:无法编译 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声明你需要每晚使用rust 才能编译它。为了每晚安装,您按照他们在 this page 中的说明进行操作他们在教程中链接:
- install rustup
rustup default nightly
这些都在文档中,所以应该很明显。但根据我自己的经验,我经常会错过那些显而易见的事情,因为从一门新语言开始很难,而且您已经跨越了许多障碍,而这些可能只是让您跌跌撞撞的一个障碍。
关于Rust/Rocket 无法编译 `state` 和 `pear_codegen`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47667735/