rust-lang/rust · error
{:?}
Error message
{:?} What it means
Thrown by rustc_codegen_cranelift while emitting unwind/debug info for a compiled function. After Cranelift produces UnwindInfo for a function, the backend matches on its variants; SystemV, WindowsX64, and WindowsArm64 are handled, and any other variant falls through to unimplemented!("{:?}", unwind_info). It signals that Cranelift emitted an unwind-info format the Rust backend does not yet know how to serialize into .eh_frame / Windows unwind tables.
Source
Thrown at compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs:238
DataId::from_u32(id & !(1 << 31)),
&mut data,
);
data.write_data_addr(reloc.offset, gv, 0);
}
}
};
}
module.define_data(lsda, &data).unwrap();
fde.lsda = Some(address_for_data(lsda));
}
self.frame_table.add_fde(self.cie_id.unwrap(), fde);
}
UnwindInfo::WindowsX64(_) | UnwindInfo::WindowsArm64(_) => {
// Windows does not have debug info for its unwind info.
}
unwind_info => unimplemented!("{:?}", unwind_info),
}
}
pub(crate) fn emit(self, product: &mut ObjectProduct) {
let mut eh_frame = EhFrame::from(super::emit::WriterRelocate::new(self.endian));
self.frame_table.write_eh_frame(&mut eh_frame).unwrap();
if !eh_frame.0.writer.slice().is_empty() {
let id = eh_frame.id();
let section_id = product.add_debug_section(id, eh_frame.0.writer.into_vec());
let mut section_map = FxHashMap::default();
section_map.insert(id, section_id);
let use_section_symbol = product.object.format() != object::BinaryFormat::MachO;
for reloc in &eh_frame.0.relocs {
product.add_debug_reloc(§ion_map, §ion_id, reloc, use_section_symbol);
}
}View on GitHub (pinned to 22057b88b0)
Solutions
- Disable unwind-table generation: build with -C panic=abort and/or -C force-unwind-tables=no to avoid the add_function unwind path entirely.
- Pin the cranelift and rustc_codegen_cranelift versions to a mutually compatible pair (rebuild cg_clif against the cranelift version rustc expects).
- Target a supported OS for unwinding (Linux/SystemV x86_64/aarch64, Windows x86_64/arm64); avoid macOS x86_64 which is already short-circuited.
- Add a match arm for the new UnwindInfo variant in compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs and serialize it accordingly (upstream patch).
Example fix
# before (Cargo.toml / .cargo/config.toml forcing unwinding) [profile.release] panic = "unwind" # RUSTFLAGS = "-C force-unwind-tables=yes" # after - abort path skips unwind-info emission in add_function() [profile.release] panic = "abort"
Defensive patterns
Strategy: fallback
Validate before calling
// Lower debuginfo level to avoid the unimplemented unwind emitter path
// in cg_clif debuginfo.
// .cargo/config.toml or CLI:
// -Cdebuginfo=0 (or 1 instead of 2)
let lvl = std::env::var("RUSTFLAGS").unwrap_or_default();
if lvl.contains("debuginfo=2") && std::env::var("RUSTC_CODEGEN").as_deref() == Ok("cranelift") {
eprintln!("Lower debuginfo to 0/1 under cg_clif to avoid unwind.rs:238 panic.");
} Try / catch
// Compiler panic — uncatchable. Fallback is to drop debuginfo or use LLVM. // In CI, separate the debug build (LLVM) from the fast-check build (cranelift, debuginfo=0).
Prevention
- Use `-Cdebuginfo=0` or `-Cdebuginfo=1` when compiling with cg_clif; full debuginfo (-Cdebuginfo=2) hits unimplemented unwind emission.
- Keep cg_clif for fast check builds only; produce debug/release artifacts with LLVM.
- Report the specific type (`{:?}` placeholder) upstream to expand unwind coverage.
When it happens
Trigger: Compiling a crate with panic=unwind (or -Cforce-unwind-tables=yes) on a target whose Cranelift backend returns an UnwindInfo variant other than SystemV/WindowsX64/WindowsArm64. macOS x86_64 is explicitly skipped earlier in add_function; this panic is for any other unsupported variant - e.g. a new Cranelift release adding an unwind format, or an OS/ABI combination Cranelift emits non-standard info for.
Common situations: Upgrading the cranelift crate / cg_clif component to a version that introduces a new UnwindInfo variant the pinned Rust version doesn't match; targeting an unusual OS (bare-metal, custom RTOS) with unwind tables enabled; mismatched cranelift <-> rustc_codegen_cranelift versions in a source build.
Related errors
- prologue for {:?}
- epilogue for {:?}
- epilogue_noreturn for {:?}
- save_register for {:?}
- restore_register for {:?}
AI-assisted analysis of rust-lang/rust@22057b88b0 (2026-08-03).
Data as JSON: /data/errors/3be41d2560b0cb5b.json.
Report an issue: GitHub.