toolchain: install matching rust-analyzer - #1956
toolchain: install matching rust-analyzer#1956irvingouj@Devolutions (irvingoujAtDevolution) wants to merge 1 commit into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Let maintainers know that an action is required on their side
|
There was a problem hiding this comment.
Pull request overview
Adds the toolchain-matched rust-analyzer component for editor compatibility.
Changes:
- Declares
rust-analyzeralongsiderustfmtandclippy. - PR title should be
chore(toolchain): install matching rust-analyzer.
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Keep rust-analyzer aligned with each repository toolchain
The current rust-analyzer extension bundles a server that requires Rust 1.94 or newer. This minimum was raised from 1.78 to 1.94, and the released code sets it to 1.94 at
MINIMUM_SUPPORTED_TOOLCHAIN_VERSION.These repositories intentionally pin older toolchains:
Opening either repository now triggers an incompatible-toolchain warning. This adds the official
rust-analyzercomponent next torustfmtandclippy:The VS Code extension has an explicit toolchain-server selection path. It calls
rustup which rust-analyzeronly whenrust-analyzeris declared in the repository toolchain file. Otherwise, it falls back to its newer bundled server.Why not install rust-analyzer locally?
Installing it is not enough. I already had the Rust 1.90 component installed for Gateway, but the extension did not select it because the repository did not declare it. The alternative is a machine-specific
rust-analyzer.server.path, which every developer and editor would need to maintain separately.Why not downgrade the extension?
The extension version is global, but these Rust versions are repository-specific. Downgrading it for these repositories would also downgrade it for newer Rust workspaces. The extension also updates automatically, so this workaround requires disabling updates or repeatedly downgrading it.
Why not upgrade the Rust toolchains?
That changes the compiler used by each repository and is much broader than fixing editor compatibility. Using the matching analyzer component preserves the existing compiler pins.
Why should an editor tool be declared by the repository?
These toolchain files already declare the repository's development tools through
rustfmtandclippy.rust-analyzeris also an official Rust component. Declaring it keeps the compiler/analyzer pairing in the same place instead of duplicating it in local editor settings.What is the tradeoff?
Rustup installs one additional development component in environments that honor the toolchain file. In return, contributors get a compatible analyzer automatically, without global extension downgrades or per-machine server configuration.