full error:
Failed loading rustc_private crates for workspace 'path to Cargo.toml in workspace':
Failed to discover rustc source for sysroot.
This error occurs in all projects even newly initialized.
rustc --print sysroot
prints path
I tried to setting path manually in system variables(I'm on Win11), didn't help.
Then I reinstalled all rust dependecies, restatred VS code, didn't help, resterted PC, didn't help.
Again, after reinstallation via commands everything is fine: rustc
and rust-src
exists,
rustc --print sysroot
prints path. Only extension is complaining.
After I set the environment variables correctly as @Chayim Friedman said in the commments:
RA_LOG_FILE='C:\435fhdjkh84.txt'
and RA_LOG='project_model=debug'
(Single Quotation Marks in both variables are only for better readabilty). And created 435fhdjkh84.txt
file in the path, I relaunched VS code.
And here are the contents that were written into the file specified:
2024-07-11T08:31:42.491596Z DEBUG project_model::sysroot: Discovering sysroot by "C:\\Users\\pasna\\.cargo\\bin\\rustc.exe" "--print" "sysroot"
2024-07-11T08:31:43.406525Z DEBUG project_model::sysroot: checking sysroot library: C:\Users\pasna\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/src/rust/library
2024-07-11T08:31:43.413332Z INFO project_model::workspace: Using sysroot workspace=C:\Users\pasna\Stepan\Code\Tauri_app\Cargo.toml src_root=Some(AbsPath("C:\\Users\\pasna\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib/rustlib/src/rust/library")) root=Some(AbsPath("C:\\Users\\pasna\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc"))
2024-07-11T08:31:43.413588Z DEBUG project_model::sysroot: checking for rustc source code: C:\Users\pasna\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/rustc-src/rust/compiler/rustc/Cargo.toml
2024-07-11T08:31:43.726965Z DEBUG rustc_cfg::get: project_model::rustc_cfg: rustc cfgs found rustc_cfgs=[Atom("debug_assertions"), Atom("overflow_checks"), KeyValue { key: "panic", value: "unwind" }, KeyValue { key: "relocation_model", value: "pic" }, KeyValue { key: "target_abi", value: "" }, KeyValue { key: "target_arch", value: "x86_64" }, KeyValue { key: "target_endian", value: "little" }, KeyValue { key: "target_env", value: "msvc" }, KeyValue { key: "target_family", value: "windows" }, KeyValue { key: "target_feature", value: "cmpxchg16b" }, KeyValue { key: "target_feature", value: "fxsr" }, KeyValue { key: "target_feature", value: "lahfsahf" }, KeyValue { key: "target_feature", value: "sse" }, KeyValue { key: "target_feature", value: "sse2" }, KeyValue { key: "target_feature", value: "sse3" }, Atom("target_has_atomic"), KeyValue { key: "target_has_atomic", value: "128" }, KeyValue { key: "target_has_atomic", value: "16" }, KeyValue { key: "target_has_atomic", value: "32" }, KeyValue { key: "target_has_atomic", value: "64" }, KeyValue { key: "target_has_atomic", value: "8" }, KeyValue { key: "target_has_atomic", value: "ptr" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "128" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "16" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "32" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "64" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "8" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "ptr" }, Atom("target_has_atomic_load_store"), KeyValue { key: "target_has_atomic_load_store", value: "128" }, KeyValue { key: "target_has_atomic_load_store", value: "16" }, KeyValue { key: "target_has_atomic_load_store", value: "32" }, KeyValue { key: "target_has_atomic_load_store", value: "64" }, KeyValue { key: "target_has_atomic_load_store", value: "8" }, KeyValue { key: "target_has_atomic_load_store", value: "ptr" }, KeyValue { key: "target_os", value: "windows" }, KeyValue { key: "target_pointer_width", value: "64" }, Atom("target_thread_local"), KeyValue { key: "target_vendor", value: "pc" }, Atom("ub_checks"), Atom("windows")]
2024-07-11T08:31:43.842526Z DEBUG project_model::cargo_workspace: Discovering cargo config target by "C:\\Users\\pasna\\.cargo\\bin\\cargo.exe" "-Z" "unstable-options" "config" "get" "build.target"
2024-07-11T08:31:43.904914Z DEBUG project_model::cargo_workspace: Discovering host platform by "C:\\Users\\pasna\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\bin\\rustc.exe" "-vV"
2024-07-11T08:31:53.736942Z DEBUG project_model::env: Discovering cargo config env by "C:\\Users\\pasna\\.cargo\\bin\\cargo.exe" "-Z" "unstable-options" "config" "get" "env"
2024-07-11T08:31:53.812679Z DEBUG ProjectWorkspace::to_crate_graph: project_model::workspace: Did not patch std to depend on cfg-if
2024-07-11T08:31:53.813707Z DEBUG project_model::sysroot: Discovering sysroot by "C:\\Users\\pasna\\.cargo\\bin\\rustc.exe" "--print" "sysroot"
2024-07-11T08:31:53.891915Z DEBUG project_model::sysroot: checking sysroot library: C:\Users\pasna\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/src/rust/library
2024-07-11T08:31:53.892728Z INFO project_model::workspace: Using sysroot workspace=C:\Users\pasna\Stepan\Code\Tauri_app\Cargo.toml src_root=Some(AbsPath("C:\\Users\\pasna\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib/rustlib/src/rust/library")) root=Some(AbsPath("C:\\Users\\pasna\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc"))
2024-07-11T08:31:53.892806Z DEBUG project_model::sysroot: checking for rustc source code: C:\Users\pasna\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/rustc-src/rust/compiler/rustc/Cargo.toml
2024-07-11T08:31:54.005188Z DEBUG rustc_cfg::get: project_model::rustc_cfg: rustc cfgs found rustc_cfgs=[Atom("debug_assertions"), Atom("overflow_checks"), KeyValue { key: "panic", value: "unwind" }, KeyValue { key: "relocation_model", value: "pic" }, KeyValue { key: "target_abi", value: "" }, KeyValue { key: "target_arch", value: "x86_64" }, KeyValue { key: "target_endian", value: "little" }, KeyValue { key: "target_env", value: "msvc" }, KeyValue { key: "target_family", value: "windows" }, KeyValue { key: "target_feature", value: "cmpxchg16b" }, KeyValue { key: "target_feature", value: "fxsr" }, KeyValue { key: "target_feature", value: "lahfsahf" }, KeyValue { key: "target_feature", value: "sse" }, KeyValue { key: "target_feature", value: "sse2" }, KeyValue { key: "target_feature", value: "sse3" }, Atom("target_has_atomic"), KeyValue { key: "target_has_atomic", value: "128" }, KeyValue { key: "target_has_atomic", value: "16" }, KeyValue { key: "target_has_atomic", value: "32" }, KeyValue { key: "target_has_atomic", value: "64" }, KeyValue { key: "target_has_atomic", value: "8" }, KeyValue { key: "target_has_atomic", value: "ptr" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "128" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "16" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "32" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "64" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "8" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "ptr" }, Atom("target_has_atomic_load_store"), KeyValue { key: "target_has_atomic_load_store", value: "128" }, KeyValue { key: "target_has_atomic_load_store", value: "16" }, KeyValue { key: "target_has_atomic_load_store", value: "32" }, KeyValue { key: "target_has_atomic_load_store", value: "64" }, KeyValue { key: "target_has_atomic_load_store", value: "8" }, KeyValue { key: "target_has_atomic_load_store", value: "ptr" }, KeyValue { key: "target_os", value: "windows" }, KeyValue { key: "target_pointer_width", value: "64" }, Atom("target_thread_local"), KeyValue { key: "target_vendor", value: "pc" }, Atom("ub_checks"), Atom("windows")]
2024-07-11T08:31:54.067970Z DEBUG project_model::cargo_workspace: Discovering cargo config target by "C:\\Users\\pasna\\.cargo\\bin\\cargo.exe" "-Z" "unstable-options" "config" "get" "build.target"
2024-07-11T08:31:54.108056Z DEBUG project_model::cargo_workspace: Discovering host platform by "C:\\Users\\pasna\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\bin\\rustc.exe" "-vV"
2024-07-11T08:31:54.740285Z DEBUG project_model::env: Discovering cargo config env by "C:\\Users\\pasna\\.cargo\\bin\\cargo.exe" "-Z" "unstable-options" "config" "get" "env"
2024-07-11T08:31:54.783742Z DEBUG project_model::sysroot: Discovering sysroot by "C:\\Users\\pasna\\.cargo\\bin\\rustc.exe" "--print" "sysroot"
2024-07-11T08:31:54.855066Z DEBUG project_model::sysroot: checking sysroot library: C:\Users\pasna\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/src/rust/library
2024-07-11T08:31:54.855568Z INFO project_model::workspace: Using sysroot workspace=C:\Users\pasna\Stepan\Code\Tauri_app\Cargo.toml src_root=Some(AbsPath("C:\\Users\\pasna\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib/rustlib/src/rust/library")) root=Some(AbsPath("C:\\Users\\pasna\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc"))
2024-07-11T08:31:54.855583Z DEBUG project_model::sysroot: checking for rustc source code: C:\Users\pasna\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/rustc-src/rust/compiler/rustc/Cargo.toml
2024-07-11T08:31:54.947691Z DEBUG rustc_cfg::get: project_model::rustc_cfg: rustc cfgs found rustc_cfgs=[Atom("debug_assertions"), Atom("overflow_checks"), KeyValue { key: "panic", value: "unwind" }, KeyValue { key: "relocation_model", value: "pic" }, KeyValue { key: "target_abi", value: "" }, KeyValue { key: "target_arch", value: "x86_64" }, KeyValue { key: "target_endian", value: "little" }, KeyValue { key: "target_env", value: "msvc" }, KeyValue { key: "target_family", value: "windows" }, KeyValue { key: "target_feature", value: "cmpxchg16b" }, KeyValue { key: "target_feature", value: "fxsr" }, KeyValue { key: "target_feature", value: "lahfsahf" }, KeyValue { key: "target_feature", value: "sse" }, KeyValue { key: "target_feature", value: "sse2" }, KeyValue { key: "target_feature", value: "sse3" }, Atom("target_has_atomic"), KeyValue { key: "target_has_atomic", value: "128" }, KeyValue { key: "target_has_atomic", value: "16" }, KeyValue { key: "target_has_atomic", value: "32" }, KeyValue { key: "target_has_atomic", value: "64" }, KeyValue { key: "target_has_atomic", value: "8" }, KeyValue { key: "target_has_atomic", value: "ptr" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "128" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "16" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "32" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "64" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "8" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "ptr" }, Atom("target_has_atomic_load_store"), KeyValue { key: "target_has_atomic_load_store", value: "128" }, KeyValue { key: "target_has_atomic_load_store", value: "16" }, KeyValue { key: "target_has_atomic_load_store", value: "32" }, KeyValue { key: "target_has_atomic_load_store", value: "64" }, KeyValue { key: "target_has_atomic_load_store", value: "8" }, KeyValue { key: "target_has_atomic_load_store", value: "ptr" }, KeyValue { key: "target_os", value: "windows" }, KeyValue { key: "target_pointer_width", value: "64" }, Atom("target_thread_local"), KeyValue { key: "target_vendor", value: "pc" }, Atom("ub_checks"), Atom("windows")]
2024-07-11T08:31:55.010579Z DEBUG project_model::cargo_workspace: Discovering cargo config target by "C:\\Users\\pasna\\.cargo\\bin\\cargo.exe" "-Z" "unstable-options" "config" "get" "build.target"
2024-07-11T08:31:55.054178Z DEBUG project_model::cargo_workspace: Discovering host platform by "C:\\Users\\pasna\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\bin\\rustc.exe" "-vV"
2024-07-11T08:31:55.699290Z DEBUG project_model::env: Discovering cargo config env by "C:\\Users\\pasna\\.cargo\\bin\\cargo.exe" "-Z" "unstable-options" "config" "get" "env"
2024-07-11T08:31:55.760493Z DEBUG ProjectWorkspace::to_crate_graph: project_model::workspace: Did not patch std to depend on cfg-if
2024-07-11T08:31:55.762930Z DEBUG project_model::sysroot: Discovering sysroot by "C:\\Users\\pasna\\.cargo\\bin\\rustc.exe" "--print" "sysroot"
2024-07-11T08:31:55.845708Z DEBUG project_model::sysroot: checking sysroot library: C:\Users\pasna\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/src/rust/library
2024-07-11T08:31:55.846377Z INFO project_model::workspace: Using sysroot workspace=C:\Users\pasna\Stepan\Code\Tauri_app\Cargo.toml src_root=Some(AbsPath("C:\\Users\\pasna\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib/rustlib/src/rust/library")) root=Some(AbsPath("C:\\Users\\pasna\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc"))
2024-07-11T08:31:55.846395Z DEBUG project_model::sysroot: checking for rustc source code: C:\Users\pasna\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/rustc-src/rust/compiler/rustc/Cargo.toml
2024-07-11T08:31:55.959348Z DEBUG rustc_cfg::get: project_model::rustc_cfg: rustc cfgs found rustc_cfgs=[Atom("debug_assertions"), Atom("overflow_checks"), KeyValue { key: "panic", value: "unwind" }, KeyValue { key: "relocation_model", value: "pic" }, KeyValue { key: "target_abi", value: "" }, KeyValue { key: "target_arch", value: "x86_64" }, KeyValue { key: "target_endian", value: "little" }, KeyValue { key: "target_env", value: "msvc" }, KeyValue { key: "target_family", value: "windows" }, KeyValue { key: "target_feature", value: "cmpxchg16b" }, KeyValue { key: "target_feature", value: "fxsr" }, KeyValue { key: "target_feature", value: "lahfsahf" }, KeyValue { key: "target_feature", value: "sse" }, KeyValue { key: "target_feature", value: "sse2" }, KeyValue { key: "target_feature", value: "sse3" }, Atom("target_has_atomic"), KeyValue { key: "target_has_atomic", value: "128" }, KeyValue { key: "target_has_atomic", value: "16" }, KeyValue { key: "target_has_atomic", value: "32" }, KeyValue { key: "target_has_atomic", value: "64" }, KeyValue { key: "target_has_atomic", value: "8" }, KeyValue { key: "target_has_atomic", value: "ptr" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "128" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "16" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "32" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "64" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "8" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "ptr" }, Atom("target_has_atomic_load_store"), KeyValue { key: "target_has_atomic_load_store", value: "128" }, KeyValue { key: "target_has_atomic_load_store", value: "16" }, KeyValue { key: "target_has_atomic_load_store", value: "32" }, KeyValue { key: "target_has_atomic_load_store", value: "64" }, KeyValue { key: "target_has_atomic_load_store", value: "8" }, KeyValue { key: "target_has_atomic_load_store", value: "ptr" }, KeyValue { key: "target_os", value: "windows" }, KeyValue { key: "target_pointer_width", value: "64" }, Atom("target_thread_local"), KeyValue { key: "target_vendor", value: "pc" }, Atom("ub_checks"), Atom("windows")]
2024-07-11T08:31:56.025356Z DEBUG project_model::cargo_workspace: Discovering cargo config target by "C:\\Users\\pasna\\.cargo\\bin\\cargo.exe" "-Z" "unstable-options" "config" "get" "build.target"
2024-07-11T08:31:56.065491Z DEBUG project_model::cargo_workspace: Discovering host platform by "C:\\Users\\pasna\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\bin\\rustc.exe" "-vV"
2024-07-11T08:31:56.654034Z DEBUG project_model::env: Discovering cargo config env by "C:\\Users\\pasna\\.cargo\\bin\\cargo.exe" "-Z" "unstable-options" "config" "get" "env"
2024-07-11T08:31:56.718010Z DEBUG ProjectWorkspace::to_crate_graph: project_model::workspace: Did not patch std to depend on cfg-if
2024-07-11T08:31:56.720052Z DEBUG project_model::sysroot: Discovering sysroot by "C:\\Users\\pasna\\.cargo\\bin\\rustc.exe" "--print" "sysroot"
2024-07-11T08:31:56.805295Z DEBUG project_model::sysroot: checking sysroot library: C:\Users\pasna\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/src/rust/library
2024-07-11T08:31:56.805781Z INFO project_model::workspace: Using sysroot workspace=C:\Users\pasna\Stepan\Code\Tauri_app\Cargo.toml src_root=Some(AbsPath("C:\\Users\\pasna\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib/rustlib/src/rust/library")) root=Some(AbsPath("C:\\Users\\pasna\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc"))
2024-07-11T08:31:56.805795Z DEBUG project_model::sysroot: checking for rustc source code: C:\Users\pasna\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/rustc-src/rust/compiler/rustc/Cargo.toml
2024-07-11T08:31:56.904145Z DEBUG rustc_cfg::get: project_model::rustc_cfg: rustc cfgs found rustc_cfgs=[Atom("debug_assertions"), Atom("overflow_checks"), KeyValue { key: "panic", value: "unwind" }, KeyValue { key: "relocation_model", value: "pic" }, KeyValue { key: "target_abi", value: "" }, KeyValue { key: "target_arch", value: "x86_64" }, KeyValue { key: "target_endian", value: "little" }, KeyValue { key: "target_env", value: "msvc" }, KeyValue { key: "target_family", value: "windows" }, KeyValue { key: "target_feature", value: "cmpxchg16b" }, KeyValue { key: "target_feature", value: "fxsr" }, KeyValue { key: "target_feature", value: "lahfsahf" }, KeyValue { key: "target_feature", value: "sse" }, KeyValue { key: "target_feature", value: "sse2" }, KeyValue { key: "target_feature", value: "sse3" }, Atom("target_has_atomic"), KeyValue { key: "target_has_atomic", value: "128" }, KeyValue { key: "target_has_atomic", value: "16" }, KeyValue { key: "target_has_atomic", value: "32" }, KeyValue { key: "target_has_atomic", value: "64" }, KeyValue { key: "target_has_atomic", value: "8" }, KeyValue { key: "target_has_atomic", value: "ptr" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "128" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "16" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "32" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "64" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "8" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "ptr" }, Atom("target_has_atomic_load_store"), KeyValue { key: "target_has_atomic_load_store", value: "128" }, KeyValue { key: "target_has_atomic_load_store", value: "16" }, KeyValue { key: "target_has_atomic_load_store", value: "32" }, KeyValue { key: "target_has_atomic_load_store", value: "64" }, KeyValue { key: "target_has_atomic_load_store", value: "8" }, KeyValue { key: "target_has_atomic_load_store", value: "ptr" }, KeyValue { key: "target_os", value: "windows" }, KeyValue { key: "target_pointer_width", value: "64" }, Atom("target_thread_local"), KeyValue { key: "target_vendor", value: "pc" }, Atom("ub_checks"), Atom("windows")]
2024-07-11T08:31:56.970916Z DEBUG project_model::cargo_workspace: Discovering cargo config target by "C:\\Users\\pasna\\.cargo\\bin\\cargo.exe" "-Z" "unstable-options" "config" "get" "build.target"
2024-07-11T08:31:57.015160Z DEBUG project_model::cargo_workspace: Discovering host platform by "C:\\Users\\pasna\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\bin\\rustc.exe" "-vV"
You likely have, for some reason, the setting "rust-analyzer.rustc.source": "discover"
. Remove it and the error will disappear. This setting is intended for rustc developers, you should not have it set unless you are working on rustc.
The error is not fatal, though; you can continue working on your projects even with it.
If you are working on rustc, you need to install the rustc-dev
rustup component or set that setting to point to the path where your rustc source code is located.