How to fix crates error in vscode

This is my Cargo.toml file.

name = "hello_world"
version = "0.1.0"
edition = "2021"

rand = "0.8.5"     !!! (what does it mean?)

"Crates: ! Completed with errors" is displayed on the status bar of vscode.

But, cargo build and cargo run works properly.
Then what is the reason?

Help me.

What errors is vscode getting?

Thank you for your reply.
This is full message that is displayed when I hover my mouse over !!!.

* rand: Error: Command failed: git --no-pager --git-dir="C:\Users\MyName\.cargo\registry\index\\.git" show origin/master:ra/nd/rand
* fatal: invalid object name 'origin/master'.

It sounds like there's some sort of problem with your cargo registry. I would try deleting the C:\Users\MyName\.cargo\registry folder and trying again.

1 Like

Thank you, Alice Ryhl.
It works for me.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.