Skip to content

[ICE]: inference variables in normalized parameter environment: unconstrained type #153354

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

trait StreamingIterator<'a> {
    type Item: 'a;
}
impl<'b, I, T> StreamingIterator<'b> for I
where
    I: IntoIterator,
    T: FnMut(Self::Item, I::Item),
{
    type Item = T;
}

original:

trait StreamingIterator<'a> {
    type Item: 'a;
}
impl<'b, I, T> StreamingIterator<'b> for I
where
    I: IntoIterator,
    T: FnMut(Self::Item, I::Item),
{
    type Item = T;
}

fn main() {}

alternatively a bit bigger, not sure which one is better

trait StreamingIterator<'a> {
    type Item: 'a;
}

struct StreamingIterMap<I, F> {}

impl<'b, I, F, T> StreamingIterator<'b> for StreamingIterMap<I, F>
where
    Self: Sized,
    I: IntoIterator,
    F: FnMut(Self::Item, I::Item) -> bool,
{
    type Item = T;
}

fn main() {}

Version information

rustc 1.96.0-nightly (d2218f5f5 2026-03-03)
binary: rustc
commit-hash: d2218f5f5ca3f502772ec4cb69fc2ee44e096512
commit-date: 2026-03-03
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.0

Possibly related line of code:

// happen often, but if it did happen it probably
// represents a legitimate failure due to some kind of
// unconstrained variable.
//
// @lcnr: Let's still ICE here for now. I want a test case
// for that.
span_bug!(
span,
"inference variables in normalized parameter environment: {}",
fixup_err
);
}
}

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.Dz7QgPg3RSCn/rustc_testrunner_tmpdir_reporting.26JD4WO3XwDd/mvce.rs:10:2
   |
10 | }
   |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.Dz7QgPg3RSCn/rustc_testrunner_tmpdir_reporting.26JD4WO3XwDd/mvce.rs`

error[E0275]: overflow evaluating the requirement `Self: StreamingIterator<'_>`
  |
  = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`mvce`)
note: required for `Self` to implement `StreamingIterator<'_>`
 --> /tmp/icemaker_global_tempdir.Dz7QgPg3RSCn/rustc_testrunner_tmpdir_reporting.26JD4WO3XwDd/mvce.rs:4:16
  |
4 | impl<'b, I, T> StreamingIterator<'b> for I
  |                ^^^^^^^^^^^^^^^^^^^^^     ^
...
7 |     T: FnMut(Self::Item, I::Item),
  |        -------------------------- unsatisfied trait bound introduced here
  = note: 127 redundant requirements hidden
  = note: required for `Self` to implement `StreamingIterator<'a>`

error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
 --> /tmp/icemaker_global_tempdir.Dz7QgPg3RSCn/rustc_testrunner_tmpdir_reporting.26JD4WO3XwDd/mvce.rs:4:13
  |
4 | impl<'b, I, T> StreamingIterator<'b> for I
  |             ^ unconstrained type parameter

error: internal compiler error: /rustc-dev/d2218f5f5ca3f502772ec4cb69fc2ee44e096512/compiler/rustc_trait_selection/src/traits/mod.rs:311:13: inference variables in normalized parameter environment: unconstrained type
 --> /tmp/icemaker_global_tempdir.Dz7QgPg3RSCn/rustc_testrunner_tmpdir_reporting.26JD4WO3XwDd/mvce.rs:4:1
  |
4 | / impl<'b, I, T> StreamingIterator<'b> for I
5 | | where
6 | |     I: IntoIterator,
7 | |     T: FnMut(Self::Item, I::Item),
  | |__________________________________^


