Skip to content

ICE: inference variables in normalized parameter environment: unconstrained type #150091

@bushilushan

Description

@bushilushan

Code

The only similar issue I found is #120033, but it can no longer trigger the ICE in the latest version of the Rust compiler. I'm not sure if this is a duplicate.

#![feature(sized_hierarchy)]
#![feature(non_lifetime_binders)]

use std::marker::PointeeSized;

pub trait Foo<T: PointeeSized> {
    type Bar<K: PointeeSized>: PointeeSized;
}

pub fn f<T1, T2>(a: T1, b: T2)
where
    T1: for<K, T> Foo<usize, Bar<K> = T>,
    T2: for<K, T> Foo<usize, Bar<K> = <T1 as Foo<usize>>::Bar<T>>,
{
}

Meta

rustc --version --verbose:

rustc 1.94.0-nightly (21ff67df1 2025-12-15)
binary: rustc
commit-hash: 21ff67df15329dd7548ccba54b6c6ae9a562124f
commit-date: 2025-12-15
host: x86_64-unknown-linux-gnu
release: 1.94.0-nightly
LLVM version: 21.1.8
Program Output

warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
 --> <source>:2:12
  |
2 | #![feature(non_lifetime_binders)]
  |            ^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
  = note: `#[warn(incomplete_features)]` on by default

error[E0601]: `main` function not found in crate `example`
  --> <source>:15:2
   |
15 | }
   |  ^ consider adding a `main` function to `<source>`

error: internal compiler error: compiler/rustc_trait_selection/src/traits/mod.rs:311:13: inference variables in normalized parameter environment: unconstrained type
  --> <source>:10:1
   |
10 | / pub fn f<T1, T2>(a: T1, b: T2)
11 | | where
12 | |     T1: for<K, T> Foo<usize, Bar<K> = T>,
13 | |     T2: for<K, T> Foo<usize, Bar<K> = <T1 as Foo<usize>>::Bar<T>>,
   | |__________________________________________________________________^


