lorri icon indicating copy to clipboard operation
lorri copied to clipboard

`RUST_SRC_PATH = "${pkgs.rustc.src}/lib/rustlib/src/rust/src/";` is wrong?

Open dpc opened this issue 3 years ago • 6 comments

pkgs.rustc.src is a

/nix/store/wrxr7nvx9zkhs0sp8rna227n47hyc3fl-rustc-1.51.0-src.tar.gz: gzip compressed data, max compression, original size modulo 2^32 1051570176

rust-analyzer doesn't seem to work with it.

dpc avatar Jul 30 '21 07:07 dpc

Or maybe rust-analyzer is supposed to handle tar.gz files? Well. In that case it doesn't work for me. I tried with mozilla overlay and standalone rust-src and it still doesn't work. Oh well.

dpc avatar Jul 30 '21 07:07 dpc

I don't think it does since it tries to lookup the exact directory to check if it's valid https://github.com/rust-analyzer/rust-analyzer/commit/85db47ac76c383295caee0c1d4284544b761add9

dpc avatar Jul 30 '21 08:07 dpc

After more digging it seems that the root cause is a need for more recnet rust-analyzer than what's available in nixpkgs.

Though that RUST_SRC_PATH indeed seems wrong, and rust-analyzer will just switch to use rustc --print sysroot to detect library source code instead.

dpc avatar Jul 30 '21 08:07 dpc

In recent versions of nixpkgs, rust-analyzer is wrapped to use the right value of this env var, so this could be removed.

symphorien avatar Aug 09 '21 10:08 symphorien

@symphorien I'm not sure if I understand. The main problem that I've seen is that this env var points to a tar file, and rust-analyzer does not seem to support anything like this. I just wanted to point it out to potentially help , and if I'm just confused about something, feel free to close.

dpc avatar Aug 09 '21 19:08 dpc

I meant: rust-analyzer works fine if you remove the env var, because of https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/development/tools/rust/rust-analyzer/wrapper.nix#L14 So I'm in favor of removing this env var.

symphorien avatar Aug 09 '21 20:08 symphorien