thread 'rustc' (3) panicked at /rustc-dev/86a49fd71fecd25b0fd20247db0ba95eeceaba28/compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs:622:20:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
0: 0x7f7f78844783 - <<std[99a77fcd2881e1e7]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[270d1373c8f6a07d]::fmt::Display>::fmt
1: 0x7f7f78e0e35c - core[270d1373c8f6a07d]::fmt::write
2: 0x7f7f7885b186 - <std[99a77fcd2881e1e7]::sys::stdio::unix::Stderr as std[99a77fcd2881e1e7]::io::Write>::write_fmt
3: 0x7f7f7881a688 - std[99a77fcd2881e1e7]::panicking::default_hook::{closure#0}
4: 0x7f7f78837d83 - std[99a77fcd2881e1e7]::panicking::default_hook
5: 0x7f7f7781b63a - std[99a77fcd2881e1e7]::panicking::update_hook::<alloc[206d51544a00c3e8]::boxed::Box<rustc_driver_impl[20c567ab0eec109e]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7f7f78838062 - std[99a77fcd2881e1e7]::panicking::panic_with_hook
7: 0x7f7f7881a748 - std[99a77fcd2881e1e7]::panicking::panic_handler::{closure#0}
8: 0x7f7f7880ec59 - std[99a77fcd2881e1e7]::sys::backtrace::__rust_end_short_backtrace::<std[99a77fcd2881e1e7]::panicking::panic_handler::{closure#0}, !>
9: 0x7f7f7881c21d - __rustc[e1bf4ce096729b3a]::rust_begin_unwind
10: 0x7f7f75cc8c5c - core[270d1373c8f6a07d]::panicking::panic_fmt
11: 0x7f7f7588bce3 - core[270d1373c8f6a07d]::panicking::panic_bounds_check
12: 0x7f7f7965fb7d - <dyn rustc_hir_analysis[ce7edadf7d88a9df]::hir_ty_lowering::HirTyLowerer>::lower_generic_args_of_path::{closure#0}
13: 0x7f7f779c6230 - <dyn rustc_hir_analysis[ce7edadf7d88a9df]::hir_ty_lowering::HirTyLowerer>::lower_generic_args_of_path_segment
14: 0x7f7f7aa5e1dc - <dyn rustc_hir_analysis[ce7edadf7d88a9df]::hir_ty_lowering::HirTyLowerer>::lower_resolved_const_path.cold
15: 0x7f7f7965e484 - <dyn rustc_hir_analysis[ce7edadf7d88a9df]::hir_ty_lowering::HirTyLowerer>::lower_generic_args_of_path::{closure#0}
16: 0x7f7f79663da7 - <dyn rustc_hir_analysis[ce7edadf7d88a9df]::hir_ty_lowering::HirTyLowerer>::lower_poly_trait_ref
17: 0x7f7f79709cbd - rustc_hir_analysis[ce7edadf7d88a9df]::collect::predicates_of::gather_explicit_predicates_of::{closure#0}
18: 0x7f7f79707f00 - rustc_query_impl[5d03519af14689dc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5d03519af14689dc]::query_impl::explicit_predicates_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2e386638a360c90c]::query::erase::Erased<[u8; 24usize]>>
19: 0x7f7f78f6b11a - rustc_query_system[eed45c866303c690]::query::plumbing::try_execute_query::<rustc_query_impl[5d03519af14689dc]::DynamicConfig<rustc_query_system[eed45c866303c690]::query::caches::DefIdCache<rustc_middle[2e386638a360c90c]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[5d03519af14689dc]::plumbing::QueryCtxt, false>
20: 0x7f7f78f6aa22 - rustc_query_impl[5d03519af14689dc]::query_impl::explicit_predicates_of::get_query_non_incr::__rust_end_short_backtrace
21: 0x7f7f78f69651 - rustc_query_impl[5d03519af14689dc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5d03519af14689dc]::query_impl::predicates_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2e386638a360c90c]::query::erase::Erased<[u8; 24usize]>>
22: 0x7f7f78f6b139 - rustc_query_system[eed45c866303c690]::query::plumbing::try_execute_query::<rustc_query_impl[5d03519af14689dc]::DynamicConfig<rustc_query_system[eed45c866303c690]::query::caches::DefIdCache<rustc_middle[2e386638a360c90c]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[5d03519af14689dc]::plumbing::QueryCtxt, false>
23: 0x7f7f78f6a922 - rustc_query_impl[5d03519af14689dc]::query_impl::predicates_of::get_query_non_incr::__rust_end_short_backtrace
24: 0x7f7f79db3985 - <rustc_trait_selection[b005c1927c673c5a]::traits::select::SelectionContext>::assemble_candidates_from_impls
25: 0x7f7f78e872ec - <rustc_trait_selection[b005c1927c673c5a]::traits::select::SelectionContext>::candidate_from_obligation::{closure#0}::{closure#0}
26: 0x7f7f7a05d98f - <rustc_trait_selection[b005c1927c673c5a]::traits::select::SelectionContext>::poly_select::{closure#0}
27: 0x7f7f79584f38 - <rustc_trait_selection[b005c1927c673c5a]::traits::fulfill::FulfillProcessor as rustc_data_structures[d4baafc84bef5099]::obligation_forest::ObligationProcessor>::process_obligation
28: 0x7f7f78e04724 - <rustc_data_structures[d4baafc84bef5099]::obligation_forest::ObligationForest<rustc_trait_selection[b005c1927c673c5a]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[b005c1927c673c5a]::traits::fulfill::FulfillProcessor>
29: 0x7f7f798224be - <rustc_trait_selection[b005c1927c673c5a]::traits::fulfill::FulfillmentContext<rustc_trait_selection[b005c1927c673c5a]::traits::FulfillmentError> as rustc_infer[7c27d8c17c7f8d6a]::traits::engine::TraitEngine<rustc_trait_selection[b005c1927c673c5a]::traits::FulfillmentError>>::evaluate_obligations_error_on_ambiguity
30: 0x7f7f797ea9f8 - rustc_hir_analysis[ce7edadf7d88a9df]::check::wfcheck::check_trait
31: 0x7f7f794d960d - rustc_hir_analysis[ce7edadf7d88a9df]::check::check::check_item_type
32: 0x7f7f794d1d76 - rustc_hir_analysis[ce7edadf7d88a9df]::check::wfcheck::check_well_formed
33: 0x7f7f794d1d57 - rustc_query_impl[5d03519af14689dc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5d03519af14689dc]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2e386638a360c90c]::query::erase::Erased<[u8; 1usize]>>
34: 0x7f7f794d15cd - rustc_query_system[eed45c866303c690]::query::plumbing::try_execute_query::<rustc_query_impl[5d03519af14689dc]::DynamicConfig<rustc_data_structures[d4baafc84bef5099]::vec_cache::VecCache<rustc_span[75f1283d4e19c02c]::def_id::LocalDefId, rustc_middle[2e386638a360c90c]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[eed45c866303c690]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[5d03519af14689dc]::plumbing::QueryCtxt, false>
35: 0x7f7f794d10d6 - rustc_query_impl[5d03519af14689dc]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
36: 0x7f7f794ce870 - rustc_hir_analysis[ce7edadf7d88a9df]::check::wfcheck::check_type_wf
37: 0x7f7f794ce75d - rustc_query_impl[5d03519af14689dc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5d03519af14689dc]::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2e386638a360c90c]::query::erase::Erased<[u8; 1usize]>>
38: 0x7f7f79fcd588 - rustc_query_system[eed45c866303c690]::query::plumbing::try_execute_query::<rustc_query_impl[5d03519af14689dc]::DynamicConfig<rustc_query_system[eed45c866303c690]::query::caches::SingleCache<rustc_middle[2e386638a360c90c]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[5d03519af14689dc]::plumbing::QueryCtxt, false>
39: 0x7f7f79fcd34e - rustc_query_impl[5d03519af14689dc]::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
40: 0x7f7f79884456 - rustc_hir_analysis[ce7edadf7d88a9df]::check_crate
41: 0x7f7f790f4c1b - rustc_interface[4190908c685cc231]::passes::analysis
42: 0x7f7f790f4871 - rustc_query_impl[5d03519af14689dc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5d03519af14689dc]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2e386638a360c90c]::query::erase::Erased<[u8; 0usize]>>
43: 0x7f7f79fced66 - rustc_query_system[eed45c866303c690]::query::plumbing::try_execute_query::<rustc_query_impl[5d03519af14689dc]::DynamicConfig<rustc_query_system[eed45c866303c690]::query::caches::SingleCache<rustc_middle[2e386638a360c90c]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[5d03519af14689dc]::plumbing::QueryCtxt, false>
44: 0x7f7f79fceac8 - rustc_query_impl[5d03519af14689dc]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
45: 0x7f7f7a1c0c91 - <rustc_interface[4190908c685cc231]::passes::create_and_enter_global_ctxt<core[270d1373c8f6a07d]::option::Option<rustc_interface[4190908c685cc231]::queries::Linker>, rustc_driver_impl[20c567ab0eec109e]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[270d1373c8f6a07d]::ops::function::FnOnce<(&rustc_session[b1a887d3ceadb98b]::session::Session, rustc_middle[2e386638a360c90c]::ty::context::CurrentGcx, alloc[206d51544a00c3e8]::sync::Arc<rustc_data_structures[d4baafc84bef5099]::jobserver::Proxy>, &std[99a77fcd2881e1e7]::sync::once_lock::OnceLock<rustc_middle[2e386638a360c90c]::ty::context::GlobalCtxt>, &rustc_data_structures[d4baafc84bef5099]::sync::worker_local::WorkerLocal<rustc_middle[2e386638a360c90c]::arena::Arena>, &rustc_data_structures[d4baafc84bef5099]::sync::worker_local::WorkerLocal<rustc_hir[a0f10157905e5583]::Arena>, rustc_driver_impl[20c567ab0eec109e]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
46: 0x7f7f7a041715 - rustc_interface[4190908c685cc231]::interface::run_compiler::<(), rustc_driver_impl[20c567ab0eec109e]::run_compiler::{closure#0}>::{closure#1}
47: 0x7f7f79f8d18e - std[99a77fcd2881e1e7]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[4190908c685cc231]::util::run_in_thread_with_globals<rustc_interface[4190908c685cc231]::util::run_in_thread_pool_with_globals<rustc_interface[4190908c685cc231]::interface::run_compiler<(), rustc_driver_impl[20c567ab0eec109e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
48: 0x7f7f79f8cf60 - <std[99a77fcd2881e1e7]::thread::lifecycle::spawn_unchecked<rustc_interface[4190908c685cc231]::util::run_in_thread_with_globals<rustc_interface[4190908c685cc231]::util::run_in_thread_pool_with_globals<rustc_interface[4190908c685cc231]::interface::run_compiler<(), rustc_driver_impl[20c567ab0eec109e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[270d1373c8f6a07d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
49: 0x7f7f79f8ed04 - <std[99a77fcd2881e1e7]::sys::thread::unix::Thread>::new::thread_start
50: 0x7f7f73894ac3 - <unknown>
51: 0x7f7f739268c0 - <unknown>
52: 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-2026-01-16T01_31_44-1.txt` to your bug report
note: rustc 1.94.0-nightly (86a49fd71 2026-01-14) 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 [explicit_predicates_of] computing explicit predicates of `<impl at <source>:11:1: 11:49>`
#1 [predicates_of] computing predicates of `<impl at <source>:11:1: 11:49>`
#2 [check_well_formed] checking that `Maybe` is well-formed
#3 [check_type_wf] checking that types are well-formed
#4 [analysis] running analysis passes on crate `example`
end of query stack
error: using function pointers as const generic parameters is forbidden
--> <source>:7:24
|
7 | trait MyTrait<const F: fn() -> ()> {}
| ^^^^^^^^^^
|
= note: the only supported types are integers, `bool`, and `char`
error: aborting due to 1 previous error
I searched using the "F-min_generic_const_args" label and the keyword "index out of bounds", but I haven't found any similar issues so far.
Code
Meta
rustc --version --verbose:Program Output