Search code examples
rustrust-cargowasm-pack

Why does an error appear on compiling time v0.3.34 when installing wasm-pack?


Running

cargo install wasm-pack

I get many green lines of "Compiling" and then the following

   Compiling time v0.3.34
error[E0602]: unknown lint: `invalid_reference_casting`
  |
  = note: requested on the command line with `-D invalid_reference_casting`

error[E0602]: unknown lint: `invalid_nan_comparisons`
  |
  = note: requested on the command line with `-D invalid_nan_comparisons`

error[E0602]: unknown lint: `invalid_from_utf8`
  |
  = note: requested on the command line with `-D invalid_from_utf8`

error[E0602]: unknown lint: `hidden_glob_reexports`
  |
  = note: requested on the command line with `-D hidden_glob_reexports`

   Compiling object v0.32.2
   Compiling pbkdf2 v0.11.0
For more information about this error, try `rustc --explain E0602`.
error: could not compile `time` (lib) due to 4 previous errors
warning: build failed, waiting for other jobs to finish...

What's happening and how do I fix it?

I'm trying out Rust so I don't know what to do with this. I'm on Ubuntu and my cargo --version is cargo 1.75.0


Solution

  • Those lints are newly-introduced:

    • invalid_reference_casting: 1.72 or later
    • invalid_nan_comparisons: 1.72 or later
    • invalid_from_utf8: 1.72 or later

    Some of crates have "MSRV", which defines most lowest version that the crate maintainer make effort to be compiled. time's "MSRV" is latest stable and two prior version from it, so its MSRV is 1.74 as of writing (current latest stable release is 1.76.0).

    I assume your toolchain is outdated.Try rustup toolchain list and update them by rustup update.