vscode-rust
vscode-rust copied to clipboard
Cargo.toml is incorrectly all underlined when build fails
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?

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.
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.
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
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`
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
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.
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
I’m curious if the solution here solves this problem. https://github.com/rust-lang/rls-vscode/issues/729#issuecomment-591350776
@rubberduck203 Does not. I have that settings file in my quickstart
The workaround seems to be to close Cargo.toml and reopen it after a good build.
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.
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.
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.
This might be a necro, but I fixed this by installing RustAnalyzer and disabling RLS. So that might be worth a try.
I'm using Rust Analyzer and disabled RLS a long time ago, so I don't think that's the problem.
Alan Karp
On Tue, Mar 23, 2021 at 5:37 PM Alia @.***> wrote:
This might be a necro, but I fixed this by installing RustAnalyzer and disabling RLS. So that might be worth a try.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rust-lang/vscode-rust/issues/730#issuecomment-805380740, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACFAT44LVB6HOUQ6AC7H2ILTFEX3RANCNFSM4KILX42Q .
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.
I am having the same problem
@Xyndra you should try https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer