rust-lang / rust-lang/rust

[ICE]: did not expect duplicate `ConstParamHasTy` for `!BoundConst .. in param-env

Open
#162,776 1 comment 0 reactions 1 assignee View on GitHub

@biscuitrescue is already working on this.

Since Sep 14, 2026.

C-bug F-fn_delegation I-ICE needs-triage T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

auto-reduced (treereduce-rust):

struct S<A, const C: usize>;

impl<'b, 'c, C, const C: usize> S<C, C> {
    fn foo_self<T>() {}
}

reuse S::<(), 123>::foo_self ;

original:

#![feature(fn_delegation)]

struct S<A, const C: usize>;

impl<'b, 'c, C, const C: usize> S<C, C> {
    fn foo_self<T, const B: bool>() {}
}

reuse S::<(), 123>::foo_self ;

fn main() {}


Version information

rustc 1.100.0-nightly (a8a1e6fd9 2026-09-14)
binary: rustc
commit-hash: a8a1e6fd9df2e094d6f09c0d57991508680acc1c
commit-date: 2026-09-14
host: x86_64-unknown-linux-gnu
release: 1.100.0-nightly
LLVM version: 23.1.1

Possibly related line of code:
https://github.com/rust-lang/rust/blob/a8a1e6fd9df2e094d6f09c0d57991508680acc1c/compiler/rustc_type_ir/src/binder.rs#L826-L838

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

Program output

error[E0403]: the name `C` is already used for a generic parameter in this item's generic parameters
 --> /tmp/icemaker_global_tempdir.kd6F3Ltfxebv/rustc_testrunner_tmpdir_reporting.Fb803AuC7DnC/mvce.rs:3:23
  |
3 | impl<'b, 'c, C, const C: usize> S<C, C> {
  |              -        ^ already used
  |              |
  |              first use of `C`

error[E0658]: functions delegation is not yet fully implemented
 --> /tmp/icemaker_global_tempdir.kd6F3Ltfxebv/rustc_testrunner_tmpdir_reporting.Fb803AuC7DnC/mvce.rs:7:1
  |
7 | reuse S::<(), 123>::foo_self ;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #118212 <https://github.com/rust-lang/rust/issues/118212> for more information
  = help: add `#![feature(fn_delegation)]` to the crate attributes to enable
  = note: this compiler was built on 2026-09-14; consider upgrading it if it is out of date

error[E0747]: type provided when a constant was expected
 --> /tmp/icemaker_global_tempdir.kd6F3Ltfxebv/rustc_testrunner_tmpdir_reporting.Fb803AuC7DnC/mvce.rs:3:38
  |
