rust-analyzer Overview
Purpose and Scope
rust-analyzer is the Rust project’s first-party editor support story: it is the tool users meet when they want completions, go-to-definition, inline diagnostics, refactorings, and other IDE-style feedback while writing Rust. In the repository-level introduction, rust-analyzer is listed alongside Cargo, rustfmt, and Clippy as part of Rust’s productivity-oriented tooling, specifically as the editor-support component. That placement matters because rust-analyzer is not a tutorial, package manager, formatter, or linter; it is the bridge between Rust source code and interactive development environments. Sources: README.md
This overview is intentionally reader-oriented rather than an implementation reference. It explains where rust-analyzer fits in the Rust documentation and tooling landscape, then maps that position to the source evidence available in this repository slice. The concrete files provided for this page primarily show how Rust maintains book-style documentation for unstable language and compiler topics, including generated summaries and per-feature pages. That evidence is useful for understanding the documentation conventions around Rust tools, even though it does not expose rust-analyzer’s own language-server source. Sources: src/tools/unstable-book-gen/src/main.rs, src/doc/unstable-book/src/language-features.md
Official Rust learning material is arranged as navigable books and guides: The Rust Programming Language for conceptual learning, Rust By Example for runnable examples, and other specialized books for domains such as embedded development. rust-analyzer’s user-facing documentation follows the same expectation: a reader should be able to start with installation and editor setup, then move into configuration, features, diagnostics, non-Cargo projects, and troubleshooting. Treat this page as the entry point into that family of rust-analyzer topics rather than as a replacement for the detailed setup or configuration pages.
Relevant Source Files
- README.md — positions rust-analyzer as Rust’s editor-support tool within the broader productivity tooling set that also includes Cargo, rustfmt, and Clippy.
- src/tools/unstable-book-gen/src/main.rs — shows how Rust repository documentation can be generated from feature metadata and section files, including summary construction for book-style navigation.
- src/doc/unstable-book/src/language-features.md — provides the top-level unstable-book language-features section, illustrating the concise section landing-page pattern used by Rust documentation books.
- src/doc/unstable-book/src/language-features/lang-items.md — demonstrates a full explanatory reference page with feature framing, examples, and links back to compiler concepts.
- src/doc/unstable-book/src/compiler-flags/external-clangrt.md — shows a compact compiler-flag documentation page that explains a specific command-line-facing option and points to related material.
- src/doc/unstable-book/src/language-features/abi-cmse-nonsecure-call.md — provides an example of architecture-specific feature documentation with target constraints, behavior, and emitted-assembly context.
- src/doc/unstable-book/src/language-features/abi-msp430-interrupt.md — provides another target-specific ABI feature page, showing how Rust docs describe special calling conventions with minimal examples.
How rust-analyzer Fits into Rust Tooling
The repository README frames Rust around performance, reliability, and productivity. In that productivity list, Cargo handles package management and builds, rustfmt handles formatting, Clippy handles linting, and rust-analyzer handles editor support. This division gives readers a practical mental model: rust-analyzer complements the command-line compiler and package workflow rather than replacing them. It is the interactive layer that helps developers understand code while they type, while rustc remains the compiler and Cargo remains the usual project driver. Sources: README.md
Because rust-analyzer sits at the editor boundary, its documentation is usually consumed by two groups. The first group is Rust developers configuring an editor and trying to understand features such as diagnostics, assists, completion, or workspace discovery. The second group is tool integrators who need to know what behavior is configurable and where language-server capabilities meet editor-specific settings. The overview page should therefore orient both audiences before sending them to installation, editor setup, configuration, feature, non-Cargo project, and troubleshooting pages.
The supplied Rust documentation evidence reinforces a broader principle: Rust’s official documentation does not put every reader task into one monolithic manual. The Book teaches the language, Rust By Example offers runnable examples, and specialized books handle specialized domains. rust-analyzer documentation should be read in that same way. Start with the task you are trying to complete, such as installing the binary or making an editor understand a workspace, then move toward more precise reference material when configuration or troubleshooting requires it.
Documentation Book Structure
The requested source paths show the Rust repository’s unstable-book machinery, which is a good example of how a Rust documentation book is assembled from many focused pages. The generator collects language features, library features, compiler flags, and compiler environment variables, then writes summary content that links each item into the book. The result is a navigable structure where generated stubs can coexist with hand-written pages. Sources: src/tools/unstable-book-gen/src/main.rs
That structure is relevant to rust-analyzer readers because it mirrors how technical documentation should be approached: a book entry point provides orientation, summary navigation provides discoverability, and individual pages explain specific concepts or tasks. For rust-analyzer, this means an overview page should not attempt to explain every editor feature. It should define the tool’s role, name the major documentation areas, and clarify which page to read next depending on whether the reader is installing, configuring, using assists, supporting a non-Cargo build, or debugging a broken editor integration.
The unstable-book examples also show two useful page styles. A full feature page such as lang_items explains the feature’s purpose, compiler relationship, concrete examples, and related implementation locations. A compact flag page such as external-clangrt documents a narrower command-line option and points to adjacent documentation for context. rust-analyzer documentation benefits from the same split: feature overview pages should explain user-visible behavior, while reference pages should name concrete options, commands, or settings without burying the reader in unrelated background. Sources: src/doc/unstable-book/src/language-features/lang-items.md, src/doc/unstable-book/src/compiler-flags/external-clangrt.md
The ABI feature pages demonstrate another important documentation convention: when behavior depends on targets, architectures, or calling conventions, the page should say so directly and include a minimal example. The cmse-nonsecure-call page ties its ABI to Armv8-M TrustZone-M behavior and describes the compiler actions involved in such a call. The msp430-interrupt page ties its ABI to interrupt-handler calling conventions. For rust-analyzer, the analogous lesson is that editor, project-model, and workspace limitations should be documented as conditions, not as vague warnings. Sources: src/doc/unstable-book/src/language-features/abi-cmse-nonsecure-call.md, src/doc/unstable-book/src/language-features/abi-msp430-interrupt.md
System-to-Code Mapping
At the repository level, rust-analyzer is part of the same first-party tooling constellation as Cargo, rustfmt, and Clippy. That establishes the “system” side of the mapping: Rust developers use a compiler for final compilation, a package manager for project orchestration, and editor tooling for fast feedback while editing. The code slice supplied here does not include rust-analyzer’s language-server crates, so the code mapping for this page is limited to documentation infrastructure and repository positioning rather than LSP internals. Sources: README.md
The documentation-infrastructure side is concrete. The unstable-book generator imports feature collection utilities, gathers section filenames, computes unstable feature names, formats summary entries, and writes generated Markdown files. Those operations show a repeatable source-to-docs pipeline: source metadata and existing section files are collected, missing pages are generated from templates, and a summary file is produced to make the book navigable. Sources: src/tools/unstable-book-gen/src/main.rs
For a rust-analyzer documentation set, the corresponding conceptual pipeline is similar even if the implementation files differ. A book needs a landing page, topical pages, and references that reflect the actual capabilities exposed to users. Installation content should answer how to get the binary. Editor pages should explain how the language server is connected to VS Code and other editors. Configuration pages should describe settings and their effects. Feature pages should explain completions, diagnostics, assists, and navigation. Troubleshooting pages should help readers distinguish editor setup problems from project-model problems.
The provided unstable-book pages also demonstrate how Rust documentation keeps user-facing examples close to precise compiler terminology. The lang_items page defines what a language item is before listing examples such as operator traits, panicking, unwinding, marker traits, and allocation. That sequencing is the right model for rust-analyzer docs too: define terms like language server, workspace, diagnostics, assists, and project model before expecting readers to act on configuration or troubleshooting instructions. Sources: src/doc/unstable-book/src/language-features/lang-items.md
Reader Path Through the rust-analyzer Pages
If you are new to rust-analyzer, start by treating it as editor support for Rust rather than as a separate Rust compiler. Install Rust and build or open a Rust project as usual, then use the rust-analyzer installation page to make sure the language-server binary is available to your editor. After that, read the editor-integration page for your environment. VS Code users usually want the VS Code path first, while users of other editors should look for the integration that explains how their editor launches or connects to the language server.
Once the server is installed and the editor can start it, the next useful page is configuration. Configuration is where users move from “it runs” to “it matches my project.” A Rust workspace can have multiple crates, conditional compilation, target-specific code, generated code, or nonstandard build steps. The overview should prepare readers for that reality without implying that every setting is required. Most users should begin with defaults, then change settings only when they have a concrete need such as a non-Cargo project, a target-specific workspace, or a diagnostic behavior they want to tune.
After configuration, feature documentation becomes more valuable. Diagnostics explain what rust-analyzer can report while editing. Assists describe code actions and refactorings. Navigation, completion, and symbol search explain how the editor understands the structure of a Rust codebase. The unstable-book examples show why feature pages should include concrete examples and constraints rather than only a catalog of names: readers need to understand when a capability applies, what input it expects, and what output or editor behavior they should see. Sources: src/doc/unstable-book/src/language-features/abi-msp430-interrupt.md
Troubleshooting should be the last stop in the normal path but the first stop when editor feedback disappears, becomes stale, or does not match command-line builds. The practical question is usually whether the editor integration launched the right binary, whether rust-analyzer discovered the intended workspace, whether Cargo metadata or project configuration is available, and whether diagnostics are coming from rust-analyzer, rustc, or another tool. Keeping these concerns separate helps users avoid treating every editor problem as a compiler problem.
Next Steps
Read the rust-analyzer installation page when the immediate task is obtaining or updating the language-server binary. Read the VS Code and editors page when the binary exists but the editor needs integration details. Read the configuration page when rust-analyzer starts but does not match the project’s workspace, target, or diagnostic expectations. Read the features, diagnostics, and assists page to understand day-to-day editor behavior, and read the non-Cargo projects page if the project cannot be described by Cargo metadata alone.
The broader Rust documentation ecosystem remains relevant while learning rust-analyzer. The Book is the right place for language concepts, Rust By Example is useful for quick runnable examples, and specialized books such as the embedded guide help with domain-specific constraints. rust-analyzer works best when paired with that ecosystem: it gives immediate feedback in the editor, while the books and references explain the language, library, and platform concepts behind that feedback.