Build error after upgrading to latest versions of crates and nightly


I have just updated to the latest versions for the crates and nightly build, and I’m hit with this build error:

C:/Users/ikevin/.cargo/bin/cargo.exe check --all
warning: dependency (rocket_contrib) specified without providing a local path, Git repository, or version to use. This will be considered an error in future versions
   Compiling scopeguard v0.3.3
   Compiling rayon-core v1.3.0
   Compiling libc v0.2.34
   Compiling either v1.4.0
   Compiling winapi-build v0.1.1
   Compiling lazy_static v0.2.11
   Compiling gcc v0.3.54
   Compiling version_check v0.1.3
   Compiling matches v0.1.6
   Compiling winapi v0.2.8
   Compiling cfg-if v0.1.2
   Compiling unicode-normalization v0.1.5
   Compiling yansi v0.3.4
   Compiling void v1.0.2
   Compiling unicode-xid v0.1.0
   Compiling winapi v0.3.4
   Compiling lazy_static v1.0.0
   Compiling byteorder v1.2.1
   Compiling vcpkg v0.2.2
   Compiling unicode-xid v0.0.4
   Compiling untrusted v0.5.1
   Compiling percent-encoding v1.0.1
   Compiling yansi v0.4.0
   Compiling serde v0.8.23
   Compiling safemem v0.2.0
   Compiling serde v1.0.37
   Compiling quote v0.3.15
   Compiling language-tags v0.2.2
   Compiling regex-syntax v0.4.2
   Compiling rustc-demangle v0.1.7
   Compiling utf8-ranges v1.0.0
   Compiling traitobject v0.1.0
   Compiling num-traits v0.2.0
   Compiling typeable v0.1.2
   Compiling utf8-ranges v0.1.3
   Compiling itoa v0.4.1
   Compiling httparse v1.2.3
   Compiling dtoa v0.4.2
   Compiling regex-syntax v0.3.9
   Compiling pest v0.3.3
   Compiling state v0.4.0
   Compiling smallvec v0.4.4
   Compiling ordermap v0.2.13
   Compiling linked-hash-map v0.5.1
   Compiling quick-error v1.2.1
   Compiling num-traits v0.1.41
   Compiling pear v0.0.12
   Compiling bitflags v1.0.1
   Compiling glob v0.2.11
   Compiling rand v0.3.19
   Compiling num_cpus v1.8.0
   Compiling memchr v1.0.2
   Compiling coco v0.1.1
   Compiling kernel32-sys v0.2.2
   Compiling unicode-bidi v0.3.4
   Compiling log v0.4.1
   Compiling unicase v1.4.2
   Compiling pear_codegen v0.0.12
   Compiling unreachable v1.0.0
   Compiling memchr v2.0.1
   Compiling memchr v0.1.11
   Compiling proc-macro2 v0.3.5
   Compiling synom v0.11.3
   Compiling syntex_fmt_macros v0.5.0
   Compiling pq-sys v0.4.4
   Compiling rocket v0.3.7
   Compiling rocket_codegen v0.3.7
   Compiling base64 v0.6.0
   Compiling serde_test v0.8.23
   Compiling toml v0.4.5
   Compiling num-integer v0.1.36
   Compiling serde_json v1.0.13
   Compiling yaml-rust v0.4.0
   Compiling log v0.3.9
   Compiling idna v0.1.4
   Compiling thread_local v0.3.5
   Compiling aho-corasick v0.6.4
   Compiling aho-corasick v0.5.3
   Compiling nom v3.2.1
   Compiling syn v0.11.11
   Compiling quote v0.5.1
   Compiling linked-hash-map v0.3.0
   Compiling mime v0.2.6
   Compiling regex v0.2.5
   Compiling rayon v0.7.1
   Compiling url v1.6.0
error[E0004]: non-exhaustive patterns: `ForeignItem(_)`, `Stmt(_)` and `Expr(_)` not covered
  --> C:\Users\ikevin\.cargo\registry\src\\pear_codegen-0.0.12\src\