thread 'rustc' (3) panicked at compiler/rustc_trait_selection/src/traits/mod.rs:311:13:
Box<dyn Any>
stack backtrace:
   0:     0x71ded458a253 - <<std[5ec89fed4875b12f]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[26a7a51be8c9f870]::fmt::Display>::fmt
   1:     0x71ded4c10708 - core[26a7a51be8c9f870]::fmt::write
   2:     0x71ded45a08a6 - <std[5ec89fed4875b12f]::sys::stdio::unix::Stderr as std[5ec89fed4875b12f]::io::Write>::write_fmt
   3:     0x71ded4560a18 - std[5ec89fed4875b12f]::panicking::default_hook::{closure#0}
   4:     0x71ded457e123 - std[5ec89fed4875b12f]::panicking::default_hook
   5:     0x71ded356ffb7 - std[5ec89fed4875b12f]::panicking::update_hook::<alloc[673ccbb8a4c5d329]::boxed::Box<rustc_driver_impl[50f6efb3f18c5e4b]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x71ded457e402 - std[5ec89fed4875b12f]::panicking::panic_with_hook
   7:     0x71ded35ad101 - std[5ec89fed4875b12f]::panicking::begin_panic::<rustc_errors[d468dc7f6b98c50]::ExplicitBug>::{closure#0}
   8:     0x71ded359d516 - std[5ec89fed4875b12f]::sys::backtrace::__rust_end_short_backtrace::<std[5ec89fed4875b12f]::panicking::begin_panic<rustc_errors[d468dc7f6b98c50]::ExplicitBug>::{closure#0}, !>
   9:     0x71ded359d1af - std[5ec89fed4875b12f]::panicking::begin_panic::<rustc_errors[d468dc7f6b98c50]::ExplicitBug>
  10:     0x71ded35ca7f1 - <rustc_errors[d468dc7f6b98c50]::diagnostic::BugAbort as rustc_errors[d468dc7f6b98c50]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x71ded3b4a2ec - <rustc_errors[d468dc7f6b98c50]::DiagCtxtHandle>::span_bug::<rustc_span[ae684922c33956fd]::span_encoding::Span, alloc[673ccbb8a4c5d329]::string::String>
  12:     0x71ded3b6d6c6 - rustc_middle[7d117b0519601dc6]::util::bug::opt_span_bug_fmt::<rustc_span[ae684922c33956fd]::span_encoding::Span>::{closure#0}
  13:     0x71ded3b6d872 - rustc_middle[7d117b0519601dc6]::ty::context::tls::with_opt::<rustc_middle[7d117b0519601dc6]::util::bug::opt_span_bug_fmt<rustc_span[ae684922c33956fd]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x71ded3b5f04b - rustc_middle[7d117b0519601dc6]::ty::context::tls::with_context_opt::<rustc_middle[7d117b0519601dc6]::ty::context::tls::with_opt<rustc_middle[7d117b0519601dc6]::util::bug::opt_span_bug_fmt<rustc_span[ae684922c33956fd]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x71ded230fa78 - rustc_middle[7d117b0519601dc6]::util::bug::span_bug_fmt::<rustc_span[ae684922c33956fd]::span_encoding::Span>
  16:     0x71ded55068d2 - rustc_trait_selection[f518b5b75a7ddddf]::traits::do_normalize_predicates
  17:     0x71ded53fb05f - rustc_trait_selection[f518b5b75a7ddddf]::traits::normalize_param_env_or_error
  18:     0x71ded5400449 - rustc_ty_utils[5e92cc0cb70ef2cf]::ty::param_env
  19:     0x71ded53ffecd - rustc_query_impl[27139b72c8912d2b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[27139b72c8912d2b]::query_impl::param_env::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7d117b0519601dc6]::query::erase::Erased<[u8; 8usize]>>
  20:     0x71ded4c19c86 - rustc_query_system[5d3859f1d59bc7f3]::query::plumbing::try_execute_query::<rustc_query_impl[27139b72c8912d2b]::DynamicConfig<rustc_query_system[5d3859f1d59bc7f3]::query::caches::DefIdCache<rustc_middle[7d117b0519601dc6]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[27139b72c8912d2b]::plumbing::QueryCtxt, false>
  21:     0x71ded4c19771 - rustc_query_impl[27139b72c8912d2b]::query_impl::param_env::get_query_non_incr::__rust_end_short_backtrace
  22:     0x71ded54fc7c0 - rustc_hir_analysis[786560d794dfc663]::check::wfcheck::check_item_fn
  23:     0x71ded53628dd - rustc_hir_analysis[786560d794dfc663]::check::check::check_item_type
  24:     0x71ded535e936 - rustc_hir_analysis[786560d794dfc663]::check::wfcheck::check_well_formed
  25:     0x71ded535e917 - rustc_query_impl[27139b72c8912d2b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[27139b72c8912d2b]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7d117b0519601dc6]::query::erase::Erased<[u8; 1usize]>>
  26:     0x71ded535e18d - rustc_query_system[5d3859f1d59bc7f3]::query::plumbing::try_execute_query::<rustc_query_impl[27139b72c8912d2b]::DynamicConfig<rustc_data_structures[32d4a3d751e78af5]::vec_cache::VecCache<rustc_span[ae684922c33956fd]::def_id::LocalDefId, rustc_middle[7d117b0519601dc6]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[5d3859f1d59bc7f3]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[27139b72c8912d2b]::plumbing::QueryCtxt, false>
  27:     0x71ded535dc96 - rustc_query_impl[27139b72c8912d2b]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  28:     0x71ded535b430 - rustc_hir_analysis[786560d794dfc663]::check::wfcheck::check_type_wf
  29:     0x71ded535b321 - rustc_query_impl[27139b72c8912d2b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[27139b72c8912d2b]::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7d117b0519601dc6]::query::erase::Erased<[u8; 1usize]>>
  30:     0x71ded5dafd54 - rustc_query_system[5d3859f1d59bc7f3]::query::plumbing::try_execute_query::<rustc_query_impl[27139b72c8912d2b]::DynamicConfig<rustc_query_system[5d3859f1d59bc7f3]::query::caches::SingleCache<rustc_middle[7d117b0519601dc6]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[27139b72c8912d2b]::plumbing::QueryCtxt, false>
  31:     0x71ded5dafb36 - rustc_query_impl[27139b72c8912d2b]::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
  32:     0x71ded569f834 - rustc_hir_analysis[786560d794dfc663]::check_crate
  33:     0x71ded4ea9bdb - rustc_interface[b41716356610a9ea]::passes::analysis
  34:     0x71ded4ea9825 - rustc_query_impl[27139b72c8912d2b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[27139b72c8912d2b]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7d117b0519601dc6]::query::erase::Erased<[u8; 0usize]>>
  35:     0x71ded5db1526 - rustc_query_system[5d3859f1d59bc7f3]::query::plumbing::try_execute_query::<rustc_query_impl[27139b72c8912d2b]::DynamicConfig<rustc_query_system[5d3859f1d59bc7f3]::query::caches::SingleCache<rustc_middle[7d117b0519601dc6]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[27139b72c8912d2b]::plumbing::QueryCtxt, false>
  36:     0x71ded5db10f6 - rustc_query_impl[27139b72c8912d2b]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  37:     0x71ded5f5fc51 - <rustc_interface[b41716356610a9ea]::passes::create_and_enter_global_ctxt<core[26a7a51be8c9f870]::option::Option<rustc_interface[b41716356610a9ea]::queries::Linker>, rustc_driver_impl[50f6efb3f18c5e4b]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[26a7a51be8c9f870]::ops::function::FnOnce<(&rustc_session[276d18328e744fa4]::session::Session, rustc_middle[7d117b0519601dc6]::ty::context::CurrentGcx, alloc[673ccbb8a4c5d329]::sync::Arc<rustc_data_structures[32d4a3d751e78af5]::jobserver::Proxy>, &std[5ec89fed4875b12f]::sync::once_lock::OnceLock<rustc_middle[7d117b0519601dc6]::ty::context::GlobalCtxt>, &rustc_data_structures[32d4a3d751e78af5]::sync::worker_local::WorkerLocal<rustc_middle[7d117b0519601dc6]::arena::Arena>, &rustc_data_structures[32d4a3d751e78af5]::sync::worker_local::WorkerLocal<rustc_hir[6a9da475a5f9b785]::Arena>, rustc_driver_impl[50f6efb3f18c5e4b]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  38:     0x71ded5ded2da - rustc_interface[b41716356610a9ea]::interface::run_compiler::<(), rustc_driver_impl[50f6efb3f18c5e4b]::run_compiler::{closure#0}>::{closure#1}
  39:     0x71ded5d5f7ce - std[5ec89fed4875b12f]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[b41716356610a9ea]::util::run_in_thread_with_globals<rustc_interface[b41716356610a9ea]::util::run_in_thread_pool_with_globals<rustc_interface[b41716356610a9ea]::interface::run_compiler<(), rustc_driver_impl[50f6efb3f18c5e4b]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  40:     0x71ded5d5f5a0 - <std[5ec89fed4875b12f]::thread::lifecycle::spawn_unchecked<rustc_interface[b41716356610a9ea]::util::run_in_thread_with_globals<rustc_interface[b41716356610a9ea]::util::run_in_thread_pool_with_globals<rustc_interface[b41716356610a9ea]::interface::run_compiler<(), rustc_driver_impl[50f6efb3f18c5e4b]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[26a7a51be8c9f870]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:     0x71ded5d5d978 - <std[5ec89fed4875b12f]::sys::thread::unix::Thread>::new::thread_start
  42:     0x71decf694ac3 - <unknown>
  43:     0x71decf7268c0 - <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: please attach the file at `/app/rustc-ice-2025-12-17T11_56_25-1.txt` to your bug report

note: compiler flags: -C debuginfo=2 --crate-type bin -C linker=/opt/compiler-explorer/gcc-15.2.0/bin/gcc

query stack during panic:
#0 [param_env] computing normalized predicates of `f`
#1 [check_well_formed] checking that `f` is well-formed
#2 [check_type_wf] checking that types are well-formed
#3 [analysis] running analysis passes on crate `example`
end of query stack
error: aborting due to 2 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0601`.

Metadata

Metadata

Assignees

No one assigned

    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.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions