Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My Cargo.toml is displaying some red lines with error couldn't compile serde_derive

I try to build a project using rust-lang recently (this is my first rust project, and my boss is supporting me to use a new technology in my company). But, I suddenly get some red lines on my Cargo.toml :

could not compile `serde_derive`.
error: could not compile `async-trait`.

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

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

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

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

I run a command Cargo Run and my project is running well, but these red lines prevent me to tracking an error on my other code in my project (So if there is an error in code, it won't display as there are still exists some errors in another file, it is Cargo.toml)

I am using cargo 1.43.0-nightly (bda50510d 2020-03-02), rustc 1.43.0-nightly (c20d7eecb 2020-03-11), and vs code 1.43 version.

This is my Cargo.toml :

[package]
name = "app_base"
version = "0.1.0"
authors = ["yonathan"]
edition = "2018"

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

[dependencies]
rocket = "0.4.3"
rocket_codegen = "0.4.3"
rocket_contrib = "0.4.3"
rocket_http = "0.4.3"
cookie = "0.11.2"
rocket-json-response = "0.5.10"
diesel = { version = "1.4.3", features = ["postgres"] }
dotenv = "0.15.0"
postgres = { version = "0.17.2", features = ["with-chrono-0_4"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
json-gettext = "3.1.7"
debug-helper = "0.3.8"
serializers  = "0.2.3"
rocket_cors = { git = "https://github.com/lawliet89/rocket_cors", branch = "master" }
chrono = "0.4"
like image 688
Yonathan Pamungkas Putra Avatar asked Mar 14 '20 10:03

Yonathan Pamungkas Putra


1 Answers

As this is an RLS (rust language server) bug [which is closed apparently, see here], a temporary alternative can be using the rust-analyzer extension [website here].

To install the extension, you can launch VSCode, click on the Extensions tab on the left and search for rust-analyzer in the Marketplace.

Please note that as mentioned on the website [as of 04/01/2020], this project is still in ALPHA, which means it may be prone to breakages.

like image 75
Arpan Srivastava Avatar answered Nov 17 '22 17:11

Arpan Srivastava