rust-lang/rust · error

Tuple trait is not const

Error message

Tuple trait is not const

What it means

`consider_builtin_tuple_candidate` (effect_goals.rs:364) is `unreachable!`. The built-in impl of the `Tuple` auto-trait (which marks types that are tuple-like / not unit) is never const — there is no notion of a `const Tuple` bound. Reaching this branch means a `T: const Tuple` host-effect goal was assembled, which is invalid by construction.

Source

Thrown at compiler/rustc_next_trait_solver/src/solve/effect_goals.rs:364

        _ecx: &mut EvalCtxt<'_, D>,
        _goal: Goal<I, Self>,
        _kind: rustc_type_ir::ClosureKind,
    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
        unimplemented!("AsyncFn* are not yet const")
    }

    fn consider_builtin_async_fn_kind_helper_candidate(
        _ecx: &mut EvalCtxt<'_, D>,
        _goal: Goal<I, Self>,
    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
        unreachable!("AsyncFnKindHelper is not const")
    }

    fn consider_builtin_tuple_candidate(
        _ecx: &mut EvalCtxt<'_, D>,
        _goal: Goal<I, Self>,
    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
        unreachable!("Tuple trait is not const")
    }

    fn consider_builtin_pointee_candidate(
        _ecx: &mut EvalCtxt<'_, D>,
        _goal: Goal<I, Self>,
    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
        unreachable!("Pointee is not const")
    }

    fn consider_builtin_future_candidate(
        _ecx: &mut EvalCtxt<'_, D>,
        _goal: Goal<I, Self>,
    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
        unreachable!("Future is not const")
    }

    fn consider_builtin_iterator_candidate(
        _ecx: &mut EvalCtxt<'_, D>,

View on GitHub (pinned to 22057b88b0)

Solutions

  1. Audit const bounds to ensure none transitively requires `const Tuple` (it is never satisfiable).
  2. Disable `const_trait_impl` / `-Znext-solver` to confirm the feature-gated path is the cause.
  3. Reduce to a minimal reproducer and file an ICE report.
  4. Upgrade nightly — host-effects assembly is under active revision.
Defensive patterns

Strategy: validation

Validate before calling

// The Tuple lang trait is not const. Reject tuple-construction in const eval that needs the trait.
// i.e. do not require `T: Tuple` (or rely on tuple trait bounds) inside a const obligation.
const fn no_tuple_trait_in_const<T>(_t: &T) where T: Sized {}
// (avoid `where T: std::tuple::Tuple` style bounds in const fn)

Prevention

When it happens

Trigger: Reached when the next solver evaluates a `HostEffectPredicate` for the `Tuple` trait (lang item) with a const effect and falls into the built-in tuple candidate branch (effect_goals.rs:360).

Common situations: Nightly with `const_trait_impl` and a variadic-tuple generic that ends up emitting a `const Tuple` obligation; interaction of `host_effects` with `min_const_generics`/tuple-impl-trait machinery; solver regression.

Related errors


AI-assisted analysis of rust-lang/rust@22057b88b0 (2026-08-03). Data as JSON: /data/errors/48ddc3b945aafaa3.json. Report an issue: GitHub.