{"id":"3be41d2560b0cb5b","repo":"rust-lang/rust","slug":"error","errorCode":null,"errorMessage":"{:?}","messagePattern":"\\{:\\?\\}","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs","lineNumber":238,"sourceCode":"                                        DataId::from_u32(id & !(1 << 31)),\n                                        &mut data,\n                                    );\n                                    data.write_data_addr(reloc.offset, gv, 0);\n                                }\n                            }\n                        };\n                    }\n\n                    module.define_data(lsda, &data).unwrap();\n                    fde.lsda = Some(address_for_data(lsda));\n                }\n\n                self.frame_table.add_fde(self.cie_id.unwrap(), fde);\n            }\n            UnwindInfo::WindowsX64(_) | UnwindInfo::WindowsArm64(_) => {\n                // Windows does not have debug info for its unwind info.\n            }\n            unwind_info => unimplemented!(\"{:?}\", unwind_info),\n        }\n    }\n\n    pub(crate) fn emit(self, product: &mut ObjectProduct) {\n        let mut eh_frame = EhFrame::from(super::emit::WriterRelocate::new(self.endian));\n        self.frame_table.write_eh_frame(&mut eh_frame).unwrap();\n\n        if !eh_frame.0.writer.slice().is_empty() {\n            let id = eh_frame.id();\n            let section_id = product.add_debug_section(id, eh_frame.0.writer.into_vec());\n            let mut section_map = FxHashMap::default();\n            section_map.insert(id, section_id);\n\n            let use_section_symbol = product.object.format() != object::BinaryFormat::MachO;\n            for reloc in &eh_frame.0.relocs {\n                product.add_debug_reloc(&section_map, &section_id, reloc, use_section_symbol);\n            }\n        }","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/rust-lang/rust/blob/22057b88b091743bc0fd8d592a9264f0a6951403/compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs#L220-L256","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"# before (Cargo.toml / .cargo/config.toml forcing unwinding)\n[profile.release]\npanic = \"unwind\"\n# RUSTFLAGS = \"-C force-unwind-tables=yes\"\n\n# after - abort path skips unwind-info emission in add_function()\n[profile.release]\npanic = \"abort\"","handlingStrategy":"fallback","validationCode":"// Lower debuginfo level to avoid the unimplemented unwind emitter path\n// in cg_clif debuginfo.\n// .cargo/config.toml or CLI:\n//   -Cdebuginfo=0   (or 1 instead of 2)\nlet lvl = std::env::var(\"RUSTFLAGS\").unwrap_or_default();\nif lvl.contains(\"debuginfo=2\") && std::env::var(\"RUSTC_CODEGEN\").as_deref() == Ok(\"cranelift\") {\n    eprintln!(\"Lower debuginfo to 0/1 under cg_clif to avoid unwind.rs:238 panic.\");\n}","typeGuard":null,"tryCatchPattern":"// Compiler panic — uncatchable. Fallback is to drop debuginfo or use LLVM.\n// In CI, separate the debug build (LLVM) from the fast-check build (cranelift, debuginfo=0).","preventionTips":["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."],"tags":["rustc","cranelift","unwind","debuginfo","codegen","unimplemented","eh-frame"],"analyzedSha":"22057b88b091743bc0fd8d592a9264f0a6951403","analyzedAt":"2026-08-03T08:09:25.915Z","schemaVersion":2}