Skip to main content

nightly_toolchain_with_rust_src

Function nightly_toolchain_with_rust_src 

Source
pub async fn nightly_toolchain_with_rust_src(host: &Host) -> Result<String>
Expand description

A nightly toolchain that can compile the standard library from source.

-Zbuild-std needs a nightly cargo and the rust-src component. The Android preview needs both: the only shared libstd rustup ships is 4 KB-aligned, and a device with 16 KB pages refuses to map it, so the preview runtime builds std itself under the page-size link flag.

The choice is deterministic โ€” the plain nightly channel first, then the newest dated nightly โ€” because the support app and the preview module are separate Cargo invocations that must land on the same libstd-<hash>.so.

ยงErrors

Returns an error when no nightly toolchain is installed, or when the selected toolchain lacks rust-src โ€” the error names the exact rustup component add command rather than mutating the toolchain silently.