rustc: ensure standard library docs are installed

Fixes #405914

Upstream's installation script installs the `docs` component
for every target that is built.
Unfortunately, installing the docs for a target removes the
previous target's docs, ultimately leaving only the docs
of the last target in the list.
In our case, that is a `no_std` target, for which no `alloc`
or `std` docs are built, thus leaving `rustc.doc` without any
standard library docs.
Moving stdenv's `targetPlatform` to the end of the list ensures
we get standard library docs.

authored by Niklas Korz and committed by Alyssa Ross ffbfd9c8 a765eb64

+8 -4
+8 -4
pkgs/development/compilers/rust/rustc.nix
··· 153 # std is built for all platforms in --target. 154 "--target=${ 155 concatStringsSep "," ( 156 - [ 157 - stdenv.targetPlatform.rust.rustcTargetSpec 158 - ] 159 # Other targets that don't need any extra dependencies to build. 160 - ++ optionals (!fastCross) [ 161 "wasm32-unknown-unknown" 162 "wasm32v1-none" 163 "bpfel-unknown-none" ··· 174 # build.rs scripts. 175 ++ optionals (stdenv.hostPlatform != stdenv.targetPlatform && !fastCross) [ 176 stdenv.hostPlatform.rust.rustcTargetSpec 177 ] 178 ) 179 }"
··· 153 # std is built for all platforms in --target. 154 "--target=${ 155 concatStringsSep "," ( 156 # Other targets that don't need any extra dependencies to build. 157 + optionals (!fastCross) [ 158 "wasm32-unknown-unknown" 159 "wasm32v1-none" 160 "bpfel-unknown-none" ··· 171 # build.rs scripts. 172 ++ optionals (stdenv.hostPlatform != stdenv.targetPlatform && !fastCross) [ 173 stdenv.hostPlatform.rust.rustcTargetSpec 174 + ] 175 + ++ [ 176 + # `make install` only keeps the docs of the last target in the list. 177 + # If the `targetPlatform` is not the last entry, we may end up without 178 + # `alloc` or `std` docs (if the last target is `no_std`). 179 + # More information: https://github.com/rust-lang/rust/issues/140922 180 + stdenv.targetPlatform.rust.rustcTargetSpec 181 ] 182 ) 183 }"