-
Notifications
You must be signed in to change notification settings - Fork 1.8k
"unresolved extern crate" when importing rustc crates from a locally built toolchain #12926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
|
I switch between linked toolchains and downloaded toolchains all the time, so that is not a solution. Why can't RA auto-discover linked toolchains? Miri for example auto-discovers the rust-src location for both linked and installed toolchains just fine. |
I have the same issue. |
I'm not sure how this all works, so I'm just gonna lay out what r-a does right now for discovering. First it checks if |
Yeah |
Oh, Miri doesn't have that logic any more since Could R-A be confused by the symlink? |
Ah wait, the Edit: Actually setting |
The override in the Miri folder is set to the linked toolchain. So The rustc build will take a bit before I can provide logs. |
How is the override specified? It might not work for r-a here depending on how you set the override and where Edit: Looks like a directory override if I see this right? That should work fine then hmm rust-analyzer/crates/toolchain/src/lib.rs Lines 28 to 56 in 3392573
|
|
Added some logging to emit the sysroot and rustc paths being used #13441 |
The RA_LOG you suggested prints this several times
Some of the paths it mentions indeed exist ( |
So looks like we have to extend whatever code sets up the symlink in |
Ye I would guess so? This is what r-a is doing fwiw rust-analyzer/crates/project-model/src/sysroot.rs Lines 219 to 238 in 82ac6f7
Just simply append the path to the sysroot, and I don't think there is much more we can do from our side? Though it's odd, how does rust do this then ... |
Indeed I can confirm that rust-lang/rust#103347 fixes this problem. :) |
To reproduce, first locally build a rustc (
./x.py build compiler --stage 2
), then check out Miri, configure it for RA as shown below, and open it in vscode. Now open thesrc/lib.rs
file. There are errors forextern crate rustc_middle;
and all the other rustc crate imports: "unresolved extern crate".A
./miri check
works fine, so the crates do exist, but RA somehow fails to find them.rust-analyzer version: rust-analyzer version: 0.3.1148-standalone (2b472f6 2022-07-31)
rustc version: locally built rustc master
relevant settings:
The text was updated successfully, but these errors were encountered: