Skip to contentSkip to conversation

remove sysroot assertion in generate_rust_analyzer.py

PATCH Applied Onur Özkan 3 participants 3 messages Dec 24, 2025 – Jan 18

Subsystems (2)
lore
Share & tools
lore

Onur Özkan

author reviewer
#0 lore raw

PATCH 1/1 remove sysroot assertion in generate_rust_analyzer.py

With nixpkgs's rustc, rust-src component is not bundled with the compiler by default and is instead provided from a separate store path, so this assumption does not hold.

The assertion assumes these paths are in the same location which causes make LLVM=1 rust-analyzer to fail on NixOS.

---
 scripts/generate_rust_analyzer.py | 3 ---
 1 file changed, 3 deletions(-)
scripts/generate_rust_analyzer.py +0 -3
index 147d0cc94068..e69fa5e0a9b9 100755
@@ -213,9 +213,6 @@ def main():
         level=logging.INFO if args.verbose else logging.WARNING
     )
 
-    # Making sure that the `sysroot` and `sysroot_src` belong to the same toolchain.
-    assert args.sysroot in args.sysroot_src.parents
-
     rust_project = {
         "crates": generate_crates(args.srctree, args.objtree, args.sysroot_src, args.exttree, args.cfgs, args.core_edition),
         "sysroot": str(args.sysroot),
Signature · 1 line
2.51.2
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · On Wed, 24 Dec 2025 16:53:43 +0300 Onur Özkan <[email protected]> wrote:

With nixpkgs's rustc, rust-src component is not bundled with the compiler by default and is instead provided from a separate store path, so this assumption does not hold.

The assertion assumes these paths are in the same location which causes make LLVM=1 rust-analyzer to fail on NixOS.

I can confirm that the assertion will indeed fail when using nixpkgs's provided rust-src (although rust-overlay is fine).

Quoted 18 lines
---
 scripts/generate_rust_analyzer.py | 3 ---
 1 file changed, 3 deletions(-)
scripts/generate_rust_analyzer.py +0 -3
index 147d0cc94068..e69fa5e0a9b9 100755
@@ -213,9 +213,6 @@ def main():
         level=logging.INFO if args.verbose else logging.WARNING
     )
 
-    # Making sure that the `sysroot` and `sysroot_src` belong to the same toolchain.
-    assert args.sysroot in args.sysroot_src.parents
-
     rust_project = {
         "crates": generate_crates(args.srctree, args.objtree, args.sysroot_src, args.exttree, args.cfgs, args.core_edition),
         "sysroot": str(args.sysroot),
Applied
#2 lore raw
In reply to Onur Özkan
Quoted 10 lines · Onur Özkan

With nixpkgs's rustc, rust-src component is not bundled with the compiler by default and is instead provided from a separate store path, so this assumption does not hold.

The assertion assumes these paths are in the same location which causes make LLVM=1 rust-analyzer to fail on NixOS.

Applied to rust-fixes -- thanks everyone!

Fixes fe992163575b ("rust: Support latest version of `rust-analyzer`")

[ Reworded title. - Miguel ]

Cheers,
Miguel