rust-lang/rust · error

Kind

Error message

Kind: {:?}

What it means

An `unimplemented!("Kind: {:?}", kind)` ICE in rustc_codegen_gcc's `type_kind_to_gcc_type` helper. The function is meant to translate an integer-like `TyKind` into the matching fixed-width `CType`, but it only handles `Int(..)` and `Uint(..)` variants. Any other `TyKind` reaching it falls through to the panic. `type_kind_to_gcc_type` is called from `int.rs:323` while widening/truncating integer values, so a non-integer kind here is a compiler-internal invariant violation.

Solutions

  1. Report the ICE with `RUST_BACKTRACE=1` and the `kind` value printed in the message; this is most often a rustc/cg_gcc bug, not user code.
  2. Reproduce with the LLVM backend to confirm the same source compiles; if LLVM succeeds, it is a cg_gcc-specific gap.
  3. Update to a newer rustc/cg_gcc where the integer-kind handling has been extended, or locally extend the `match` to cover the missing kind if you control the build.
Defensive patterns

Strategy: fallback

Validate before calling

# This is an internal invariant ICE; validate by reproducing on LLVM first
# If `rustc file.rs` (LLVM) succeeds but `rustc -Zcodegen-backend=gcc file.rs` ICEs,
# report a cg_gcc bug with the printed `kind` value.

Prevention

When it happens

Trigger: The widening/narrowing path in the GCC backend receives a `TyKind` that is not `Int` or `Uint` — typically a type-inference bug, an unexpected `Bool`/`Char`, or an internal caller passing the wrong type kind into the integer-conversion helper. This is reached during codegen of integer cast/widen operations.

Common situations: Observed as an ICE during codegen with the GCC backend when a type that should be integer-typed is instead represented by another kind due to an upstream rustc bug or an incomplete cg_gcc call site. Not user-triggerable by normal Rust source; usually requires a malformed type or a cg_gcc regression.

Related errors


AI-assisted analysis of rust-lang/rust@7088e4b63a (2026-08-10). Data as JSON: /api/errors/9fcc25621ad865a6. Report an issue: GitHub.

Appendix: source

Thrown at compiler/rustc_codegen_gcc/src/int.rs:1064

fn type_kind_to_gcc_type<I: Interner>(kind: TyKind<I>) -> CType {
    use rustc_middle::ty::IntTy::*;
    use rustc_middle::ty::UintTy::*;
    use rustc_middle::ty::{Int, Uint};

    match kind {
        Int(I8) => CType::Int8t,
        Int(I16) => CType::Int16t,
        Int(I32) => CType::Int32t,
        Int(I64) => CType::Int64t,
        Int(I128) => CType::Int128t,

        Uint(U8) => CType::UInt8t,
        Uint(U16) => CType::UInt16t,
        Uint(U32) => CType::UInt32t,
        Uint(U64) => CType::UInt64t,
        Uint(U128) => CType::UInt128t,

        _ => unimplemented!("Kind: {:?}", kind),
    }
}

View on GitHub (pinned to 7088e4b63a)