85 |     let item_span = match annotated {
   |                           ^^^^^^^^^ patterns `ForeignItem(_)`, `Stmt(_)` and `Expr(_)` not covered

error: aborting due to previous error

For more information about this error, try `rustc --explain E0004`.
error: Could not compile `pear_codegen`.
warning: build failed, waiting for other jobs to finish...
error: build failed

Process finished with exit code 101

My Cargo.toml is:

config = “0.8.0”
rocket = “0.3.7”
rocket_codegen = “0.3.7”
serde = “1.0.37”
serde_derive = “1.0.37”
diesel = { version = “1.1.2”, features = [“postgres”, “serde_json”] }
dotenv = “0.11.0”
serde_json = “1.0.13”
chrono = “0.4.1”

default-features = false
features = [“handlebars_templates”]

My toolchain version is 1.27.0.
nightly-x86_64-pc-windows-msvc unchanged - rustc 1.27.0-nightly (48fa6f963 2018-04-05)

Please help. Thanks!


It looks like this error is related to Rocket and pear_codegen. Any help would be appreciated.


Looks like pear_codegen is using unstable compiler internals. You’re almost certainly not using the “correct” version of the compiler. If the documentation doesn’t tell you what that version is, then, uh… you’ll have to try all of them?

Actually, looking at your nightly date, your compiler is probably too new. Try installing successively older versions.

This is why I stopped depending on crates that use compiler internals.


Where do I find the historical list of nightly versions?


I don’t think there is one. Some days have nightlies, some don’t. Some platforms have a nightly on a given day, and some don’t (AFAIK). Pick a date and work backwards or forwards until you find one.

Also, when replying to someone, make sure you reply specifically to their post, or they might not be notified.


I tried all the way back to 1.24.0-nightly and I got this error:

Error: Rocket codegen requires a more recent version of rustc.
Use `rustup update` or your preferred method to update Rust.
Installed version is: 1.24.0-nightly (2017-12-15). Minimum required: 1.27.0-nightly (2018-04-03).

I switched back to the latest and got the same error:

error[E0004]: non-exhaustive patterns: ForeignItem(_), Stmt(_) and Expr(_) not covered
–> C:\Users\ikevin.cargo\registry\src\\pear_codegen-0.0.12\src\
85 | let item_span = match annotated {
| ^^^^^^^^^ patterns ForeignItem(_), Stmt(_) and Expr(_) not covered

error: aborting due to previous error

For more information about this error, try rustc --explain E0004.
error: Could not compile pear_codegen.
warning: build failed, waiting for other jobs to finish…
error: build failed


But did you try the one it stated in the error message? 2018-04-03?

Note that the version number of a nightly is mostly irrelevant. What matters is the exact date.


I tried:

$ rustup default nightly-2017-12-17
info: using existing install for ‘nightly-2017-12-17-x86_64-pc-windows-msvc’
info: default toolchain set to ‘nightly-2017-12-17-x86_64-pc-windows-msvc’

nightly-2017-12-17-x86_64-pc-windows-msvc unchanged - rustc 1.24.0-nightly (3bee2b44c 2017-12-16)

$ rustc --version
rustc 1.24.0-nightly (3bee2b44c 2017-12-16)

I tried the exact date “2017-12-17” and it seems tobe installed, but the funny thing is it shows as “2017-12-16”, and it didn’t work. (I’m in Asia/Japan. Is my timezone causing a problem?)


I tried: “rustup default nightly-2017-12-18” – the date is 12-18 - and it shows:

nightly-2017-12-18-x86_64-pc-windows-msvc installed - rustc 1.24.0-nightly (dc39c3169 2017-12-17)

and it builds successfully.

I think my computer’s set timezone makes a difference.


In raw form, they are all here:

Only the latest nightly is in that base path – the rest can be found in the dated subdirectories.


I recall that it was fixed the other day in and

Did you try updating cargo with cargo update? As well, I learned from others to rustup toolchain install nightly-2018-04-03 and then cargo +nigthly-2018-04-03 run (there is a newer commit but not sure about that).