rust-lang/rust · error

FIXME(comptime)

Error message

FIXME(comptime)

What it means

An `unimplemented!("FIXME(comptime)")` ICE in `rustc_middle`'s ADT destructor classification (`AdtDef::destructor` wrapper). When a type's `Drop` impl is `Constness::Const { always: true }` (an always-evaluated const destructor — part of the in-progress comptime work), the destructor-kind query does not yet know how to classify it and panics at adt.rs:315.

Source

Thrown at compiler/rustc_middle/src/ty/adt.rs:315

            self.all_fields().map(move |field| tcx.type_of(field.did).skip_binder()),
        )
    }

    fn sizedness_constraint(
        self,
        tcx: TyCtxt<'tcx>,
        sizedness: ty::SizedTraitKind,
    ) -> Option<ty::EarlyBinder<'tcx, Ty<'tcx>>> {
        self.sizedness_constraint(tcx, sizedness)
    }

    fn is_fundamental(self) -> bool {
        self.is_fundamental()
    }

    fn destructor(self, tcx: TyCtxt<'tcx>) -> Option<AdtDestructorKind> {
        Some(match tcx.constness(self.destructor(tcx)?.did) {
            hir::Constness::Const { always: true } => unimplemented!("FIXME(comptime)"),
            hir::Constness::Const { always: false } => AdtDestructorKind::Const,
            hir::Constness::NotConst => AdtDestructorKind::NotConst,
        })
    }
}

#[derive(Copy, Clone, Debug, Eq, PartialEq, StableHash, TyEncodable, TyDecodable)]
pub enum AdtKind {
    Struct,
    Union,
    Enum,
}

impl From<AdtKind> for DataTypeKind {
    fn from(val: AdtKind) -> Self {
        match val {
            AdtKind::Struct => DataTypeKind::Struct,
            AdtKind::Union => DataTypeKind::Union,

View on GitHub (pinned to 7088e4b63a)

Solutions

  1. Remove the `const` modifier from the offending `Drop` impl so it is `NotConst` or a normal const destructor.
  2. Disable the comptime/const-destruct experimental feature in the crate.
  3. Track the upstream `FIXME(comptime)` work; upgrade nightly once implemented.

Example fix

// before (always-const drop -> ICE)
impl const Drop for T { ... } // with always-const semantics

// after — non-const drop
impl Drop for T { fn drop(&mut self) { ... } }
Defensive patterns

Strategy: validation

Validate before calling

# Detect always-const Drop impls
rg -nE 'impl\s+const\s+Drop' src/  # review whether 'always' semantics apply

Prevention

When it happens

Trigger: A type has a `Drop` impl marked `const` with the `always` flag set (comptime const-eval drop), and a query asks for the ADT's destructor kind. Triggered during drop-elaboration / const-destructuring passes.

Common situations: Using experimental const-destruct / comptime features that produce an `always: true` const destructor; not reachable from stable Rust. Seen on nightly with const-eval drop experiments.

Related errors


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