1
votes

I'm getting started with Rust and Rocket.

I'm following the instructions with the Rocket Getting Started and I'm getting "error: Could not compile state." The full log is here:`

~/.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

I run it again and I got

error: Could not compile pear_codegen.

How do I resolve this. Please help! Thanks!

1
Possible duplicate of Matching on a BoxStefan
"Before you can start writing a Rocket application, you’ll need a nightly version of Rust installed."Stefan
As Stefan says, the output is pretty straightforward: error[E0554]: #![feature] may not be used on the stable release channelBoiethios

1 Answers

5
votes

The 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 they link in the tutorial:

  1. install rustup
  2. do rustup default nightly

This is all in the docs, so it should be obvious. But from my own experience I often miss those obvious things because starting with a new language is hard and you have jumped over many hurdles already and these might just have been the one hurdle which made you stumble.