thread 'rustc' (428782) panicked at /rustc-dev/d2218f5f5ca3f502772ec4cb69fc2ee44e096512/compiler/rustc_trait_selection/src/traits/mod.rs:311:13:
Box<dyn Any>
stack backtrace:
   0:     0x7f6b2d562aab - <<std[76599d2169901dc8]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[d5ffb84325ed5c2a]::fmt::Display>::fmt
   1:     0x7f6b2dc228c8 - core[d5ffb84325ed5c2a]::fmt::write
   2:     0x7f6b2d579ab6 - <std[76599d2169901dc8]::sys::stdio::unix::Stderr as std[76599d2169901dc8]::io::Write>::write_fmt
   3:     0x7f6b2d538b88 - std[76599d2169901dc8]::panicking::default_hook::{closure#0}
   4:     0x7f6b2d555f13 - std[76599d2169901dc8]::panicking::default_hook
   5:     0x7f6b2c5424cc - std[76599d2169901dc8]::panicking::update_hook::<alloc[f847baa7d3d2ac55]::boxed::Box<rustc_driver_impl[ffd722fd6c32666a]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f6b2d5561f2 - std[76599d2169901dc8]::panicking::panic_with_hook
   7:     0x7f6b2c573021 - std[76599d2169901dc8]::panicking::begin_panic::<rustc_errors[1cad63cca86ddad4]::ExplicitBug>::{closure#0}
   8:     0x7f6b2c56bd36 - std[76599d2169901dc8]::sys::backtrace::__rust_end_short_backtrace::<std[76599d2169901dc8]::panicking::begin_panic<rustc_errors[1cad63cca86ddad4]::ExplicitBug>::{closure#0}, !>
   9:     0x7f6b2c569a28 - std[76599d2169901dc8]::panicking::begin_panic::<rustc_errors[1cad63cca86ddad4]::ExplicitBug>
  10:     0x7f6b2c57e221 - <rustc_errors[1cad63cca86ddad4]::diagnostic::BugAbort as rustc_errors[1cad63cca86ddad4]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7f6b2cb26f2c - <rustc_errors[1cad63cca86ddad4]::DiagCtxtHandle>::span_bug::<rustc_span[8a71b77c74bc13cb]::span_encoding::Span, alloc[f847baa7d3d2ac55]::string::String>
  12:     0x7f6b2cb4e2d6 - rustc_middle[7c9cbe436035c5a4]::util::bug::opt_span_bug_fmt::<rustc_span[8a71b77c74bc13cb]::span_encoding::Span>::{closure#0}
  13:     0x7f6b2cb4e482 - rustc_middle[7c9cbe436035c5a4]::ty::context::tls::with_opt::<rustc_middle[7c9cbe436035c5a4]::util::bug::opt_span_bug_fmt<rustc_span[8a71b77c74bc13cb]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7f6b2cb3f00b - rustc_middle[7c9cbe436035c5a4]::ty::context::tls::with_context_opt::<rustc_middle[7c9cbe436035c5a4]::ty::context::tls::with_opt<rustc_middle[7c9cbe436035c5a4]::util::bug::opt_span_bug_fmt<rustc_span[8a71b77c74bc13cb]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7f6b2abee638 - rustc_middle[7c9cbe436035c5a4]::util::bug::span_bug_fmt::<rustc_span[8a71b77c74bc13cb]::span_encoding::Span>
  16:     0x7f6b2e5ed5a5 - rustc_trait_selection[502c21a12406236f]::traits::do_normalize_predicates
  17:     0x7f6b2e423789 - rustc_trait_selection[502c21a12406236f]::traits::normalize_param_env_or_error
  18:     0x7f6b2e42c1e9 - rustc_ty_utils[23782f25fc8ac972]::ty::param_env
  19:     0x7f6b2dc130e8 - rustc_query_impl[89f9236b2ac04da0]::execution::try_execute_query::<rustc_middle[7c9cbe436035c5a4]::query::caches::DefIdCache<rustc_middle[7c9cbe436035c5a4]::query::erase::ErasedData<[u8; 8usize]>>, false>
  20:     0x7f6b2dc12b90 - rustc_query_impl[89f9236b2ac04da0]::query_impl::param_env::execute_query_non_incr::__rust_end_short_backtrace
  21:     0x7f6b2e6009b5 - rustc_ty_utils[23782f25fc8ac972]::ty::impl_self_is_guaranteed_unsized
  22:     0x7f6b2e600555 - rustc_query_impl[89f9236b2ac04da0]::query_impl::impl_self_is_guaranteed_unsized::invoke_provider_fn::__rust_begin_short_backtrace
  23:     0x7f6b2e2b21ca - rustc_query_impl[89f9236b2ac04da0]::execution::try_execute_query::<rustc_middle[7c9cbe436035c5a4]::query::caches::DefIdCache<rustc_middle[7c9cbe436035c5a4]::query::erase::ErasedData<[u8; 1usize]>>, false>
  24:     0x7f6b2e2b1a80 - rustc_query_impl[89f9236b2ac04da0]::query_impl::impl_self_is_guaranteed_unsized::execute_query_non_incr::__rust_end_short_backtrace
  25:     0x7f6b2e2c905d - rustc_hir_analysis[7282aa5ba0febab4]::check::check::check_item_type
  26:     0x7f6b2e2c6e66 - rustc_hir_analysis[7282aa5ba0febab4]::check::wfcheck::check_well_formed
  27:     0x7f6b2e2c6e47 - rustc_query_impl[89f9236b2ac04da0]::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
  28:     0x7f6b2e2c63d9 - rustc_query_impl[89f9236b2ac04da0]::execution::try_execute_query::<rustc_data_structures[79f5f180de225010]::vec_cache::VecCache<rustc_span[8a71b77c74bc13cb]::def_id::LocalDefId, rustc_middle[7c9cbe436035c5a4]::query::erase::ErasedData<[u8; 1usize]>, rustc_middle[7c9cbe436035c5a4]::dep_graph::graph::DepNodeIndex>, false>
  29:     0x7f6b2e2c613b - rustc_query_impl[89f9236b2ac04da0]::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
  30:     0x7f6b2e2c303d - rustc_hir_analysis[7282aa5ba0febab4]::check::wfcheck::check_type_wf
  31:     0x7f6b2e2c2f47 - rustc_query_impl[89f9236b2ac04da0]::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
  32:     0x7f6b2ee2fb97 - rustc_query_impl[89f9236b2ac04da0]::execution::try_execute_query::<rustc_middle[7c9cbe436035c5a4]::query::caches::SingleCache<rustc_middle[7c9cbe436035c5a4]::query::erase::ErasedData<[u8; 1usize]>>, false>
  33:     0x7f6b2ee2f969 - rustc_query_impl[89f9236b2ac04da0]::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
  34:     0x7f6b2e2a5195 - rustc_hir_analysis[7282aa5ba0febab4]::check_crate
  35:     0x7f6b2dd69b93 - rustc_interface[400bc27e64bfd912]::passes::analysis
  36:     0x7f6b2ee3175c - rustc_query_impl[89f9236b2ac04da0]::execution::try_execute_query::<rustc_middle[7c9cbe436035c5a4]::query::caches::SingleCache<rustc_middle[7c9cbe436035c5a4]::query::erase::ErasedData<[u8; 0usize]>>, false>
  37:     0x7f6b2ee314bb - rustc_query_impl[89f9236b2ac04da0]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
  38:     0x7f6b2ededa2d - rustc_interface[400bc27e64bfd912]::interface::run_compiler::<(), rustc_driver_impl[ffd722fd6c32666a]::run_compiler::{closure#0}>::{closure#1}
  39:     0x7f6b2edd20be - std[76599d2169901dc8]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[400bc27e64bfd912]::util::run_in_thread_with_globals<rustc_interface[400bc27e64bfd912]::util::run_in_thread_pool_with_globals<rustc_interface[400bc27e64bfd912]::interface::run_compiler<(), rustc_driver_impl[ffd722fd6c32666a]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  40:     0x7f6b2edd2720 - <std[76599d2169901dc8]::thread::lifecycle::spawn_unchecked<rustc_interface[400bc27e64bfd912]::util::run_in_thread_with_globals<rustc_interface[400bc27e64bfd912]::util::run_in_thread_pool_with_globals<rustc_interface[400bc27e64bfd912]::interface::run_compiler<(), rustc_driver_impl[ffd722fd6c32666a]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[d5ffb84325ed5c2a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:     0x7f6b2edd35ac - <std[76599d2169901dc8]::sys::thread::unix::Thread>::new::thread_start
  42:     0x7f6b288a598b - <unknown>
  43:     0x7f6b28929a0c - <unknown>
  44:                0x0 - <unknown>

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.96.0-nightly (d2218f5f5 2026-03-03) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [param_env] computing normalized predicates of `<impl at /tmp/icemaker_global_tempdir.Dz7QgPg3RSCn/rustc_testrunner_tmpdir_reporting.26JD4WO3XwDd/mvce.rs:4:1: 7:35>`
#1 [impl_self_is_guaranteed_unsized] computing whether `<impl at /tmp/icemaker_global_tempdir.Dz7QgPg3RSCn/rustc_testrunner_tmpdir_reporting.26JD4WO3XwDd/mvce.rs:4:1: 7:35>` has a guaranteed unsized self type
#2 [check_well_formed] checking that `<impl at /tmp/icemaker_global_tempdir.Dz7QgPg3RSCn/rustc_testrunner_tmpdir_reporting.26JD4WO3XwDd/mvce.rs:4:1: 7:35>` is well-formed
#3 [check_type_wf] checking that types are well-formed
#4 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 4 previous errors

Some errors have detailed explanations: E0207, E0275, E0601.
For more information about an error, try `rustc --explain E0207`.

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions