Skip to content

ICE: xx has parameters, but no args were provided in instantiate #146752

@rucsesec

Description

@rucsesec

Code

#![feature(generic_const_exprs)]

trait TypeTrait {
    type Assoc;
}

struct A<const B: <dyn TypeTrait<Assoc = i32> as TypeTrait>::Assoc = 1, C>(C);

fn main() {}

Rust Version

rustc 1.92.0-nightly (a9d0a6f15 2025-09-16)
binary: rustc
commit-hash: a9d0a6f15533a364816c4d81e2192009ef601d33
commit-date: 2025-09-16
host: x86_64-unknown-linux-gnu
release: 1.92.0-nightly
LLVM version: 21.1.1

Current error output

error: generic parameters with a default must be trailing
 --> <source>:7:16
  |
7 | struct A<const B: <dyn TypeTrait<Assoc = i32> as TypeTrait>::Assoc = 1, C>(C);
  |                ^

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


thread 'rustc' (3) panicked at /rustc-dev/a454fccb02df9d361f1201b747c01257f58a8b37/compiler/rustc_type_ir/src/binder.rs:641:13:
Binder { value: TraitPredicate(<C as std::marker::Sized>, polarity:Positive), bound_vars: [] } has parameters, but no args were provided in instantiate

Backtrace

