Skip to content
This repository was archived by the owner on Nov 18, 2022. It is now read-only.

Cargo.toml is incorrectly all underlined when build fails #730

Open
canadaduane opened this issue Jan 17, 2020 · 17 comments
Open

Cargo.toml is incorrectly all underlined when build fails #730

canadaduane opened this issue Jan 17, 2020 · 17 comments

Comments

@canadaduane
Copy link

I believe the cargo build is failing on one particular package, and vscode is unable to show that the error belongs to a single line?

image

This was very confusing, as I thought at first that I had misunderstood how to write TOML.

I believe the cause of the failed build is that I'm using a particular back-dated version of nightly, and I can't seem to communicate this fact to rls-vscode. As a result, one of the crates fails.

@ToferC
Copy link

ToferC commented Mar 29, 2020

I'm having the same issue, with the same build failed: could not compile - but the module cited changes over time. As per the OP, the error is incorrect. The program builds and runs correctly - there seems to be a problem with RLS.

I first detected this with an amethyst game.

I've tried this with several different programs and get the same outcome. RLS detects a single error in Cargo.toml, program builds correctly.

Updating RLS in VSCode or reinstalling RLS and/or VSCode doesn't help.

@lemonxah
Copy link

I am also experiencing this. The code compiles fine with cargo build and it runs fine aswell but in vscode it doesn't show errors since the cargo.toml file is in error state

@kylegalloway
Copy link

I am experiencing this as well. Not sure if it matters, but mine complains of not being able to build a custom build command from rocket-contrib.

error: failed to run custom build command for `rocket_codegen v0.4.3`

@isdelrey
Copy link

isdelrey commented Apr 18, 2020

I also seem to be experiencing this. My error is the following:

could not compile `futures-macro`.
error: could not compile `tokio-macros`.

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

To learn more, run the command again with --verbose.

And still, it builds

@Plasmoxy
Copy link

Plasmoxy commented May 4, 2020

I am encountering this too when using a rust framework that builds the app in a custom way through its CLI (Tauri) and building with cargo makes the build fail. The result is that while I actually built successfully (through the framework's CLI build), the extension still marks my cargo.toml as "Build failed" and it just stops finding any other errors, becoming useless.

@reneherrero
Copy link

Same is happening here with an embedded rust project. Here's the code in case you want to replicate: https://github.com/reneherrero/blue-pill-quickstart

@rubberduck203
Copy link

I’m curious if the solution here solves this problem. #729 (comment)

@reneherrero
Copy link

@rubberduck203 Does not. I have that settings file in my quickstart

@alanhkarp
Copy link

The workaround seems to be to close Cargo.toml and reopen it after a good build.

@wbuck
Copy link

wbuck commented Sep 28, 2020

I'm also experiencing the same issue.
I can build and run the application correctly, but VS Code is reporting the following error in my Cargo.toml

failed to run custom build command for alignment v0.1.0
The following warnings were emitted during compilation:

Unfortunately it doesn't show any errors after the colon so I'm unsure what, if anything, needs to be fixed..
I do have a custom build script in which I'm compiling proto's and running cmake.

Again, as stated above, everything builds and runs correctly, it's just VS Code (RLS) which seems to be having an issue.

@nathan-osman
Copy link

I'm seeing this too:

failed to run rustc to learn about target-specific information

Opening VS Code's terminal and running cargo build works fine.

@nathan-osman
Copy link

So, further update: in my case, the problem was caused by some bad flags that were being passed to rustc through RUSTFLAGS. Removing these made the error disappear.

@00alia00
Copy link

This might be a necro, but I fixed this by installing RustAnalyzer and disabling RLS. So that might be worth a try.

@alanhkarp
Copy link

alanhkarp commented Mar 24, 2021 via email

@lnicola
Copy link
Member

lnicola commented Mar 24, 2021

Please file any rust-analyzer issue on that repository instead and make sure you use its own extension instead of the option in this one.

@Xyndra
Copy link

Xyndra commented May 8, 2022

I am having the same problem

@lnicola
Copy link
Member

lnicola commented May 8, 2022

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests