Loading
buildRustCrate: remap rustc store path to break rust-src closure leak
When the rust-src component is installed (common with rust-overlay toolchains via rust-toolchain.toml), rustc unvirtualises libstd source paths. Panic locations from monomorphised generic std code (BTreeMap, VecDeque, sync primitives, etc.) then embed the toolchain store path in .rodata, pulling the entire multi-GB toolchain into the runtime closure. This is not an RPATH issue — stdenv's patchelf --shrink-rpath already cleans that. The reference is a core::panic::Location string. Remap the rustc store path to /rustc so panic messages stay readable but no longer create a store-path dependency. This is a no-op for toolchains without rust-src (the prefix simply never matches).