rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
13.98k stars 1.55k forks source link

Rust-analyzer: Failed to load workspace. #17583

Open TaelinSu opened 1 month ago

TaelinSu commented 1 month ago

rust-analyzer version: 0.3.2029-standalone (a5b21ea0a 2024-07-07) [c:\Users\Ninephoenix.vscode\extensions\rust-lang.rust-analyzer-0.3.2029-win32-x64\server\rust-analyzer.exe]

rustc version: rustc 1.79.0 (129f3b996 2024-06-10)

editor or extension:

repository link: rustdesk

reproduce the problem:

git clone https://github.com/rustdesk/rustdesk.git
code rustdesk

When I open rustdesk project in VSCode or Zed, the rust-analyzer keeps showing Fetching metadata for a long time:

image

Finally it shows Failed to load workspace.:

image

2024-07-12T07:30:49.173332Z ERROR rust_analyzer::main_loop: FetchWorkspaceError:
rust-analyzer failed to load workspace: Failed to load the project at C:\Users\Ninephoenix\Codes\rustdesk\Cargo.toml: Failed to read Cargo metadata from Cargo.toml file C:\Users\Ninephoenix\Codes\rustdesk\Cargo.toml, Some(Version { major: 1, minor: 79, patch: 0 }): Failed to run `"C:\\Users\\Ninephoenix\\.cargo\\bin\\cargo.exe" "metadata" "--format-version" "1" "--manifest-path" "C:\\Users\\Ninephoenix\\Codes\\rustdesk\\Cargo.toml" "--filter-platform" "x86_64-pc-windows-msvc"`: `cargo metadata` exited with an error:  Downloading crates ...
  Downloaded rustls-native-certs v0.6.3
  Downloaded rustls-pemfile v1.0.4
  Downloaded rustversion v1.0.17
  Downloaded dasp_peak v0.11.0
  Downloaded memalloc v0.1.0
  Downloaded strum v0.24.1
  Downloaded windows-implement v0.52.0
  Downloaded windows-version v0.1.1
  Downloaded wol-rs v1.0.1
  Downloaded target_build_utils v0.3.1
  Downloaded windows-result v0.1.2
  Downloaded tokio-macros v2.3.0
  Downloaded vec_map v0.8.2
  Downloaded windows-interface v0.52.0
  Downloaded phf_generator v0.7.24
  Downloaded schannel v0.1.23
  Downloaded thiserror-impl v1.0.61
  Downloaded shared_memory v0.12.4
  Downloaded system_shutdown v4.0.1
  Downloaded phf v0.7.24
  Downloaded dasp_envelope v0.11.0
  Downloaded utf8parse v0.2.2
  Downloaded whoami v1.5.1
  Downloaded winres v0.1.12
  Downloaded tokio-socks v0.5.1
  Downloaded unicode-xid v0.1.0
  Downloaded textwrap v0.11.0
  Downloaded totp-rs v5.5.1
  Downloaded dasp v0.11.0
  Downloaded md5 v0.7.0
  Downloaded sct v0.7.1
  Downloaded phf_shared v0.7.24
  Downloaded tokio-rustls v0.24.1
  Downloaded socket2 v0.3.19
  Downloaded unicode-script v0.5.6
  Downloaded serde_json v0.9.10
  Downloaded constant_time_eq v0.2.6
  Downloaded uuid v1.9.1
  Downloaded tauri-winrt-notification v0.1.3
  Downloaded tempfile v3.10.1
  Downloaded http-body v0.4.6
  Downloaded num-traits v0.1.43
  Downloaded cfg-if v0.1.10
  Downloaded base32 v0.4.0
  Downloaded serde v0.9.15
  Downloaded tinyvec v1.6.1
  Downloaded rand_chacha v0.1.1
  Downloaded crossbeam-queue v0.3.11
  Downloaded inout v0.1.3
  Downloaded rpassword v7.3.1
  Downloaded anstyle-query v1.1.0
  Downloaded anstyle v1.0.7
  Downloaded enum-map-derive v0.17.0
  Downloaded errno v0.3.9
  Downloaded rtoolbox v0.0.2
  Downloaded rpassword v2.1.0
  Downloaded mac_address v1.1.7
  Downloaded runas v1.2.0
  Downloaded dasp_frame v0.11.0
  Downloaded itoa v0.3.4
  Downloaded dpi v0.1.1
  Downloaded serde_json v1.0.118
  Downloaded anstyle-wincon v3.0.3
  Downloaded ctrlc v3.4.4
  Downloaded rand_jitter v0.1.4
  Downloaded clap_lex v0.7.1
  Downloaded lazy_static v1.5.0
  Downloaded clipboard-win v5.3.1
  Downloaded futures-executor v0.3.30
  Downloaded either v1.13.0
  Downloaded rgb v0.8.40
  Downloaded cidr-utils v0.5.11
  Downloaded ed25519 v1.5.3
  Downloaded syn v2.0.68
  Downloaded qrcodegen v1.8.0
  Downloaded autocfg v1.3.0
  Downloaded html-escape v0.2.13
  Downloaded dtoa v0.4.8
  Downloaded quote v0.6.13
  Downloaded byteorder v1.5.0
  Downloaded dasp_signal v0.11.0
  Downloaded filetime v0.2.23
  Downloaded raw-window-handle v0.6.2
  Downloaded enum-map v2.7.3
  Downloaded anstyle-parse v0.2.4
  Downloaded crossbeam-deque v0.8.5
  Downloaded default-net v0.14.1
  Downloaded fon v0.6.0
  Downloaded kernel32-sys v0.2.2
  Downloaded ipnet v2.9.0
  Downloaded hyper-rustls v0.24.2
  Downloaded async-trait v0.1.80
  Downloaded docopt v1.1.1
  Downloaded rustc-demangle v0.1.24
  Downloaded bitflags v2.6.0
  Downloaded clang-sys v1.8.1
  Downloaded httparse v1.9.4
  Downloaded env_logger v0.10.2
  Downloaded dlopen v0.1.8
  Downloaded getrandom v0.2.15
  Downloaded hound v3.5.1
  Downloaded crossbeam-utils v0.8.20
  Downloaded crossbeam-epoch v0.9.18
  Downloaded anyhow v1.0.86
  Downloaded bytemuck v1.16.1
  Downloaded futures v0.3.30
  Downloaded bytes v1.6.0
  Downloaded allocator-api2 v0.2.18
  Downloaded clap v4.5.8
  Downloaded protobuf-codegen v3.5.0
  Downloaded roxmltree v0.20.0
  Downloaded rayon-core v1.12.1
  Downloaded protobuf-parse v3.5.0
  Downloaded resvg v0.42.0
  Downloaded flate2 v1.0.30
  Downloaded base64 v0.22.1
  Downloaded cc v1.0.102
  Downloaded backtrace v0.3.73
  Downloaded crossbeam-channel v0.5.13
  Downloaded http v0.2.12
  Downloaded async-compression v0.4.11
  Downloaded cpal v0.15.3
  Downloaded aes v0.8.4
  Downloaded h2 v0.3.26
  Downloaded aho-corasick v1.1.3
  Downloaded rayon v1.10.0
  Downloaded hyper v0.14.29
  Downloaded clap v2.34.0
  Downloaded bindgen v0.59.2
  Downloaded brotli-decompressor v2.5.1
  Downloaded flexi_logger v0.27.4
  Downloaded regex v1.10.5
  Downloaded rustls v0.21.12
  Downloaded regex-syntax v0.8.4
  Downloaded rustix v0.38.34
