vscode-rust icon indicating copy to clipboard operation
vscode-rust copied to clipboard

Could not compile on Nightly Channel

Open visualcookie opened this issue 4 years ago • 12 comments

Hej, currently trying to get the extension up and running. I already set "rust-client.channel": "nightly", but appearently the extension could not compile.

Cargo.toml

[package]
name = "xxx"
version = "0.1.0"
authors = ["Dean Hidri <[email protected]>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
juniper = "0.14.2"
juniper_rocket = "0.5.2"
rocket = "0.4.4"
serde_json = "1.0.48"

Error I'm getting:

{
	"resource": "/Users/visualcookie/Development/xxx/Cargo.toml",
	"owner": "rust0",
	"severity": 8,
	"message": "could not compile `serde_derive`.\nerror: could not compile `juniper_codegen`.\n\nTo learn more, run the command again with --verbose.\n",
	"startLineNumber": 1,
	"startColumn": 1,
	"endLineNumber": 10000,
	"endColumn": 1
}

The thing is, when I run rustup run cargo build in the Terminal myself, it works without issues, but I can't seem to disable the build process from the extension. Already checked some of the open issues, but nothing worked.

visualcookie avatar Mar 17 '20 12:03 visualcookie

Having the same issue, and have had it for a while now. I was never able to build on nightly.

Seems to be related to https://github.com/rust-lang/rls/issues/1449 and https://github.com/rust-lang/rls/issues/1635?

dennybritz avatar Mar 17 '20 14:03 dennybritz

I'm running into the same problem.

raphaelrobert avatar Mar 17 '20 19:03 raphaelrobert

After I closed VS Code and ran update command, the error disappeared.

snylonue avatar Mar 18 '20 06:03 snylonue

@snylonue Tried that as well, but didn't work for me, as RLS would always rebuild on start.

visualcookie avatar Mar 18 '20 14:03 visualcookie

same issue on MacOS, rustup 1.21.1 (7832b2ebe 2019-12-20). Tried removing everything and reinstalling again but only switch to stable channel fixed the issue.

rusenask avatar Mar 21 '20 10:03 rusenask

Same issue. This renders the extension useless for me currently.

SorteKanin avatar Mar 21 '20 12:03 SorteKanin

Probably related to https://github.com/rust-lang/rust/issues/69933. The fix for this issue is already included in nightly, so I assume it will eventually be fixed. However, it's weird that cargo build from terminal works, but rls-vscode fails to build with following error message. rls seems to work fine.

{"message":"cannot lex `source_file` without source: /Users/taegyunkim/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-1.0.3/src/lib.rs","code":null,"level":"error: internal compiler error","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;9merror: internal compiler error\u001b[0m\u001b[0m\u001b[1m: cannot lex `source_file` without source: /Users/taegyunkim/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-1.0.3/src/lib.rs\u001b[0m\n\n"}
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:880:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.44.0-nightly (f509b26a7 2020-03-18) running on x86_64-apple-darwin

note: compiler flags: -C prefer-dynamic -C debuginfo=2 --crate-type proc-macro

note: some of the compiler flags provided by cargo are hidden

{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;9merror\u001b[0m\u001b[0m\u001b[1m: aborting due to previous error\u001b[0m\n\n"}

My setup.

$> rustup show
Default host: x86_64-apple-darwin
rustup home:  /Users/taegyunkim/.rustup

installed toolchains
--------------------

stable-x86_64-apple-darwin
nightly-x86_64-apple-darwin (default)

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

nightly-x86_64-apple-darwin (default)
rustc 1.44.0-nightly (f509b26a7 2020-03-18)

$> rustup --version
rustup 1.21.1 (7832b2ebe 2019-12-20)

taegyunkim avatar Mar 30 '20 19:03 taegyunkim

@taegyunkim RLS isn't available for the latest nightly. The last nightly RLS is available for is 2020-03-18, which I presume is before that fix got implemented.

Rustup will try to find the latest nightly build that has the components available for your toolchain. And since RLS is part of your toolchain, the last compatible build is 2020-03-18, at least until RLS is updated for the latest nightly.

What you can try is using an older nightly build that didn't have this issue. thecodewarrior mentioned 2020-03-09 on that issue, so you can try by specifying that particular build like rustup override set nightly-2020-03-09.

appul avatar Apr 01 '20 00:04 appul

If it is any of any help, I am receiving a similar error while testing the pyo3 example

Below is the error that is displayed while having my cursor over the contents of Cargo.toml:

could not compile `serde_derive`.
error: could not compile `ctor`.

To learn more, run the command again with --verbose.
error: could not compile `ghost`.

To learn more, run the command again with --verbose.
error: could not compile `pyo3-derive-backend`.

Worth to mention that cargo build --release works fine.

robintyagiandersson avatar Apr 05 '20 14:04 robintyagiandersson

I'm still getting this issue in VS Code (fresh install of the plugin and rust) image

picode7 avatar Jan 18 '21 17:01 picode7

The issue persists for me with rust-lang.rust version v0.7.8 and rustup show: stable-x86_64-unknown-linux-gnu (default) rustc 1.57.0 (f1edd0429 2021-11-29)

Sijisu avatar Jan 10 '22 17:01 Sijisu

@Sijisu if you aren't aware of it, you might want to try https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer (but please download the VSIX from GitHub instead). See https://github.com/rust-lang/vscode-rust/issues/927 for context.

lnicola avatar Jan 10 '22 17:01 lnicola