[Solved] Unable to compile things like diesel_codegen


#1

This started out of the blue, I have my nightly version pegged so I don’t have to deal with things that suddenly stops working, however this error just appeared out of nowhere when building my rust program.

/home/benjamin/.cargo/git/checkouts/diesel-6e3331fb3b9331ec/master/diesel_codegen/src/lib.rs:1:43: 1:91 error: #[feature] may not be used on the stable release channel
/home/benjamin/.cargo/git/checkouts/diesel-6e3331fb3b9331ec/master/diesel_codegen/src/lib.rs:1 #![cfg_attr(not(feature = "with-syntex"), feature(rustc_private, plugin_registrar, quote))]
                                                                                                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
error: Could not compile `diesel_codegen`.

This affects stable, beta, nightly for me. However Travis is just fine, so I thought it might have been cargo going crazy, so I uninstall rustup (rustup self uninstall) then reinstall rustup and download stable, beta, nightly, & nightly-2016-05-08. No cigar, still wouldn’t work. After much searching I decided to ask the community for help, since this issue makes it impossible for me to test locally.


#2

What is the output of rustc -V, and rustup show?

If those show what you expect, how about env | grep RUST?


#3
╭─ 09:35:24  benjamin@benjamin-laptop  ~/git-projects/Alchemist   cargo-fix ●  
╰─ rustc -V                                                                                                                        ✓ 
rustc 1.8.0
╭─ 09:35:35  benjamin@benjamin-laptop  ~/git-projects/Alchemist   cargo-fix ●  
╰─ rustup show                                                                                                                     ✓ 
installed toolchains
--------------------

nightly-2016-05-08-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)

active toolchain
----------------

nightly-2016-05-08-x86_64-unknown-linux-gnu (directory override for '/home/benjamin/git-projects/Alchemist')
rustc 1.10.0-nightly (d91f8ab0f 2016-05-07)

╭─ 09:36:04  benjamin@benjamin-laptop  ~/git-projects/Alchemist   cargo-fix ●  
╰─ env | grep RUST                                                                                                                 ✓ 
RUST_SRC_PATH=/home/benjamin/git-projects/rust/src/

Everything is what it is supposed to be.


#4

That’s the wrong version of Rust. It should say something like rustc 1.10.0-nightly (0123abcd 2016-05-08) It looks like you have another installation of Rust 1.8.0 somewhere on your system, and it’s earlier in your $PATH than the one installed by rustup. Running which rustc should help determine where it is.


#5

Results in

╭─ 10:14:37  benjamin@benjamin-laptop  ~/git-projects/Alchemist   testing  
╰─ which rustc                                                                                                                     ✓ 
/usr/bin/rustc

I had a system wide install of rust on my pc. Uninstalling that via. my package manager fixed it to the correct version.

╭─ 10:15:55  benjamin@benjamin-laptop  ~/git-projects/Alchemist   testing  
╰─ which rustc                                                                                                                     ✓ 
/home/benjamin/.cargo/bin/rustc