warning: spurious network error (3 tries remaining): [92] Stream error in the HTTP/2 framing layer (HTTP/2 stream 61 was not closed cleanly: PROTOCOL_ERROR (err 1))
warning: spurious network error (3 tries remaining): [92] Stream error in the HTTP/2 framing layer (HTTP/2 stream 59 was not closed cleanly: PROTOCOL_ERROR (err 1))
warning: spurious network error (2 tries remaining): [92] Stream error in the HTTP/2 framing layer (HTTP/2 stream 201 was not closed cleanly: PROTOCOL_ERROR (err 1))
  Downloaded windows v0.51.1
warning: spurious network error (2 tries remaining): [92] Stream error in the HTTP/2 framing layer (HTTP/2 stream 203 was not closed cleanly: PROTOCOL_ERROR (err 1))
warning: spurious network error (1 tries remaining): [55] Failed sending data to the peer (Failed receiving HTTP2 data: 56(Failure when receiving data from the peer))
warning: spurious network error (1 tries remaining): [56] Failure when receiving data from the peer (Recv failure: Connection was reset)
error: failed to download from `https://static.crates.io/crates/windows/0.32.0/download`

Caused by:
  [6] Couldn't resolve host name (Send failure: Connection was reset)
lnicola commented 1 month ago

Sounds like a network connectivity issue. Try running cargo metadata in a Console before opening the project.