cross-rs/cross · error
rust-std is not available for
Error message
rust-std is not available for {target} What it means
Warning raised in warn_on_failure after a target build/command fails: the target requested is a builtin target, and rustup reports that the rust-std component (rust-std-{target}) is not available for the selected toolchain. This usually means the target is not installed on that toolchain, so cross reminds the user to add the component before retrying.
Solutions
- Run `rustup target add <target>` for the toolchain in use
- Switch to a toolchain that ships the rust-std component for this target
- If the target genuinely has no rust-std for any toolchain, use a custom target specification JSON with a core built for it
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at src/lib.rs:486 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of cross-rs/cross@8c1a8aa4b6 (2026-09-13).
Data as JSON: /api/errors/e26137483cdc904c.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib.rs:486
pub fn uses_zig(self) -> bool {
self == CommandVariant::Zig
}
pub(crate) fn is_shell(self) -> bool {
self == CommandVariant::Shell
}
}
fn warn_on_failure(
target: &Target,
toolchain: &QualifiedToolchain,
msg_info: &mut MessageInfo,
) -> Result<()> {
let rust_std = format!("rust-std-{target}");
if target.is_builtin() {
let component = rustup::check_component(&rust_std, toolchain, msg_info)?;
if component.is_not_available() {
msg_info.warn(format_args!("rust-std is not available for {target}"))?;
msg_info.note(
format_args!(
r#"you may need to build components for the target via `-Z build-std=<components>` or in your cross configuration specify `target.{target}.build-std`
the available components are core, std, alloc, and proc_macro"#
),
)?;
}
}
Ok(())
}
fn add_libc_version(triple: &str, zig_version: Option<&str>) -> String {
match zig_version {
Some(libc) => format!("{triple}.{libc}"),
None => triple.to_owned(),
}
}
View on GitHub (pinned to 8c1a8aa4b6)