From 8eb3c82575d6ea29bb031db9ac450847d73069f9 Mon Sep 17 00:00:00 2001 From: Lily Ballard Date: Wed, 15 Apr 2026 21:28:26 -0700 Subject: [PATCH] rustPlatform.rust: undeprecate These attributes were deprecated in #230951 because they confused things with splicing, e.g. passing `rustPlatform.rust.rustc` to `nativeBuildInputs` would get the wrong derivation when cross-compiling. This was a consequence of the fact that they come from the buildPackages set. But we still want to expose these packages as otherwise Rust packages have no way to reference the rustc and cargo that build them, which means they can't e.g. use `disallowedReferences` to ensure they don't end up in the runtime closure. Just as `stdenv.cc` itself isn't spliced, we can solve this problem by unsplicing the packages. --- .../compilers/rust/make-rust-platform.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/rust/make-rust-platform.nix b/pkgs/development/compilers/rust/make-rust-platform.nix index 1f69bb92e213..254ae918bbf6 100644 --- a/pkgs/development/compilers/rust/make-rust-platform.nix +++ b/pkgs/development/compilers/rust/make-rust-platform.nix @@ -72,14 +72,16 @@ maturinBuildHook bindgenHook ; + + # Let packages reference the build derivations, e.g. for disallowedReferences. + # Get rid of the splicing though, so `nativeBuildInputs = [ rustPlatform.rust.rustc ]` works. + rust = { + rustc = rustc.__spliced.hostTarget or rustc; + cargo = cargo.__spliced.hostTarget or cargo; + }; }; }) // lib.optionalAttrs config.allowAliases { - rust = { - rustc = lib.warn "rustPlatform.rust.rustc is deprecated. Use rustc instead." rustc; - cargo = lib.warn "rustPlatform.rust.cargo is deprecated. Use cargo instead." cargo; - }; - # Added in 25.05. fetchCargoTarball = throw "`rustPlatform.fetchCargoTarball` has been removed in 25.05, use `rustPlatform.fetchCargoVendor` instead"; }