rust-lang / atom-ide-rust

Rust IDE support for Atom, powered by the Rust Analyzer or Rust Language Server
MIT License
259 stars 43 forks source link

Cargo failed: Error compiling dependent crate #80

Closed althonos closed 5 years ago

althonos commented 6 years ago

Hi Ryan (or anyone reading this),

I've been using atom-ide-rust for some time, but the rls stopped working lately. I get a Cargo failed: Error compiling dependent crate message when I start atom in a Rust project directory. Other things (like rustfmt) still work.

Here's the output I get with atom.config.set('core.debugLSP', true):

/home/althonos/.local/share/atom/packages/ide-rust/node_modules/atom-languageclient/build/lib/logger.js:9 
Rust (RLS) stderr {
    "message":"multiple input filenames provided",
    "code":null,
    "level":"error",
    "spans":[],
    "children":[],
    "rendered":
    "error: multiple input filenames provided\n\n"
}

with:

$ rls --version
rls-preview 0.128.0-nightly (453f5e4 2018-05-28)
$ atom --version
Atom    : 1.27.1
Electron: 1.8.4
Chrome  : 59.0.3071.115
Node    : 8.2.1
alexheretic commented 6 years ago

If, after a cargo clean, cargo check still works (on the same toolchain as atom) but ide-rust does not; this looks like an rls-cargo issue. Can you reproduce on an open source project, or something I can use to reproduce?

althonos commented 6 years ago

Unfortunately since I didn't realize when it started, I don't have any clue on the possible source.

This bug occurs in every rust project (you can clone althonos/packageurl-rs, a fresh clone still doesn't work, although cargo clean && cargo check --all-targets does, with both toolchains using nightly) when I have Atom open in the root of the project.

I checked with both stable and nightly and I get the same error as before for both toolchains.

althonos commented 6 years ago

Oh and by the way, here's my package list:

$ apm list
...
Community Packages (44) /home/althonos/.local/share/atom/packages
├── MagicPython@1.0.12
├── atom-clock@0.1.16 (disabled)
├── atom-eclipse-syntax@0.0.5
├── atom-ide-ui@0.12.0
├── atom-material-numix-syntax@0.2.1
├── autocomplete-python@1.10.5
├── autumn-highlighter-syntax@1.13.0
├── build-cargo@2.0.0
├── busy-signal@1.4.3
├── city-lights-syntax@1.1.8
├── city-lights-ui@1.3.3
├── dark-flat-ui@1.2.4
├── git-hide@1.0.0
├── ide-python@0.9.2 (disabled)
├── ide-rust@0.16.2
├── intentions@1.1.5
├── jackhammer-syntax@1.1.0
├── language-cmake@1.1.0
├── language-cython@0.3.0
├── language-ocaml@1.9.5
├── language-restructuredtext@1.1.2
├── language-rust@0.4.12
├── language-scala@1.1.9
├── linter@2.2.0 (disabled)
├── linter-flake8@2.3.0 (disabled)
├── linter-mypy@2.6.2 (disabled)
├── linter-pydocstyle@0.4.7 (disabled)
├── linter-ui-default@1.7.1
├── markdown-preview-plus@3.2.2
├── minimap-autohide@0.10.1
├── multi-wrap-guide@1.1.5
├── now-syntax@0.2.4
├── numix-dark-ui@0.3.0
├── numix-ui@0.2.3
├── one-outlander-ui@0.3.1
├── outlander-syntax@2.0.0
├── outlander-ui@1.4.0
├── pdf-view@0.70.0
├── platformio-ide-terminal@2.8.1
├── python-indent@1.1.5
├── racer@0.20.0 (disabled)
├── seti-icons@1.5.4
├── slim-dark-ui@0.12.0
└── styri-syntax@0.2.0
alexheretic commented 6 years ago

I can't reproduce. Are you on Linux? Can you provide any more console out?

gcp commented 6 years ago

I have the same problem with VSCode & Rust (rls) rust-lang.rust 0.4.9

cargo clean & cargo check passes.

Extension errors out with Rust (RLS): Cargo failed: Error compiling dependent crate.

rls --version
rls-preview 0.129.0-nightly (2b57851 2018-07-14)
gcp commented 6 years ago

In my case removing the rust-toolchain file (pointing to nightly) solved it. But I guess that simply hides the underlying issue?

rls --version
rls-preview 0.127.0-stable (d2ade31 2018-05-08)
motecshine commented 6 years ago

rls --version rls-preview 0.129.0-nightly (2b57851 2018-07-14)

same problem

dannyfritz commented 6 years ago

This other thread suggest using sccache is the culprit https://github.com/rust-lang-nursery/rls-vscode/issues/398 I am seeing this error and I am indeed using sccache.

UPDATE: removing sccache from my RUSTC_WRAPPER does fix rls for me.

cryptoquick commented 6 years ago

I'm having this problem and I don't have RUSTC_WRAPPER set. Any ideas?

alexheretic commented 6 years ago

I've done a little work to better propagate cargo errors in rls https://github.com/rust-lang-nursery/rls/pull/1079. This should help highlight the causes of these issues and should hopefully be merged and coming to a nightly release soon.

althonos commented 6 years ago

Fix by @dannyfritz worked for me.

alexheretic commented 5 years ago

I'm going to close this for now, as the original culprit was found. We should have better errors from rls now, so please raise more tickets if issues are found.