8

I'm trying to run Rocket but I'm falling at the first hurdle. When trying to cargo run, I get the following error:

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).

I'm new to Rust, but coming from other languages this makes no sense whatsoever. It needs version 1.31.0 as a minimum but I have version 1.33.0 installed.

What am I doing wrong?

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
twigg
  • 3,753
  • 13
  • 54
  • 96
  • It claims to require a _nightly_ version of the compiler. Your `1.33.0` is just a stable version. `rustup toolchain add nightly` – E_net4 Mar 18 '19 at 22:20
  • 1
    @E_net4 Yeah I switched to nightly and it works. Just seems strange that stable 1.33.0 wouldn't work with a nighly 1.31.0, I would have thought the nightly code from 1.31.0 would be pushed into the stable 1.31.0+ versions once tested etc – twigg Mar 18 '19 at 22:37
  • 1
    > once tested etc Exactly - nightly features are available in stable compiler versions only after they went through the process of stabilization, which may take a lot of time, and certainly there is no explicitly defined release cadence for all of them. Some nightly features could be removed outright. – Vladimir Matveev Mar 18 '19 at 22:59
  • 1
    > Just seems strange that stable 1.33.0 wouldn't work with a nighly 1.31.0 < Not every nightly feature stabilizes each release--in fact, the overwhelming majority do not--they are developed and tested over a much longer cadence than the 6 week release cycle. And since stable releases explicitly disallow use of all nightly features (stable features only), this is why you still need nightly. – U007D Mar 19 '19 at 01:39
  • @U007D fair enough, that's just me not understanding its release cycle – twigg Mar 19 '19 at 13:53
  • Rust is now at 1.45.0 (2020-07-13) and `pear_codegen v0.1.4` is still asking for a version 1.31.0-nightly (2018-10-05). That is certainly odd. Will the features from 1.31.0-nightly ever be in the stable version? – Dirk Jäckel Sep 20 '20 at 09:39

2 Answers2

14

If software requires a nightly build of Rust, no stable version of Rust can be substituted: you are required to use nightly.

The nightly channel of Rust is a superset of stable Rust. Features that are not yet complete or simply haven't proven their value are included in nightly builds of Rust. You opt into using a given feature via a crate attribute.

These unstable features may completely change or even be removed at any time. Said another way, an unstable feature is never guaranteed to exist in any particular Rust stable version.

If it helps, you can think of nightly versions as an "alternate reality" track of development. The version number of nightly is only a loose indicator of where they exist in time; the compilation date and git commit hash are much more informative.

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

This is how the beta channel works — anything in 1.x.y-beta will be in 1.x.y-stable (assuming no major emergency occurs).

See also:

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
  • 2
    I am wondering if *nightly* should be renamed *experimental* to make things clearer. – Matthieu M. Mar 19 '19 at 08:16
  • @MatthieuM. in the [SemVer](https://semver.org/) sense, `x.y.z`, `x.y.z-beta` and `x.y.z-nightly` have no relation to each other. (*A pre-release version indicates that the version is unstable and might not satisfy the intended compatibility requirements as denoted by its associated normal version*). While it's possible that "experimental" would have been a better name to start with, I doubt that making any such change now would outweigh the costs of the change. ¯\_(ツ)_/¯ – Shepmaster Mar 19 '19 at 14:01
  • 2
    You lost an arm: \. I do agree that it's probably not worth changing. – Matthieu M. Mar 19 '19 at 14:14
5

You aren't doing anything wrong, Rocket just requires Nightly builds so it has access to newer features of Rust that might've not stabilized yet.

You can opt to only use a Nightly build for your Rocket project, per the documentation:

rustup override set nightly

Getting started guide

Alex W
  • 37,233
  • 13
  • 109
  • 109