stack backtrace:
   0:     0x747bfca4bdf3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h830fbe15fbab381b
   1:     0x747bfd201b58 - core::fmt::write::hf661a9e75db120a3
   2:     0x747bfca00d71 - std::io::Write::write_fmt::he76c5adbbdfd1600
   3:     0x747bfca11d22 - std::sys::backtrace::BacktraceLock::print::hb87325f2dc6d4dfe
   4:     0x747bfca17c69 - std::panicking::default_hook::{{closure}}::h5e01ba9de3335cc4
   5:     0x747bfca17793 - std::panicking::default_hook::h47934e1f610fefc5
   6:     0x747bfba08797 - std[c207121dba9f4102]::panicking::update_hook::<alloc[fbc11b1b12ed36cd]::boxed::Box<rustc_driver_impl[d9438a736c8997f5]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x747bfca1808f - std::panicking::panic_with_hook::hfee0edaf348ac547
   8:     0x747bfca17e4a - std::panicking::panic_handler::{{closure}}::h6c6964ed9ca982a7
   9:     0x747bfca11e69 - std::sys::backtrace::__rust_end_short_backtrace::h232e83a0d4d66618
  10:     0x747bfc9f27ad - __rustc[b07eb43dc0c79c3a]::rust_begin_unwind
  11:     0x747bf90e71f0 - core::panicking::panic_fmt::he0731d8485d264bd
  12:     0x747bfd237f94 - <rustc_middle[ca952e998b261ea0]::ty::generics::GenericPredicates>::instantiate_into
  13:     0x747bfdaa9540 - <rustc_trait_selection[3e366344a3e1b36c]::traits::wf::WfPredicates>::nominal_obligations
  14:     0x747bfdab47da - <rustc_trait_selection[3e366344a3e1b36c]::traits::wf::WfPredicates as rustc_type_ir[a8998a4f8592c43f]::visit::TypeVisitor<rustc_middle[ca952e998b261ea0]::ty::context::TyCtxt>>::visit_const
  15:     0x747bfd980a0c - <rustc_trait_selection[3e366344a3e1b36c]::traits::fulfill::FulfillProcessor as rustc_data_structures[9517fc3c6a0ce3dd]::obligation_forest::ObligationProcessor>::process_obligation
  16:     0x747bfd204dc9 - <rustc_data_structures[9517fc3c6a0ce3dd]::obligation_forest::ObligationForest<rustc_trait_selection[3e366344a3e1b36c]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[3e366344a3e1b36c]::traits::fulfill::FulfillProcessor>
  17:     0x747bfda593aa - <rustc_trait_selection[3e366344a3e1b36c]::traits::fulfill::FulfillmentContext<rustc_trait_selection[3e366344a3e1b36c]::traits::FulfillmentError> as rustc_infer[892ccfba2d54b3f4]::traits::engine::TraitEngine<rustc_trait_selection[3e366344a3e1b36c]::traits::FulfillmentError>>::select_all_or_error
  18:     0x747bfda65b17 - rustc_hir_analysis[25a5ef209d74c11d]::check::wfcheck::check_type_defn
  19:     0x747bfdd957d7 - rustc_hir_analysis[25a5ef209d74c11d]::check::check::check_item_type
  20:     0x747bfdd901db - rustc_hir_analysis[25a5ef209d74c11d]::check::wfcheck::check_well_formed
  21:     0x747bfdd901a3 - rustc_query_impl[d2194a968fe82a14]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d2194a968fe82a14]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ca952e998b261ea0]::query::erase::Erased<[u8; 1usize]>>
  22:     0x747bfdd8f9e3 - rustc_query_system[8aa47809e78cb5f0]::query::plumbing::try_execute_query::<rustc_query_impl[d2194a968fe82a14]::DynamicConfig<rustc_data_structures[9517fc3c6a0ce3dd]::vec_cache::VecCache<rustc_span[acd9e562735339de]::def_id::LocalDefId, rustc_middle[ca952e998b261ea0]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[8aa47809e78cb5f0]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[d2194a968fe82a14]::plumbing::QueryCtxt, false>
  23:     0x747bfdd8f502 - rustc_query_impl[d2194a968fe82a14]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  24:     0x747bfdd8cab5 - rustc_hir_analysis[25a5ef209d74c11d]::check::wfcheck::check_type_wf
  25:     0x747bfdd8c9a7 - rustc_query_impl[d2194a968fe82a14]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d2194a968fe82a14]::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ca952e998b261ea0]::query::erase::Erased<[u8; 1usize]>>
  26:     0x747bfe337794 - rustc_query_system[8aa47809e78cb5f0]::query::plumbing::try_execute_query::<rustc_query_impl[d2194a968fe82a14]::DynamicConfig<rustc_query_system[8aa47809e78cb5f0]::query::caches::SingleCache<rustc_middle[ca952e998b261ea0]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[d2194a968fe82a14]::plumbing::QueryCtxt, false>
  27:     0x747bfe337576 - rustc_query_impl[d2194a968fe82a14]::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
  28:     0x747bfd48b5fa - rustc_hir_analysis[25a5ef209d74c11d]::check_crate
  29:     0x747bfd49c87e - rustc_interface[3a2987949cdbb48a]::passes::analysis
  30:     0x747bfd49c54b - rustc_query_impl[d2194a968fe82a14]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d2194a968fe82a14]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ca952e998b261ea0]::query::erase::Erased<[u8; 0usize]>>
  31:     0x747bfe33e208 - rustc_query_system[8aa47809e78cb5f0]::query::plumbing::try_execute_query::<rustc_query_impl[d2194a968fe82a14]::DynamicConfig<rustc_query_system[8aa47809e78cb5f0]::query::caches::SingleCache<rustc_middle[ca952e998b261ea0]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[d2194a968fe82a14]::plumbing::QueryCtxt, false>
  32:     0x747bfe33de3e - rustc_query_impl[d2194a968fe82a14]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  33:     0x747bfe57d063 - rustc_interface[3a2987949cdbb48a]::passes::create_and_enter_global_ctxt::<core[c97f7de45acf1cc9]::option::Option<rustc_interface[3a2987949cdbb48a]::queries::Linker>, rustc_driver_impl[d9438a736c8997f5]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  34:     0x747bfe4c10fe - rustc_interface[3a2987949cdbb48a]::interface::run_compiler::<(), rustc_driver_impl[d9438a736c8997f5]::run_compiler::{closure#0}>::{closure#1}
  35:     0x747bfe3f5b38 - std[c207121dba9f4102]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[3a2987949cdbb48a]::util::run_in_thread_with_globals<rustc_interface[3a2987949cdbb48a]::util::run_in_thread_pool_with_globals<rustc_interface[3a2987949cdbb48a]::interface::run_compiler<(), rustc_driver_impl[d9438a736c8997f5]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  36:     0x747bfe3f581c - <<std[c207121dba9f4102]::thread::Builder>::spawn_unchecked_<rustc_interface[3a2987949cdbb48a]::util::run_in_thread_with_globals<rustc_interface[3a2987949cdbb48a]::util::run_in_thread_pool_with_globals<rustc_interface[3a2987949cdbb48a]::interface::run_compiler<(), rustc_driver_impl[d9438a736c8997f5]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[c97f7de45acf1cc9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  37:     0x747bfe3fbecd - std::sys::thread::unix::Thread::new::thread_start::h44739fe3c92fa2b0
  38:     0x747bf7a94ac3 - <unknown>
  39:     0x747bf7b26850 - <unknown>
  40:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

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-09-19T06_35_16-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 [check_well_formed] checking that `A` is well-formed
#1 [check_type_wf] checking that types are well-formed
... and 1 other queries... use `env RUST_BACKTRACE=1` to see the full query stack
error: aborting due to 1 previous error; 1 warning emitted

Anything else?

The only open issue I found that is similar to this ICE error message is #143205, but there are some differences between them. I'm not sure if it's a duplicate issue.

It is more similar to #114317, but that one has already been closed.

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