rgoussu@goussu: ~/library/rust/toolchain
~/library/rust/toolchain cat rust-analyzer.md

rust-analyzer — the language server

# The official LSP server — on-the-fly analysis, proc-macro expansion, assists and inlay hints, flychecks via cargo check, and configuration worth knowing.

Conceptsaved 2026-08-09 #rust#tooling#lsp#editor

Overview

rust-analyzer is Rust's single official language server, the analog of gopls: one LSP implementation behind VS Code, Zed, Neovim, Helix and the JetBrains-independent world (RustRover ships JetBrains' own engine — the one notable holdout). It succeeded the original RLS by rebuilding on a lazy, incremental architecture (the salsa query system) instead of shelling out to the compiler, which is what makes IDE-speed feedback possible in a language this expensive to analyze.

Key points

  • Its own front-end, the compiler's judgement: rust-analyzer type-checks with its own lazy engine for latency, and runs cargo check on save ("flycheck") for the authoritative diagnostics — you see both streams, and they occasionally disagree for seconds.
  • Proc macros actually run: derive and attribute macros are expanded in-process via a proc-macro server, so code generated by #[derive(Serialize)], #[tokio::main] or sqlx macros is visible to completion and navigation — the feature that separates it from every previous Rust IDE attempt.
  • Assists are mini-refactors: fill match arms from an enum, extract function/variable, generate impl blocks from a trait, qualify or import paths — the productive surface beyond completion.
  • Inlay hints show elided types, lifetimes and closure captures inline — particularly valuable in Rust where inference hides a lot; toggle rather than disable.
  • rust-analyzer.cargo.features matters more than in other languages: analysis runs under one feature set, so --all-features (or the specific set you work in) decides which cfg-gated code lights up.
  • Big-workspace hygiene: exclude target/ from file watchers, consider check.command = "clippy" to get lints inline, and give it RAM — the index of a large workspace with all deps is GBs.
  • Ships as a rustup component (rustup component add rust-analyzer) but editors commonly bundle or download their own — pin via the toolchain when versions drift.

Related

  • The Rust toolchain — parent catalog.
  • cargocargo check, the flycheck engine behind saved diagnostics.
  • cargo-expand — full-file macro expansion when the inline view isn't enough.
  • gopls — the Go counterpart; same one-official-server model.