rust-lang / rust-lang/rust-analyzer
"unresolved extern crate" for rustc crate dependencies while workspace is loading
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
When opening the Miri workspace with the src/lib.rs file open, I get "unresolved extern crate" error while RA is loading:
Those errors disappear if I wait a while and then switch to a different file in vscode. However, it is quite confusing to see these errors during loading since it looks like something permanent, but is apparently just an artifact of the crate graph not being fully loaded yet.
rust-analyzer version: rust-analyzer version: 0.3.2519-standalone [/home/r/.vscode-oss/extensions/rust-lang.rust-analyzer-0.3.2519-linux-x64/server/rust-analyzer]
rustc version: rustc 1.89.0-nightly (255aa2208 2025-06-19)
editor or extension: VSCodium, extension 0.3.2519
relevant settings:
{
"rust-analyzer.rustc.source": "discover",
"rust-analyzer.linkedProjects": [
"Cargo.toml",
"cargo-miri/Cargo.toml",
"miri-script/Cargo.toml",
],
"rust-analyzer.check.invocationStrategy": "once",
"rust-analyzer.check.overrideCommand": [
"./miri",
"clippy",
"--message-format=json",
],
"rust-analyzer.cargo.extraEnv": {
"MIRI_AUTO_OPS": "no",
"MIRI_IN_RA": "1",
},
// Contrary to what the name suggests, this also affects proc macros.
"rust-analyzer.cargo.buildScripts.invocationStrategy": "once",
"rust-analyzer.cargo.buildScripts.overrideCommand": [
"./miri",
"check",
"--message-format=json",
],
}
repository link (if public, optional): https://github.com/rust-lang/miri/
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the report with the Miri workspace, opening src/lib.rs in VSCodium while rust-analyzer loads and using the linked-project and override-command settings shown. Trace how unresolved extern crate diagnostics are produced during workspace loading. Done means transient loading errors no longer appear as misleading persistent diagnostics, while genuine diagnostics remain visible after loading completes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100