Open bjorn3 opened 2 weeks ago
Assuming you don't have any sysroot settings set, we are just invoking rustc --print sysroot
to find it
Is it possible that rust-analyzer is detecting a workspace somewhere nested in the rust repo checkout I have inside my cg_clif checkout with an intentionally wrong toolchain? And if so how do I stop it from detecting this?
It might. The only way to get around this right now is by specifying linkedProjects
via your editor config and point that to the main Cargo.toml
(we'll have rust-analyzer.toml support very soon sidestepping the client config for this). In the latest r-a you should be able to hover the status bar icon in vscode to tell you more aobut the loaded workspaces
Hmm, the error message is stating /home/gh-bjorn3/cg_clif
though so that doesn't seem to be it
I can repro this it seems, will investigate (it seems to default to the parent dir for some reason)
Ah the cause is the inline rust-project specification in the linked projects, The problem is the "sysroot_src": "./build/stdlib/library",
, we currently assume the sysroot to exist when a sysroot_src is supplied, and we there assume its 5 directories up hence the weird path being used as a sysroot
I tried using "./example/std_example.rs"
in the place of the inline rust-project that uses sysroot_src
, but when I do that, rust-analyzer spams the following in the logs:
2024-04-29T10:40:18.397992Z ERROR project_model::workspace: cyclic deps: rustc_codegen_cranelift(Idx::<CrateData>(11)) -> rustc_codegen_cranelift(Idx::<CrateData>(11)), alternative path: rustc_codegen_cranelift(Idx::<CrateData>(11))
And alternates between the following status messages: "Roots scanned: 275/277: rust", "Roots scanned: 275/277: download", and no status message at all.
Also if the "Loaded workspaces" list is too big, I can't scroll down, thus making the buttons beneath it inaccessible.
rust-analyzer version: rust-analyzer version: 0.4.1938-standalone (https://github.com/rust-lang/rust-analyzer/commit/f216be4a0746142c5f30835b254871256a7637b8 2024-04-27)
rustc version: rustc 1.79.0-nightly (aed2187d5 2024-04-27)
editor or extension: VSCode
relevant settings: Unknown
repository link (if public, optional): https://github.com/rust-lang/rustc_codegen_cranelift/
reproducer: Happens when working on cg_clif, no clue why it thinks
/home
should be used as toolchain.