67.9. rust-analyzer-2026.09.21
The Rust language server
| Version | 2026.09.21, release 1 |
| Shelf | devtools — Debuggers, tracers, profilers, analysers, linters, language servers and developer utilities |
| Phase | 40_lang (Languages), 17 of 186 in build order |
| Licence | MIT OR Apache-2.0 |
| Homepage | https://rust-analyzer.github.io/ |
| Build time | 9.0 SBU |
| Installed size | 37.3 MiB in 3 files |
| Recipe | ports/core/devtools/rust-analyzer/kpkgbuild |
About
rust-analyzer is the language server for Rust: an editor starts it and asks it for completion, go-to-definition, type hints, diagnostics and refactorings over the Language Server Protocol. Only the server binary is built (-p rust-analyzer); editors bring their own client.
It reads two things from the rust toolchain at run time, and that port installs both: the standard library’s source under lib/rustlib/src, without which it resolves nothing in std or core and reports a sysroot error, and libexec/rust-analyzer-proc-macro-srv, which expands derive and attribute macros.
Why it is in KDOS
The comment above it in script/phases/40_lang/packages.d/devtools.txt:
Without the rust-src component it cannot load std, and says so only in its log and a server-status warning; ports/core/lang/rust installs that source.
Sources
rust-analyzer-2026.09.21.tar.gz(3.9 MiB)
sha2567bdf8f0d86a99451bb2b04b5d58de08731caab41cd3993cf51256cfb45887618
upstream: https://github.com/rust-lang/rust-analyzer/archive/refs/tags/2026-09-21.tar.gz
archive copy: sources-1/devtools--rust-analyzer-2026.09.21.tar.gzrust-analyzer-vendor-2026.09.21.tar.xz(24.8 MiB)
sha2564db091c82086679801b5aa8b375af4274095ce7683c11cb733b92b28e97c895d
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-1/devtools--rust-analyzer-vendor-2026.09.21.tar.xz
Dependencies
Depends on: rust.
Required by: no port names it.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/40_lang/phase.env && kpkg install rust-analyzer'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/devtools/rust-analyzer.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/devtools/rust-analyzer
echo '7bdf8f0d86a99451bb2b04b5d58de08731caab41cd3993cf51256cfb45887618 rust-analyzer-2026.09.21.tar.gz' | sha256sum -c -
echo '4db091c82086679801b5aa8b375af4274095ce7683c11cb733b92b28e97c895d rust-analyzer-vendor-2026.09.21.tar.xz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/rust-analyzer
SRC=$SRC_ROOT/rust-analyzer-2026.09.21
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf rust-analyzer-2026.09.21.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the recipe’s helpers _tag and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
tar xf $PORT_SRC/${name}-vendor-${version}.tar.xz
export RUSTFLAGS="-C target-feature=-crt-static"
export CARGO_PROFILE_RELEASE_DEBUG=0
export CFG_RELEASE=$version
cargo build --release --frozen --offline -p rust-analyzer --features jemalloc
install -Dm755 target/release/rust-analyzer $PKG/usr/bin/rust-analyzer
The switches, and why each is set:
CARGO_PROFILE_RELEASE_DEBUG=0— Build the release profile with no debug information. The workspace’s own release profile already saysdebug = 0, and the tree’s build environment,script/env/chroot.env, exports the same value to every build; the line restates both.CFG_RELEASE=$version— The version the server reports, compiled in byversion.rs; without it the server calls itself0.0.0. Its build script also treats an unsetCFG_RELEASEas a developer’s build from source and compiles inPOKE_RA_DEVS, which makes the server show internal errors to the editor’s user as pop-up messages.-p rust-analyzer— Build only therust-analyzerpackage of the workspace, the server binary.--features jemalloc— Link the server against jemalloc, compiled from thetikv-jemalloc-syscrate in the vendor bundle, instead of musl’smalloc.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/rust-analyzer, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf rust-analyzer-2026.09.21-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/rust-analyzer, and runs the triggers its paths call for.
Contents
Installed programs: rust-analyzer.
Installed directories: /usr/share/licenses/rust-analyzer.
Notes
The port’s version is the release tag’s date, YYYY.MM.DD; the tag itself is spelled with hyphens, which the recipe’s _tag helper writes, and the source unpacks into rust-analyzer-YYYY-MM-DD.