rust-lang / rust-lang/rust

ICE : `not yet implemented: Iterator is not yet const`

Open
#153,195 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug I-ICE needs-triage WG-trait-system-refactor
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried this code:

//@compile-flags: -Znext-solver=globally
trait KeySchema {
    const KEYS: & [& str];
    
}
const fn construct_successor_array<T: KeySchema, >() -> [& str; compute_successor_size::<T>()] {
    let tail_keys = T::KEYS;
    for (i, ) in tail_keys.iter().enumerate() {
    }
}
fn main(){}
Meta

rustc --version --verbose:

rustc 1.95.0-nightly (6a979b3e3 2026-02-26)
binary: rustc
commit-hash: 6a979b3e32522049d0acb4a47f7ae44b7c8abfd5
commit-date: 2026-02-26
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 22.1.0
Backtrace

thread 'rustc' panicked at /rustc-dev/6a979b3e32522049d0acb4a47f7ae44b7c8abfd5/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs:358:9:
not yet implemented: Iterator is not yet const
stack backtrace:
   0:     0x7f9071dba08b - <std[a42f3b87e642314d]::backtrace::Backtrace>::create
   1:     0x7f9071db9fd5 - <std[a42f3b87e642314d]::backtrace::Backtrace>::force_capture
   2:     0x7f9070db33b4 - std[a42f3b87e642314d]::panicking::update_hook::<alloc[bf50147f3a277199]::boxed::Box<rustc_driver_impl[b2dff6da787942eb]::install_ice_hook::{closure#1}>>::{closure#0}
   3:     0x7f9071dcc602 - std[a42f3b87e642314d]::panicking::panic_with_hook
   4:     0x7f9071daf08a - std[a42f3b87e642314d]::panicking::panic_handler::{closure#0}
   5:     0x7f9071da35a9 - std[a42f3b87e642314d]::sys::backtrace::__rust_end_short_backtrace::<std[a42f3b87e642314d]::panicking::panic_handler::{closure#0}, !>
   6:     0x7f9071db0abd - __rustc[12c998373637a003]::rust_begin_unwind
   7:     0x7f906eb7df9c - core[fe7c17ffc1da903f]::panicking::panic_fmt
   8:     0x7f90739f6889 - <rustc_next_trait_solver[8d952b094deec32a]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d548f1357b902480]::solve::delegate::SolverDelegate, rustc_middle[11b273479f5b7c30]::ty::context::TyCtxt>>::assemble_and_evaluate_candidates::<rustc_type_ir[379519b7c7821119]::predicate::HostEffectPredicate<rustc_middle[11b273479f5b7c30]::ty::context::TyCtxt>>
   9:     0x7f90739f5897 - <rustc_next_trait_solver[8d952b094deec32a]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d548f1357b902480]::solve::delegate::SolverDelegate, rustc_middle[11b273479f5b7c30]::ty::context::TyCtxt>>::compute_host_effect_goal
  10:     0x7f9073389534 - <rustc_next_trait_solver[8d952b094deec32a]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[d548f1357b902480]::solve::delegate::SolverDelegate> as rustc_type_ir[379519b7c7821119]::search_graph::Delegate>::compute_goal::{closure#0}
  11:     0x7f907338776b - <rustc_type_ir[379519b7c7821119]::search_graph::SearchGraph<rustc_next_trait_solver[8d952b094deec32a]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[d548f1357b902480]::solve::delegate::SolverDelegate>, rustc_middle[11b273479f5b7c30]::ty::context::TyCtxt>>::evaluate_goal::{closure#0}::{closure#2}
  12:     0x7f9072e771b9 - <rustc_next_trait_solver[8d952b094deec32a]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d548f1357b902480]::solve::delegate::SolverDelegate, rustc_middle[11b273479f5b7c30]::ty::context::TyCtxt>>::evaluate_goal_raw
  13:     0x7f907306ae06 - <rustc_next_trait_solver[8d952b094deec32a]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d548f1357b902480]::solve::delegate::SolverDelegate, rustc_middle[11b273479f5b7c30]::ty::context::TyCtxt>>::try_evaluate_added_goals
  14:     0x7f9072e855f1 - <rustc_next_trait_solver[8d952b094deec32a]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d548f1357b902480]::solve::delegate::SolverDelegate, rustc_middle[11b273479f5b7c30]::ty::context::TyCtxt>>::evaluate_added_goals_and_make_canonical_response
  15:     0x7f90739ee25d - <rustc_next_trait_solver[8d952b094deec32a]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d548f1357b902480]::solve::delegate::SolverDelegate, rustc_middle[11b273479f5b7c30]::ty::context::TyCtxt>>::assemble_impl_candidates::<rustc_type_ir[379519b7c7821119]::predicate::HostEffectPredicate<rustc_middle[11b273479f5b7c30]::ty::context::TyCtxt>>::{closure#0}
  16:     0x7f90739f7653 - <rustc_next_trait_solver[8d952b094deec32a]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d548f1357b902480]::solve::delegate::SolverDelegate, rustc_middle[11b273479f5b7c30]::ty::context::TyCtxt>>::assemble_and_evaluate_candidates::<rustc_type_ir[379519b7c7821119]::predicate::HostEffectPredicate<rustc_middle[11b273479f5b7c30]::ty::context::TyCtxt>>
  17:     0x7f90739f5897 - <rustc_next_trait_solver[8d952b094deec32a]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d548f1357b902480]::solve::delegate::SolverDelegate, rustc_middle[11b273479f5b7c30]::ty::context::TyCtxt>>::compute_host_effect_goal
  18:     0x7f9073389534 - <rustc_next_trait_solver[8d952b094deec32a]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[d548f1357b902480]::solve::delegate::SolverDelegate> as rustc_type_ir[379519b7c7821119]::search_graph::Delegate>::compute_goal::{closure#0}
  19:     0x7f907338776b - <rustc_type_ir[379519b7c7821119]::search_graph::SearchGraph<rustc_next_trait_solver[8d952b094deec32a]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[d548f1357b902480]::solve::delegate::SolverDelegate>, rustc_middle[11b273479f5b7c30]::ty::context::TyCtxt>>::evaluate_goal::{closure#0}::{closure#2}
  20:     0x7f9072e771b9 - <rustc_next_trait_solver[8d952b094deec32a]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d548f1357b902480]::solve::delegate::SolverDelegate, rustc_middle[11b273479f5b7c30]::ty::context::TyCtxt>>::evaluate_goal_raw
  21:     0x7f90730659e5 - <rustc_trait_selection[d548f1357b902480]::solve::fulfill::FulfillmentCtxt<rustc_trait_selection[d548f1357b902480]::traits::FulfillmentError> as rustc_infer[7061af908568ad8f]::traits::engine::TraitEngine<rustc_trait_selection[d548f1357b902480]::traits::FulfillmentError>>::try_evaluate_obligations
  22:     0x7f9072820655 - <rustc_hir_typeck[c30244052031a4ef]::fn_ctxt::FnCtxt>::check_expr_call
  23:     0x7f9072803f50 - <rustc_hir_typeck[c30244052031a4ef]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  24:     0x7f90727dd4e5 - <rustc_hir_typeck[c30244052031a4ef]::fn_ctxt::FnCtxt>::check_expr_match
  25:     0x7f907280533b - <rustc_hir_typeck[c30244052031a4ef]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  26:     0x7f9072805915 - <rustc_hir_typeck[c30244052031a4ef]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  27:     0x7f90727fe170 - <rustc_hir_typeck[c30244052031a4ef]::fn_ctxt::FnCtxt>::check_expr_block
  28:     0x7f9072803ed7 - <rustc_hir_typeck[c30244052031a4ef]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  29:     0x7f90727d2c7c - rustc_hir_typeck[c30244052031a4ef]::check::check_fn
  30:     0x7f907322fe34 - rustc_hir_typeck[c30244052031a4ef]::typeck_with_inspect::{closure#0}
  31:     0x7f907322e8b2 - rustc_query_impl[d8d8891b690f31a]::query_impl::typeck::invoke_provider_fn::__rust_begin_short_backtrace
  32:     0x7f907259698a - rustc_query_impl[d8d8891b690f31a]::execution::try_execute_query::<rustc_data_structures[8d05224b8dc85cc0]::vec_cache::VecCache<rustc_span[6ddfab8b4d347fa5]::def_id::LocalDefId, rustc_middle[11b273479f5b7c30]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[11b273479f5b7c30]::dep_graph::graph::DepNodeIndex>, false>
  33:     0x7f90725963c3 - rustc_query_impl[d8d8891b690f31a]::query_impl::typeck::execute_query_non_incr::__rust_end_short_backtrace
  34:     0x7f90729ec948 - <rustc_middle[11b273479f5b7c30]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[eea337f167820684]::check_crate::{closure#2}>::{closure#0}
  35:     0x7f90729ec369 - rustc_hir_analysis[eea337f167820684]::check_crate
  36:     0x7f9072593393 - rustc_interface[454e58b8a783baef]::passes::analysis
  37:     0x7f90736673da - rustc_query_impl[d8d8891b690f31a]::execution::try_execute_query::<rustc_middle[11b273479f5b7c30]::query::caches::SingleCache<rustc_middle[11b273479f5b7c30]::query::erase::ErasedData<[u8; 0usize]>>, false>
  38:     0x7f90736671a9 - rustc_query_impl[d8d8891b690f31a]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
  39:     0x7f90736830ad - rustc_interface[454e58b8a783baef]::interface::run_compiler::<(), rustc_driver_impl[b2dff6da787942eb]::run_compiler::{closure#0}>::{closure#1}
  40:     0x7f90736544fe - std[a42f3b87e642314d]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[454e58b8a783baef]::util::run_in_thread_with_globals<rustc_interface[454e58b8a783baef]::util::run_in_thread_pool_with_globals<rustc_interface[454e58b8a783baef]::interface::run_compiler<(), rustc_driver_impl[b2dff6da787942eb]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  41:     0x7f9073654b60 - <std[a42f3b87e642314d]::thread::lifecycle::spawn_unchecked<rustc_interface[454e58b8a783baef]::util::run_in_thread_with_globals<rustc_interface[454e58b8a783baef]::util::run_in_thread_pool_with_globals<rustc_interface[454e58b8a783baef]::interface::run_compiler<(), rustc_driver_impl[b2dff6da787942eb]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[fe7c17ffc1da903f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  42:     0x7f90736559ec - <std[a42f3b87e642314d]::sys::thread::unix::Thread>::new::thread_start
  43:     0x7f906d1de609 - start_thread
                               at /build/glibc-B3wQXB/glibc-2.31/nptl/pthread_create.c:477:8
  44:     0x7f906d103353 - clone
                               at /build/glibc-B3wQXB/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95:0
  45:                0x0 - <unknown>


rustc version: 1.95.0-nightly (6a979b3e3 2026-02-26)
platform: x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `construct_successor_array`
#1 [analysis] running analysis passes on crate `bug`
end of query stack

@rustbot label +I-ICE +WG-trait-system-refactor

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.

Research direction

Reproduce the supplied example with -Znext-solver=globally using the reported nightly compiler. Start in compiler/rustc_next_trait_solver/src/solve/effect_goals.rs around the reported panic at line 358 and trace how the const evaluation of Iterator is handled. Done means the example no longer produces an internal compiler error and has an appropriate compiler result.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.