ICE: cannot find `N/#0` in param-env
Open
Nobody has claimed this yet.
C-bug
F-adt_const_params
F-generic_const_parameter_types
I-ICE
needs-triage
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- PR merge metrics
- PR metrics pending
Description
It is very similar to #143117, but it seems to manifest differently. I'm not sure if this is the same issue.
Code
#![feature(adt_const_params, generic_const_parameter_types)]
#![expect(incomplete_features)]
#[derive(PartialEq)]
struct Inner<const N: usize>([u8; N]);
struct Outer<const N: usize, const M: Inner<N>>(Inner<N>);
fn main() {}
Meta
rustc --version --verbose:
rustc 1.94.0-nightly (b68e16cfc 2026-01-11)
binary: rustc
commit-hash: b68e16cfc0e9f8b29c9ec41bfa6ab0a637eff19c
commit-date: 2026-01-11
host: x86_64-unknown-linux-gnu
release: 1.94.0-nightly
LLVM version: 21.1.8
Program Output
error: internal compiler error: /rustc-dev/b68e16cfc0e9f8b29c9ec41bfa6ab0a637eff19c/compiler/rustc_middle/src/ty/sty.rs:374:13: cannot find `N/#0` in param-env: ParamEnv {
caller_bounds: [],
}
thread 'rustc' (3) panicked at /rustc-dev/b68e16cfc0e9f8b29c9ec41bfa6ab0a637eff19c/compiler/rustc_middle/src/ty/sty.rs:374:13:
Box<dyn Any>
stack backtrace:
0: 0x7f6762a40763 - <<std[dc78c416db172f4a]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[ae121572cd1b547a]::fmt::Display>::fmt
1: 0x7f676300e308 - core[ae121572cd1b547a]::fmt::write
2: 0x7f6762a57156 - <std[dc78c416db172f4a]::sys::stdio::unix::Stderr as std[dc78c416db172f4a]::io::Write>::write_fmt
3: 0x7f6762a167d8 - std[dc78c416db172f4a]::panicking::default_hook::{closure#0}
4: 0x7f6762a33e93 - std[dc78c416db172f4a]::panicking::default_hook
5: 0x7f6761a17aba - std[dc78c416db172f4a]::panicking::update_hook::<alloc[abf3b1e21d0b7705]::boxed::Box<rustc_driver_impl[f421dd94c081429e]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7f6762a34172 - std[dc78c416db172f4a]::panicking::panic_with_hook
7: 0x7f6761a54e91 - std[dc78c416db172f4a]::panicking::begin_panic::<rustc_errors[7f188bff54032bff]::ExplicitBug>::{closure#0}
8: 0x7f6761a454f6 - std[dc78c416db172f4a]::sys::backtrace::__rust_end_short_backtrace::<std[dc78c416db172f4a]::panicking::begin_panic<rustc_errors[7f188bff54032bff]::ExplicitBug>::{closure#0}, !>
9: 0x7f6761a4512f - std[dc78c416db172f4a]::panicking::begin_panic::<rustc_errors[7f188bff54032bff]::ExplicitBug>
10: 0x7f6761a72b91 - <rustc_errors[7f188bff54032bff]::diagnostic::BugAbort as rustc_errors[7f188bff54032bff]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
11: 0x7f6762023e69 - rustc_middle[dceae28993ab1a32]::util::bug::opt_span_bug_fmt::<rustc_span[bdd546435e4bce71]::span_encoding::Span>::{closure#0}
12: 0x7f6762023ff2 - rustc_middle[dceae28993ab1a32]::ty::context::tls::with_opt::<rustc_middle[dceae28993ab1a32]::util::bug::opt_span_bug_fmt<rustc_span[bdd546435e4bce71]::span_encoding::Span>::{closure#0}, !>::{closure#0}
13: 0x7f676201561b - rustc_middle[dceae28993ab1a32]::ty::context::tls::with_context_opt::<rustc_middle[dceae28993ab1a32]::ty::context::tls::with_opt<rustc_middle[dceae28993ab1a32]::util::bug::opt_span_bug_fmt<rustc_span[bdd546435e4bce71]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
14: 0x7f675f9cfe04 - rustc_middle[dceae28993ab1a32]::util::bug::bug_fmt
15: 0x7f676377fc50 - <rustc_trait_selection[677722ff3ec175c6]::traits::fulfill::FulfillProcessor as rustc_data_structures[94c88a1c28c3c4cc]::obligation_forest::ObligationProcessor>::process_obligation
16: 0x7f67630046e4 - <rustc_data_structures[94c88a1c28c3c4cc]::obligation_forest::ObligationForest<rustc_trait_selection[677722ff3ec175c6]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[677722ff3ec175c6]::traits::fulfill::FulfillProcessor>
17: 0x7f6763002bdf - <rustc_trait_selection[677722ff3ec175c6]::traits::fulfill::FulfillmentContext<rustc_infer[306238161a7f0bc9]::traits::engine::ScrubbedTraitError> as rustc_infer[306238161a7f0bc9]::traits::engine::TraitEngine<rustc_infer[306238161a7f0bc9]::traits::engine::ScrubbedTraitError>>::evaluate_obligations_error_on_ambiguity
18: 0x7f67645c98b5 - rustc_ty_utils[a0c51cdc47e3de8]::structural_match::has_structural_eq_impl
19: 0x7f67645c942b - rustc_query_impl[94cb984c31ae0c8e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[94cb984c31ae0c8e]::query_impl::has_structural_eq_impl::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dceae28993ab1a32]::query::erase::Erased<[u8; 1usize]>>
20: 0x7f67645c8efa - rustc_query_system[6a3016a52e4c2c98]::query::plumbing::try_execute_query::<rustc_query_impl[94cb984c31ae0c8e]::DynamicConfig<rustc_query_system[6a3016a52e4c2c98]::query::caches::DefaultCache<rustc_middle[dceae28993ab1a32]::ty::Ty, rustc_middle[dceae28993ab1a32]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[94cb984c31ae0c8e]::plumbing::QueryCtxt, false>
21: 0x7f67645c8c52 - rustc_query_impl[94cb984c31ae0c8e]::query_impl::has_structural_eq_impl::get_query_non_incr::__rust_end_short_backtrace
22: 0x7f67628102df - <rustc_trait_selection[677722ff3ec175c6]::error_reporting::TypeErrCtxt>::report_selection_error
23: 0x7f676134520e - <rustc_trait_selection[677722ff3ec175c6]::error_reporting::TypeErrCtxt>::report_fulfillment_errors
24: 0x7f67636dfe17 - rustc_hir_analysis[4469fe91bd5f7a5]::check::wfcheck::check_well_formed
25: 0x7f67636df7d7 - rustc_query_impl[94cb984c31ae0c8e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[94cb984c31ae0c8e]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dceae28993ab1a32]::query::erase::Erased<[u8; 1usize]>>
26: 0x7f67636df04d - rustc_query_system[6a3016a52e4c2c98]::query::plumbing::try_execute_query::<rustc_query_impl[94cb984c31ae0c8e]::DynamicConfig<rustc_data_structures[94c88a1c28c3c4cc]::vec_cache::VecCache<rustc_span[bdd546435e4bce71]::def_id::LocalDefId, rustc_middle[dceae28993ab1a32]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[6a3016a52e4c2c98]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[94cb984c31ae0c8e]::plumbing::QueryCtxt, false>
27: 0x7f67636deb56 - rustc_query_impl[94cb984c31ae0c8e]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
28: 0x7f67636dc2f0 - rustc_hir_analysis[4469fe91bd5f7a5]::check::wfcheck::check_type_wf
29: 0x7f67636dc1dd - rustc_query_impl[94cb984c31ae0c8e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[94cb984c31ae0c8e]::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dceae28993ab1a32]::query::erase::Erased<[u8; 1usize]>>
30: 0x7f6764162848 - rustc_query_system[6a3016a52e4c2c98]::query::plumbing::try_execute_query::<rustc_query_impl[94cb984c31ae0c8e]::DynamicConfig<rustc_query_system[6a3016a52e4c2c98]::query::caches::SingleCache<rustc_middle[dceae28993ab1a32]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[94cb984c31ae0c8e]::plumbing::QueryCtxt, false>
31: 0x7f676416260e - rustc_query_impl[94cb984c31ae0c8e]::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
32: 0x7f6763aec356 - rustc_hir_analysis[4469fe91bd5f7a5]::check_crate
33: 0x7f676322519b - rustc_interface[fa71a63d738bff6a]::passes::analysis
34: 0x7f6763224de7 - rustc_query_impl[94cb984c31ae0c8e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[94cb984c31ae0c8e]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dceae28993ab1a32]::query::erase::Erased<[u8; 0usize]>>
35: 0x7f6764164026 - rustc_query_system[6a3016a52e4c2c98]::query::plumbing::try_execute_query::<rustc_query_impl[94cb984c31ae0c8e]::DynamicConfig<rustc_query_system[6a3016a52e4c2c98]::query::caches::SingleCache<rustc_middle[dceae28993ab1a32]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[94cb984c31ae0c8e]::plumbing::QueryCtxt, false>
36: 0x7f6764163d88 - rustc_query_impl[94cb984c31ae0c8e]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
37: 0x7f6764336254 - <rustc_interface[fa71a63d738bff6a]::passes::create_and_enter_global_ctxt<core[ae121572cd1b547a]::option::Option<rustc_interface[fa71a63d738bff6a]::queries::Linker>, rustc_driver_impl[f421dd94c081429e]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[ae121572cd1b547a]::ops::function::FnOnce<(&rustc_session[300e9a40ce91b12d]::session::Session, rustc_middle[dceae28993ab1a32]::ty::context::CurrentGcx, alloc[abf3b1e21d0b7705]::sync::Arc<rustc_data_structures[94c88a1c28c3c4cc]::jobserver::Proxy>, &std[dc78c416db172f4a]::sync::once_lock::OnceLock<rustc_middle[dceae28993ab1a32]::ty::context::GlobalCtxt>, &rustc_data_structures[94c88a1c28c3c4cc]::sync::worker_local::WorkerLocal<rustc_middle[dceae28993ab1a32]::arena::Arena>, &rustc_data_structures[94c88a1c28c3c4cc]::sync::worker_local::WorkerLocal<rustc_hir[8ab5b6b069b3d6b7]::Arena>, rustc_driver_impl[f421dd94c081429e]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
38: 0x7f67641ce118 - rustc_interface[fa71a63d738bff6a]::interface::run_compiler::<(), rustc_driver_impl[f421dd94c081429e]::run_compiler::{closure#0}>::{closure#1}
39: 0x7f676404ec0e - std[dc78c416db172f4a]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[fa71a63d738bff6a]::util::run_in_thread_with_globals<rustc_interface[fa71a63d738bff6a]::util::run_in_thread_pool_with_globals<rustc_interface[fa71a63d738bff6a]::interface::run_compiler<(), rustc_driver_impl[f421dd94c081429e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
40: 0x7f676404e9e0 - <std[dc78c416db172f4a]::thread::lifecycle::spawn_unchecked<rustc_interface[fa71a63d738bff6a]::util::run_in_thread_with_globals<rustc_interface[fa71a63d738bff6a]::util::run_in_thread_pool_with_globals<rustc_interface[fa71a63d738bff6a]::interface::run_compiler<(), rustc_driver_impl[f421dd94c081429e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[ae121572cd1b547a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
41: 0x7f67640542b8 - <std[dc78c416db172f4a]::sys::thread::unix::Thread>::new::thread_start
42: 0x7f675da94ac3 - <unknown>
43: 0x7f675db268c0 - <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-2026-01-14T11_34_15-1.txt` to your bug report
note: rustc 1.94.0-nightly (b68e16cfc 2026-01-11) running on x86_64-unknown-linux-gnu
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 [has_structural_eq_impl] computing whether `Inner<N>` implements `StructuralPartialEq`
#1 [check_well_formed] checking that `Outer` 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 1 previous error
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the minimal example with the reported nightly compiler, then start at compiler/rustc_middle/src/ty/sty.rs:374 and follow the has_structural_eq_impl and check_well_formed query stack shown in the report. Done means the example no longer triggers an internal compiler error and the behavior is covered by an appropriate compiler regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100