3 | impl<'b, 'c, C, const C: usize> S<C, C> {
  |                                      ^
  |
help: consider changing this type parameter to a const parameter
  |
3 - impl<'b, 'c, C, const C: usize> S<C, C> {
3 + impl<'b, 'c, const C: usize, const C: usize> S<C, C> {
  |

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.kd6F3Ltfxebv/rustc_testrunner_tmpdir_reporting.Fb803AuC7DnC/mvce.rs:7:31
  |
7 | reuse S::<(), 123>::foo_self ;
  |                               ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.kd6F3Ltfxebv/rustc_testrunner_tmpdir_reporting.Fb803AuC7DnC/mvce.rs`

error[E0392]: type parameter `A` is never used
 --> /tmp/icemaker_global_tempdir.kd6F3Ltfxebv/rustc_testrunner_tmpdir_reporting.Fb803AuC7DnC/mvce.rs:1:10
  |
1 | struct S<A, const C: usize>;
  |          ^ unused type parameter
  |
  = help: consider removing `A`, referring to it in a field, or using a marker such as `PhantomData`
  = help: if you intended `A` to be a const parameter, use `const A: /* Type */` instead


thread 'rustc' (398858) panicked at /rustc-dev/a8a1e6fd9df2e094d6f09c0d57991508680acc1c/compiler/rustc_type_ir/src/binder.rs:832:9:
const parameter `C/#3` (C/#3/3) out of range when instantiating args=[(), 123_usize, T/#0]
stack backtrace:
   0:     0x7f8a2ee3f2d6 - <<std[a7b27443cb86e72e]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[79c33294d41ca149]::fmt::Display>::fmt
   1:     0x7f8a2f40984f - core[79c33294d41ca149]::fmt::write
   2:     0x7f8a2ee542ac - <std[a7b27443cb86e72e]::sys::stdio::unix::Stderr as core[79c33294d41ca149]::io::write::Write>::write_fmt
   3:     0x7f8a2ee11dda - std[a7b27443cb86e72e]::panicking::default_hook::{closure#0}
   4:     0x7f8a2ee33883 - std[a7b27443cb86e72e]::panicking::default_hook
   5:     0x7f8a2db60c1f - std[a7b27443cb86e72e]::panicking::update_hook::<alloc[3f0bce58745c44b0]::boxed::Box<rustc_driver_impl[d9671ccd84038dcc]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f8a2ee33d22 - std[a7b27443cb86e72e]::panicking::panic_with_hook
   7:     0x7f8a2ee11e92 - std[a7b27443cb86e72e]::panicking::panic_handler::{closure#0}
   8:     0x7f8a2ee0aca9 - std[a7b27443cb86e72e]::sys::backtrace::__rust_end_short_backtrace::<std[a7b27443cb86e72e]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f8a2ee13a6d - __rustc[bcd6120e59dddf0]::rust_begin_unwind
  10:     0x7f8a2b877c2c - core[79c33294d41ca149]::panicking::panic_fmt
  11:     0x7f8a2e247b05 - <rustc_type_ir[b90822c65e3927f6]::binder::ArgFolder<rustc_middle[d55d5a36bb0d2487]::ty::context::TyCtxt>>::const_param_out_of_range
  12:     0x7f8a2f4c7701 - <rustc_type_ir[b90822c65e3927f6]::binder::ArgFolder<rustc_middle[d55d5a36bb0d2487]::ty::context::TyCtxt> as rustc_type_ir[b90822c65e3927f6]::fold::TypeFolder<rustc_middle[d55d5a36bb0d2487]::ty::context::TyCtxt>>::fold_const
  13:     0x7f8a2dc822ff - <rustc_type_ir[b90822c65e3927f6]::binder::EarlyBinder<rustc_middle[d55d5a36bb0d2487]::ty::context::TyCtxt, rustc_middle[d55d5a36bb0d2487]::ty::consts::Const>>::instantiate::<&[rustc_middle[d55d5a36bb0d2487]::ty::generic_args::GenericArg]>
  14:     0x7f8a2dc43994 - <rustc_hir_analysis[c48a938ba26deb33]::delegation::inherit_clauses_for_delegation_item::ClausesCollector>::with_own_clauses::<rustc_hir_analysis[c48a938ba26deb33]::delegation::inherit_clauses_for_delegation_item::{closure#0}>
  15:     0x7f8a2dd3bb28 - rustc_hir_analysis[c48a938ba26deb33]::delegation::inherit_clauses_for_delegation_item
  16:     0x7f8a305d8aa7 - rustc_hir_analysis[c48a938ba26deb33]::collect::clauses_of::gather_explicit_clauses_of
  17:     0x7f8a2f84616e - rustc_query_impl[efa7ca13a3339b39]::query_vtables::explicit_clauses_of::invoke_provider_fn::__rust_begin_short_backtrace
  18:     0x7f8a2f847707 - rustc_query_impl[efa7ca13a3339b39]::execution::try_execute_query::<rustc_middle[d55d5a36bb0d2487]::query::caches::DefIdCache<rustc_middle[d55d5a36bb0d2487]::query::erase::ErasedData<[u8; 24usize]>>, false>
  19:     0x7f8a2f84727d - rustc_query_impl[efa7ca13a3339b39]::query_vtables::explicit_clauses_of::execute_query_non_incr::__rust_end_short_backtrace
  20:     0x7f8a2f848545 - rustc_query_impl[efa7ca13a3339b39]::query_vtables::clauses_of::invoke_provider_fn::__rust_begin_short_backtrace
  21:     0x7f8a2f8475ad - rustc_query_impl[efa7ca13a3339b39]::execution::try_execute_query::<rustc_middle[d55d5a36bb0d2487]::query::caches::DefIdCache<rustc_middle[d55d5a36bb0d2487]::query::erase::ErasedData<[u8; 24usize]>>, false>
  22:     0x7f8a2f847239 - rustc_query_impl[efa7ca13a3339b39]::query_vtables::clauses_of::execute_query_non_incr::__rust_end_short_backtrace
  23:     0x7f8a30213eb8 - rustc_hir_analysis[c48a938ba26deb33]::check::check::check_item_type
  24:     0x7f8a3020efb8 - rustc_hir_analysis[c48a938ba26deb33]::check::wfcheck::check_well_formed
  25:     0x7f8a3020ef99 - rustc_query_impl[efa7ca13a3339b39]::query_vtables::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
  26:     0x7f8a3020e5fd - rustc_query_impl[efa7ca13a3339b39]::execution::try_execute_query::<rustc_data_structures[f8e48b9204458190]::vec_cache::VecCache<rustc_span[ed161bac8b76d3dd]::def_id::LocalDefId, rustc_middle[d55d5a36bb0d2487]::query::erase::ErasedData<[u8; 1usize]>, rustc_middle[d55d5a36bb0d2487]::dep_graph::graph::DepNodeIndex>, false>
  27:     0x7f8a3020e395 - rustc_query_impl[efa7ca13a3339b39]::query_vtables::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
  28:     0x7f8a3020b942 - rustc_hir_analysis[c48a938ba26deb33]::check::wfcheck::check_type_wf
  29:     0x7f8a3020b827 - rustc_query_impl[efa7ca13a3339b39]::query_vtables::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
  30:     0x7f8a304ec509 - rustc_query_impl[efa7ca13a3339b39]::execution::try_execute_query::<rustc_middle[d55d5a36bb0d2487]::query::caches::SingleCache<rustc_middle[d55d5a36bb0d2487]::query::erase::ErasedData<[u8; 1usize]>>, false>
  31:     0x7f8a304ec2ed - rustc_query_impl[efa7ca13a3339b39]::query_vtables::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
  32:     0x7f8a2fbf2f5a - rustc_hir_analysis[c48a938ba26deb33]::check_crate
  33:     0x7f8a2f9af7b3 - rustc_interface[e79ce05d4d9d9ef5]::passes::analysis
  34:     0x7f8a304ebc4a - rustc_query_impl[efa7ca13a3339b39]::execution::try_execute_query::<rustc_middle[d55d5a36bb0d2487]::query::caches::SingleCache<rustc_middle[d55d5a36bb0d2487]::query::erase::ErasedData<[u8; 0usize]>>, false>
  35:     0x7f8a304eb9d3 - rustc_query_impl[efa7ca13a3339b39]::query_vtables::analysis::execute_query_non_incr::__rust_end_short_backtrace
  36:     0x7f8a306d476c - rustc_interface[e79ce05d4d9d9ef5]::interface::run_compiler::<(), rustc_driver_impl[d9671ccd84038dcc]::run_compiler::{closure#0}>::{closure#2}
  37:     0x7f8a3072c324 - std[a7b27443cb86e72e]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[e79ce05d4d9d9ef5]::util::run_in_thread_with_globals<rustc_interface[e79ce05d4d9d9ef5]::util::run_in_thread_pool_with_globals<rustc_interface[e79ce05d4d9d9ef5]::interface::run_compiler<(), rustc_driver_impl[d9671ccd84038dcc]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  38:     0x7f8a3072c0cb - <std[a7b27443cb86e72e]::thread::lifecycle::spawn_unchecked<rustc_interface[e79ce05d4d9d9ef5]::util::run_in_thread_with_globals<rustc_interface[e79ce05d4d9d9ef5]::util::run_in_thread_pool_with_globals<rustc_interface[e79ce05d4d9d9ef5]::interface::run_compiler<(), rustc_driver_impl[d9671ccd84038dcc]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[79c33294d41ca149]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  39:     0x7f8a30734fdb - <std[a7b27443cb86e72e]::sys::thread::unix::Thread>::new::thread_start
  40:     0x7f8a296980a2 - <unknown>
  41:     0x7f8a2972080c - <unknown>
  42:                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: rustc 1.100.0-nightly (a8a1e6fd9 2026-09-14) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [explicit_clauses_of] computing explicit predicates of `foo_self`
#1 [clauses_of] computing clauses of `foo_self`
#2 [check_well_formed] checking that `foo_self` 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 5 previous errors

Some errors have detailed explanations: E0392, E0403, E0601, E0658, E0747.
For more information about an error, try `rustc --explain E0392`.

@rustbot label +F-fn_delegation

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.