racer-rust/racer

cargo +nightly install racer returns error

hasan-hasanov opened this issue · 2 comments

Lately I have been reading a lot about Rust language and today finally I've decided to give it a try.
Unfortunately when I run:

cargo +nightly install racer

I get the following error:

cargo +nightly install racer
    Updating crates.io index
  Installing racer v2.1.31
   Compiling autocfg v1.0.0
   Compiling cfg-if v0.1.10
   Compiling winapi v0.3.8
   Compiling unicode-xid v0.2.0
   Compiling proc-macro2 v1.0.9
   Compiling lazy_static v1.4.0
   Compiling maybe-uninit v2.0.0
   Compiling semver-parser v0.7.0
   Compiling syn v1.0.17
   Compiling scopeguard v1.1.0
   Compiling libc v0.2.68
   Compiling log v0.4.8
   Compiling either v1.5.3
   Compiling rustc-rayon-core v0.3.0
   Compiling byteorder v1.3.4
   Compiling bitflags v1.2.1
   Compiling smallvec v1.2.0
   Compiling rustc-hash v1.1.0
   Compiling rustc-ap-graphviz v642.0.0
   Compiling jobserver v0.1.21
   Compiling unicode-width v0.1.7
   Compiling stable_deref_trait v1.1.1
   Compiling scoped-tls v1.0.0
   Compiling rustc-ap-syntax v642.0.0
   Compiling serde v1.0.105
   Compiling memchr v2.3.3
   Compiling rustc-ap-rustc_target v642.0.0
   Compiling ryu v1.0.3
   Compiling annotate-snippets v0.6.1
   Compiling rustc-ap-rustc_fs_util v642.0.0
   Compiling regex-syntax v0.6.17
   Compiling quick-error v1.2.3
   Compiling itoa v0.4.5
   Compiling strsim v0.8.0
   Compiling vec_map v0.8.1
   Compiling humantime v2.0.0
   Compiling lazycell v1.2.1
   Compiling crossbeam-utils v0.6.6
   Compiling thread_local v1.0.1
   Compiling lock_api v0.3.3
   Compiling rustc-ap-rustc_lexer v642.0.0
   Compiling semver v0.9.0
   Compiling itertools v0.8.2
   Compiling unicode-normalization v0.1.12
   Compiling textwrap v0.11.0
   Compiling humantime v1.3.0
   Compiling crossbeam-queue v0.1.2
   Compiling crossbeam-utils v0.7.2
   Compiling memoffset v0.5.4
   Compiling crossbeam-epoch v0.8.2
   Compiling indexmap v1.3.2
   Compiling rustc_version v0.2.3
   Compiling smallvec v0.6.13
   Compiling ena v0.13.1
   Compiling num_cpus v1.12.0
   Compiling aho-corasick v0.7.10
   Compiling quote v1.0.3
   Compiling parking_lot_core v0.6.2
   Compiling parking_lot v0.9.0
   Compiling rustc-ap-serialize v642.0.0
   Compiling crossbeam-deque v0.7.3
   Compiling regex v1.3.6
   Compiling rustc-ap-rustc_index v642.0.0
   Compiling rustc-rayon v0.3.0
   Compiling memmap v0.7.0
   Compiling winapi-util v0.1.3
   Compiling atty v0.2.14
   Compiling termize v0.1.1
   Compiling termcolor v1.1.0
   Compiling clap v2.33.0
   Compiling measureme v0.7.1
   Compiling env_logger v0.7.1
   Compiling rustc-ap-rustc_data_structures v642.0.0
   Compiling synstructure v0.12.3
error[E0605]: non-primitive cast: `std::num::NonZeroU64` as `u32`
   --> C:\Users\Hasan\.cargo\registry\src\github.com-1ecc6299db9ec823\rustc-ap-rustc_data_structures-642.0.0\profiling.r
s:312:29
    |
312 |             let thread_id = std::thread::current().id().as_u64() as u32;
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait

error[E0605]: non-primitive cast: `std::num::NonZeroU64` as `u32`
   --> C:\Users\Hasan\.cargo\registry\src\github.com-1ecc6299db9ec823\rustc-ap-rustc_data_structures-642.0.0\profiling.r
s:471:25
    |
471 |         let thread_id = std::thread::current().id().as_u64() as u32;
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0605`.
error: could not compile `rustc-ap-rustc_data_structures`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `racer v2.1.31`, intermediate artifacts can be found at `C:\Users\Hasan\AppData\Local\Temp\carg
o-install2zjY4g`

Caused by:
  build failed

I have alredy ran rustup toolchain add nightly

Is there something I am missing?
Any help would be greatly appreciated.

pmk21 commented

Came across this error too. Seems to be a bug in the rustc-ap-rustc_data_structures crate. In the version 642.0.0.

Did some research and found that a .get() seems to be missing in the statement std::thread::current().id().as_u64() which throws up the error.

Seems to have been fixed in version 649.0.0 of the crate.

Yes. It seems to be working now. I will close the issue.