{"id":"9fcc25621ad865a6","repo":"rust-lang/rust","slug":"kind","errorCode":null,"errorMessage":"Kind: {:?}","messagePattern":"Kind: \\{:\\?\\}","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/rustc_codegen_gcc/src/int.rs","lineNumber":1064,"sourceCode":"fn type_kind_to_gcc_type<I: Interner>(kind: TyKind<I>) -> CType {\n    use rustc_middle::ty::IntTy::*;\n    use rustc_middle::ty::UintTy::*;\n    use rustc_middle::ty::{Int, Uint};\n\n    match kind {\n        Int(I8) => CType::Int8t,\n        Int(I16) => CType::Int16t,\n        Int(I32) => CType::Int32t,\n        Int(I64) => CType::Int64t,\n        Int(I128) => CType::Int128t,\n\n        Uint(U8) => CType::UInt8t,\n        Uint(U16) => CType::UInt16t,\n        Uint(U32) => CType::UInt32t,\n        Uint(U64) => CType::UInt64t,\n        Uint(U128) => CType::UInt128t,\n\n        _ => unimplemented!(\"Kind: {:?}\", kind),\n    }\n}\n","sourceCodeStart":1046,"sourceCodeEnd":1067,"githubUrl":"https://github.com/rust-lang/rust/blob/22057b88b091743bc0fd8d592a9264f0a6951403/compiler/rustc_codegen_gcc/src/int.rs#L1046-L1067","documentation":"This unimplemented!() is the catch-all in type_kind_to_gcc_type, a free function that maps a rustc TyKind (Int/Uint variants) to a libgccjit CType. Only Int(I8..I128) and Uint(U8..U128) are handled; any other TyKind (bool/Float/Char/Adt/etc.) reaching this function triggers it. The message prints the offending kind to aid diagnosis.","triggerScenarios":"type_kind_to_gcc_type is invoked with a TyKind that is not an integer kind (Int or Uint). This happens when a caller passes a non-integer type where an integer CType was expected, e.g. a bool, float, or char leaking into integer-only type mapping during codegen.","commonSituations":"Internal codegen changes that route non-integer TyKinds through type_kind_to_gcc_type; bugs where bool or float types are mapped via the integer path; refactors of the type mapping after a rustc upgrade.","solutions":["Identify the caller passing the non-integer TyKind (enable debug logging of TyKind before the call) and route it through the correct type mapping for its kind.","Extend type_kind_to_gcc_type only if the function is genuinely meant to handle the new kind; otherwise fix the dispatch at the call site.","Reproduce on a clean checkout of the rustc/rustc_codegen_gcc pair to rule out a local patch introducing the bad TyKind.","Report upstream with the exact TyKind value printed by the message."],"exampleFix":"// before\nlet ty = type_kind_to_gcc_type(kind); // kind is a bool/float/char\n// after (dispatch by kind at the call site)\nlet ty = match kind {\n    TyKind::Int(_) | TyKind::Uint(_) => type_kind_to_gcc_type(kind),\n    TyKind::Bool => cx.type_i1(),\n    other => panic!(\"unexpected tykind in this path: {:?}\", other),\n};","handlingStrategy":"fallback","validationCode":"# type_kind_to_gcc_type only maps Int/Uint TyKinds; any other kind is unimplemented!.\n# This is a compiler bug, not a source pattern you can reliably predict. Pre-check toolchain version:\nrustc -V --verbose | rg 'release:'\n# and run the crate's full test suite on the LLVM backend first; if green, the GCC panic is the backend's gap.","typeGuard":null,"tryCatchPattern":"set +e\nRUSTFLAGS='-C codegen-backend=gcc' cargo build --release 2>gcc_build.log\nstatus=$?\nset -e\nif [ $status -ne 0 ]; then\n  echo 'GCC backend failed (int.rs:1064 unimplemented TyKind); rebuilding with LLVM backend' >&2\n  cargo build --release\n  # Capture a minimal repro for the upstream bug report.\n  rg -n 'rustc_codegen_gcc' gcc_build.log | head -n 20 > gcc_repro.txt\nfi","preventionTips":["Treat int.rs:1064 as a backend bug: only Int/Uint kinds are mapped, so hitting it means an unexpected TyKind reached GCC codegen.","Pin a known-good rustc/rustc_codegen_gcc toolchain in rust-toolchain.toml and CI.","Always keep the LLVM backend build green as the reference; diff the two to localize the failing construct.","File an upstream issue with the minimal repro before adopting the GCC backend for new targets."],"tags":["rust","codegen","gcc","libgccjit","types","panic"],"analyzedSha":"22057b88b091743bc0fd8d592a9264f0a6951403","analyzedAt":"2026-08-03T08:09:25.915Z","schemaVersion":2}