rust-lang/rust · error
This rustc version was not built with LLVM Offload support!
Error message
This rustc version was not built with LLVM Offload support!
What it means
This `unimplemented!()` panic comes from the `Offload_fallback` module (ffi.rs:1745-1756), which is compiled only when rustc is built WITHOUT the `llvm_offload` cargo feature. The fallback stub `LLVMRustBundleImages` exists so non-offload rustc builds still link, but if the codegen path reaches it (e.g. to bundle device images into a host module for GPU offloading) it panics, because the real LLVM offload wrapper is absent. It signals that the binary was built without GPU offload support yet an offload operation was requested.
Source
Thrown at compiler/rustc_codegen_llvm/src/llvm/ffi.rs:1755
);
}
}
#[cfg(not(feature = "llvm_offload"))]
pub(crate) use self::Offload_fallback::*;
#[cfg(not(feature = "llvm_offload"))]
mod Offload_fallback {
use super::*;
/// Processes the module and writes it in an offload compatible way into a "device.bin" file.
/// Marked as unsafe to match the real offload wrapper which is unsafe due to FFI.
#[allow(unused_unsafe)]
pub(crate) unsafe fn LLVMRustBundleImages<'a>(
_M: &'a Module,
_TM: &'a TargetMachine,
_device_bin: *const c_char,
) -> bool {
unimplemented!("This rustc version was not built with LLVM Offload support!");
}
pub(crate) unsafe fn LLVMRustOffloadEmbedBufferInModule<'a>(
_M: &'a Module,
_device_bin: *const c_char,
) -> bool {
unimplemented!("This rustc version was not built with LLVM Offload support!");
}
#[allow(unused_unsafe)]
pub(crate) unsafe fn LLVMRustOffloadMapper<'a>(
_OldFn: &'a Value,
_NewFn: &'a Value,
_RebuiltArgs: *const &Value,
) {
unimplemented!("This rustc version was not built with LLVM Offload support!");
}
}
// FFI bindings for `DIBuilder` functions in the LLVM-C API.View on GitHub (pinned to 22057b88b0)
Solutions
- Build rustc with the offload feature enabled (pass the feature to the rustc_llvm/rustc_codegen_llvm build) and link an LLVM built with offload support.
- Use a rustc distribution that explicitly ships offload support if one is available for your target.
- Remove the offload-triggering flags/target and compile for the host CPU instead.
- Verify with `rustc --version --verbose` and the build configuration that offload was actually compiled in.
Example fix
// before rustc -Zoffload --target=nvptx64-nvidia-cuda kernel.rs # stock toolchain // after ./x.py build --features llvm_offload # rebuild rustc, then: rustc -Zoffload --target=nvptx64-nvidia-cuda kernel.rs
Defensive patterns
Strategy: validation
Validate before calling
# LLVMRustBundleImages panics unless rustc was compiled with the
# `llvm_offload` cargo feature. Detect the capability before requesting
# offload bundling (e.g. -Zoffload, offload-only crate types).
rustc --print=cfg 2>/dev/null | grep -q '^target_feature="offload"$' \
&& { echo 'offload supported'; exit 0; }
# No target_feature=offload => bundling will hit the unimplemented! fallback.
if cargo rustc -- --help 2>/dev/null | grep -q -- '-Zoffload'; then
echo 'NOTE: -Zoffload flag present, but this rustc has no LLVM offload backend' >&2
fi
exit 0 Try / catch
out="$(cargo build 2>&1)"; rc=$?
if [ $rc -ne 0 ]; then
case "$out" in
*"not built with LLVM Offload support"*)
echo "requested offload bundling but rustc was built without the llvm_offload feature" >&2
echo "fix: build rustc with --set llvm.rust-offload=true, or drop -Zoffload/offload targets" >&2 ;;
*) echo "$out" >&2 ;;
esac
exit $rc
fi Prevention
- Check `rustc --print=cfg | grep offload` before enabling any offload-related flag.
- Only request offload on a rustc built from source with the `llvm_offload` cargo feature.
- Gate offload code paths behind a build-script cfg probe so non-offload toolchains skip them.
- Document the required custom toolchain in your project README; stock rustup builds do not include offload.
- Avoid pinning offload in CI without first asserting the runner's rustc has the feature.
When it happens
Trigger: Compiling with `-Ctarget-cpu`/offload flags or targeting a GPU architecture (nvptx/amdgpu offload, `-Zoffload`, or an offload bundler call) on a rustc built without `--features llvm_offload`. The panic fires inside the `LLVMRustBundleImages` fallback when codegen attempts to bundle device binary into the module.
Common situations: A stock rustc release that does not ship offload support; building rustc with `./x.py build` without enabling the `llvm_offload` feature; trying to compile CUDA/HIP offload code on a default toolchain.
Related errors
- Architecture {arch} does not support GpuKernel calling conve
- LLVM does not have support for cleanuppad
- LLVM does not have support for cleanupret
- LLVM does not have support for catchpad
- LLVM does not have support for catchswitch
AI-assisted analysis of rust-lang/rust@22057b88b0 (2026-08-03).
Data as JSON: /data/errors/025990065fcd0c41.json.
Report an issue: GitHub.