racer-rust / racer

Rust Code Completion utility
MIT License
3.36k stars 278 forks source link

could not compile `rustc-ap-rustc_ast` when installing last version #1120

Open gasabr opened 4 years ago

gasabr commented 4 years ago

I'm trying to install racer both from cargo and from sources and receive error:

$~/r/racer (master)> cargo +nightly build --release
...
error: `std::intrinsics::transmute` is not yet stable as a const fn
   --> /home/gasabr/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_ast-669.0.0/ptr.rs:136:17
    |
136 |                 std::mem::transmute(NonNull::<[T; 0]>::dangling() as NonNull<[T]>)
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(const_transmute)]` to the crate attributes to enable

error: aborting due to previous error

error: could not compile `rustc-ap-rustc_ast`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

env: I'm on ubuntu 18.04 under wsl

gasabr@DESKTOP-9TJPKDL ~/r/racer (master) [1]> rustup toolchain list
stable-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)
1.45.0-x86_64-unknown-linux-gnu

I've tried to change toolchain, install 2.0.13, 2.0.14 neither of that worked:(

emuhr commented 4 years ago

I can confirm the same issue on arch using the latest rustup from the official arch repository (1.22.1-1). $ rustup toolchain list stable-x86_64-unknown-linux-gnu (default) nightly-x86_64-unknown-linux-gnu

chenyanming commented 4 years ago

Same issue in windows.

$ cargo +nightly build --release
   Compiling serde v1.0.105
   Compiling rustc-ap-rustc_ast v669.0.0
   Compiling rustc-ap-rustc_errors v669.0.0
error: `std::intrinsics::transmute` is not yet stable as a const fn
   --> C:\Users\elecm\.cargo\registry\src\github.com-1ecc6299db9ec823\rustc-ap-rustc_ast-669.0.0\ptr.rs:136:17
    |
136 |                 std::mem::transmute(NonNull::<[T; 0]>::dangling() as NonNull<[T]>)
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(const_transmute)]` to the crate attributes to enable

error: aborting due to previous error

error: could not compile `rustc-ap-rustc_ast`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
arjansingh commented 4 years ago

Same issue in OSX. Similar messages to what everyone has above.

p870613 commented 4 years ago
Same issue in Ubuntu20.04. error: std::intrinsics::transmute is not yet stable as a const fn --> /home/lin/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_ast-669.0.0/ptr.rs:136:17 136 std::mem::transmute(NonNull::<[T; 0]>::dangling() as NonNull<[T]>) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: add `#![feature(const_transmute)]` to the crate attributes to enable

error: aborting due to previous error

error: could not compile rustc-ap-rustc_ast.

To learn more, run the command again with --verbose. warning: build failed, waiting for other jobs to finish... error: build failed

thezealousfool commented 4 years ago

As the error message says, it is a problem with rustc_ast. I tried upgrading the version of rustc_ast racer depends on, but that did not help either.

The following changes worked for me: rustc_ast (v669.0.0, default for racer right now): Change ~/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_ast-669.0.0/lib.rs line 13 from #![cfg_attr(not(bootstrap), feature(const_fn_transmute))] to #![feature(const_transmute)]

rustc_ast (v670.0.0, latest): Change ~/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_ast-670.0.0/lib.rs line 12 from #![feature(const_fn_transmute)] to #![feature(const_transmute)]