rust-lang/rust · critical
`FusedIterator` does not have an associated type: {:?}
Error message
`FusedIterator` does not have an associated type: {:?} What it means
consider_builtin_fused_iterator_candidate (normalizes_to.rs:884) panics unconditionally. The FusedIterator marker trait (core::iter::FusedIterator) has no associated types, so a NormalizesTo projection goal against it is impossible. assembly/mod.rs only routes FusedIterator trait goals (handled in trait_goals.rs); reaching this normalizes_to.rs stub means the solver erroneously built a projection goal for an associated-type-less trait.
Source
Thrown at compiler/rustc_next_trait_solver/src/solve/normalizes_to.rs:884
cx.alias_term_kind_from_def_id(
goal.predicate.alias.expect_projection_def_id().into(),
),
[self_ty],
),
term,
}
.upcast(cx),
// Technically, we need to check that the iterator type is Sized,
// but that's already proven by the generator being WF.
[],
)
}
fn consider_builtin_fused_iterator_candidate(
_ecx: &mut EvalCtxt<'_, D>,
goal: Goal<I, Self>,
) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
panic!("`FusedIterator` does not have an associated type: {:?}", goal);
}
fn consider_builtin_async_iterator_candidate(
ecx: &mut EvalCtxt<'_, D>,
goal: Goal<I, Self>,
) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
let self_ty = goal.predicate.self_ty();
let ty::Coroutine(def_id, args) = self_ty.kind() else {
return Err(NoSolution.into());
};
// Coroutines are not AsyncIterators unless they come from `gen` desugaring
let cx = ecx.cx();
if !cx.coroutine_is_async_gen(def_id) {
return Err(NoSolution.into());
}
ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc).enter(|ecx| {View on GitHub (pinned to 22057b88b0)
Solutions
- Update to the latest nightly (rustup update nightly).
- Disable -Znext-solver (remove the flag or -Znext-solver=no).
- File an ICE at https://github.com/rust-lang/rust/issues with the goal printed in the panic and a minimal reproducer.
- Bisect nightlies to locate the introducing commit.
Defensive patterns
Strategy: type-guard
Validate before calling
// FusedIterator is a marker trait (no assoc types/items).
// Use it only as `T: Iterator + FusedIterator`; never `<I as FusedIterator>::X`.
fn fused_only<I: Iterator + FusedIterator>() {} // OK
Type guard
trait _GuardFused<I: Iterator + FusedIterator> {} // compile-time-only sentinel
Prevention
- Treat `FusedIterator` as a behavioral marker; it carries no associated items.
- Project `Item` from `Iterator`, never from `FusedIterator`.
- Lint against the token `as FusedIterator)>::`.
When it happens
Trigger: A NormalizesTo goal whose trait_ref is the FusedIterator lang item reaches the next-solver builtin-candidate assembly. This cannot arise from valid surface Rust (FusedIterator has no associated items to project) and signals an internal solver/goal-construction bug.
Common situations: Nightly rustc regression in the next solver's goal-kind classification; adversarial fuzzing of the solver; not produced by normal iterator/fusion code.
Related errors
- no such associated type in `AsyncFn*`: {:?}
- `Tuple` does not have an associated type: {:?}
- unexpected associated item `{:?}` for `{self_ty:?}`
- `Unsize` does not have an associated type: {:?}
- `Destruct` does not have an associated type: {:?}
AI-assisted analysis of rust-lang/rust@22057b88b0 (2026-08-03).
Data as JSON: /data/errors/b2e2328c260d2cc6.json.
Report an issue: GitHub.