Skip to content

rust-analyzer +nightly (and similar) should not set LD_LIBRARY_PATH #4245

Description

@jyn514

Problem you are trying to solve

I am trying to reduce the number of spurious rebuilds that occur in rust-lang/rust itself. One such spurious rebuild happens when using rustup-managed rust-analyzer, in which case rustup sets LD_LIBRARY_PATH. See rust-lang/rust#138333 for more details about why that causes issues.

Solution you'd like

Rust-analyzer does not use rustc_private libraries, and my understanding is that their architecture is very specifically designed so that they will never need to (@rust-lang/rust-analyzer, can you confirm?). That means that rustup does not need to set LD_LIBRARY_PATH for that proxy.

In particular, the following should leave LD_LIBRARY_PATH unmodified:

  • rust-analyzer (when rust-analyzer is a rustup-managed toolchain proxy)
  • rust-analyzer +toolchain

these should still add rustc --print target-libdir to LD_LIBRARY_PATH:

  • rustup run toolchain rust-analyzer
  • cargo +nightly (and all other proxies)

Notes

(-zsh@pop-os) ~/src/rust3 spurious-llvm-rebuilds
; git log --oneline -n1 HEAD~
385970f0c1f (upstream/master, upstream/HEAD) Auto merge of #137655 - nnethercote:split-edges-iterator, r=nnethercote
; rustup --version
rustup 1.27.1 (54dd3d00f 2024-04-24)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.87.0-nightly (00f245915 2025-02-26)`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions