skip to content
Wentao Zhang

vscode rust-analyzer 提示 Failed to spawn one or more proc-macro servers.

/ 1 min read

vscode rust-analyzer 提示 Failed to spawn one or more proc-macro servers.

Mac os 环境下 安装好rust环境,使用vscoderust-analyzer报错

Terminal window
Failed to spawn one or more proc-macro servers.
- cannot find proc-macro-srv, the workspace `/Users/xxxx/vscode/rust/guessing_game` is missing a sysroot
Failed to find sysroot for Cargo.toml file /Users/xxxx/vscode/rust/guessing_game/Cargo.toml. Is rust-src installed? can't load standard library from sysroot
/Users/xxxx/.rustup/toolchains/stable-x86_64-apple-darwin
(discovered via `rustc --print sysroot`)
try installing the Rust source the same way you installed rustc

解决方案

Terminal window
# 安装 rust-src
sudo rustup component add rust-src

vscode 中重启一下rust-analyzer插件之后就能解决。