-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed as duplicate of#142488
Closed as duplicate of#142488
Copy link
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code
use itertools::Itertools;
pub fn trigger_ice() {
vec![1, 2, 3]
.into_iter()
.partition_map(|x| x)
.partition_map(|x| x);
}
Meta
rustc --version --verbose
:
rustc 1.91.0-nightly (f34ba774c 2025-08-03)
binary: rustc
commit-hash: f34ba774c78ea32b7c40598b8ad23e75cdac42a6
commit-date: 2025-08-03
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 20.1.8
Error output
error[E0308]: mismatched types
--> src/lib.rs:6:28
|
6 | .partition_map(|x| x)
| ^ expected `Either<_, _>`, found integer
|
= note: expected enum `Either<_, _>`
found type `{integer}`
help: try wrapping the expression in a variant of `Either`
|
6 | .partition_map(|x| itertools::Either::Left(x))
| ++++++++++++++++++++++++ +
6 | .partition_map(|x| itertools::Either::Right(x))
| +++++++++++++++++++++++++ +
thread 'rustc' panicked at /rust/deps/ena-0.14.3/src/snapshot_vec.rs:199:10:
index out of bounds: the len is 31 but the index is 37
Backtrace
stack backtrace:
0: 0x7a411b40a223 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::he94d81f4cc76bf03
1: 0x7a411bc02d77 - core::fmt::write::h255510a3ffb8d55d
2: 0x7a411b3ffe03 - std::io::Write::write_fmt::hf8ded1300f0b71a8
3: 0x7a411b40a082 - std::sys::backtrace::BacktraceLock::print::h3bdc2b992c7e0515
4: 0x7a411b40db27 - std::panicking::default_hook::{{closure}}::h876682ce5f8046c9
5: 0x7a411b40d68b - std::panicking::default_hook::h708aafadea70e31d
6: 0x7a411a47eac3 - std[a2e6032cce42d97f]::panicking::update_hook::<alloc[ff7d08515ebedc7]::boxed::Box<rustc_driver_impl[de6ab808e8043f3f]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7a411b40e36e - std::panicking::rust_panic_with_hook::hbc7edc3b462870f0
8: 0x7a411b40e06a - std::panicking::begin_panic_handler::{{closure}}::hf9e5cd48d862b8ac
9: 0x7a411b40a6f9 - std::sys::backtrace::__rust_end_short_backtrace::hd57bebce377ef2e9
10: 0x7a411b40dd4d - __rustc[46d736129294a9b7]::rust_begin_unwind
11: 0x7a4117ad2560 - core::panicking::panic_fmt::h21871f0b1dcaf625
12: 0x7a4119b5357d - core::panicking::panic_bounds_check::h467c1ac80182d499
13: 0x7a411d452153 - <ena[b295e11ac2687fa0]::unify::UnificationTable<ena[b295e11ac2687fa0]::unify::backing_vec::InPlace<rustc_infer[6623dba893894b6f]::infer::type_variable::TyVidEqKey, &mut alloc[ff7d08515ebedc7]::vec::Vec<ena[b295e11ac2687fa0]::unify::VarValue<rustc_infer[6623dba893894b6f]::infer::type_variable::TyVidEqKey>>, &mut rustc_infer[6623dba893894b6f]::infer::snapshot::undo_log::InferCtxtUndoLogs>>>::uninlined_get_root_key.cold
14: 0x7a411c5720e9 - <rustc_infer[6623dba893894b6f]::infer::canonical::canonicalizer::Canonicalizer as rustc_type_ir[d433dbb56c274b65]::fold::TypeFolder<rustc_middle[e3248139c571040]::ty::context::TyCtxt>>::fold_ty
15: 0x7a411c573ebb - <rustc_infer[6623dba893894b6f]::infer::canonical::canonicalizer::Canonicalizer as rustc_type_ir[d433dbb56c274b65]::fold::TypeFolder<rustc_middle[e3248139c571040]::ty::context::TyCtxt>>::fold_ty
16: 0x7a411c570f2f - <rustc_infer[6623dba893894b6f]::infer::canonical::canonicalizer::Canonicalizer as rustc_type_ir[d433dbb56c274b65]::fold::TypeFolder<rustc_middle[e3248139c571040]::ty::context::TyCtxt>>::fold_predicate
17: 0x7a411bce5870 - <rustc_infer[6623dba893894b6f]::infer::InferCtxt as rustc_trait_selection[2c4c2ad9bb59d34]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
18: 0x7a411a6ed1e3 - <rustc_infer[6623dba893894b6f]::infer::InferCtxt as rustc_trait_selection[2c4c2ad9bb59d34]::infer::InferCtxtExt>::type_implements_trait::<&rustc_middle[e3248139c571040]::ty::list::RawList<(), rustc_middle[e3248139c571040]::ty::generic_args::GenericArg>>
19: 0x7a411a7c1bfe - <rustc_hir_typeck[ad470676ecc79ec1]::fn_ctxt::FnCtxt>::report_no_match_method_error
20: 0x7a411a803ccd - <rustc_hir_typeck[ad470676ecc79ec1]::fn_ctxt::FnCtxt>::report_method_error
21: 0x7a411cac0f21 - <rustc_hir_typeck[ad470676ecc79ec1]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
22: 0x7a411be8b646 - <rustc_hir_typeck[ad470676ecc79ec1]::fn_ctxt::FnCtxt>::check_expr_block
23: 0x7a411cab23dd - <rustc_hir_typeck[ad470676ecc79ec1]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
24: 0x7a411be95aa2 - rustc_hir_typeck[ad470676ecc79ec1]::check::check_fn
25: 0x7a411ce10caf - rustc_hir_typeck[ad470676ecc79ec1]::typeck_with_inspect::{closure#0}
26: 0x7a411cdfbfb0 - rustc_query_impl[3fd9c6a4ad24362]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[3fd9c6a4ad24362]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e3248139c571040]::query::erase::Erased<[u8; 8usize]>>
27: 0x7a411c18bf60 - rustc_query_system[7e37a266f75ec588]::query::plumbing::try_execute_query::<rustc_query_impl[3fd9c6a4ad24362]::DynamicConfig<rustc_data_structures[a57f2e4fad990afb]::vec_cache::VecCache<rustc_span[91be5049b842f401]::def_id::LocalDefId, rustc_middle[e3248139c571040]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[7e37a266f75ec588]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[3fd9c6a4ad24362]::plumbing::QueryCtxt, true>
28: 0x7a411c18b300 - rustc_query_impl[3fd9c6a4ad24362]::query_impl::typeck::get_query_incr::__rust_end_short_backtrace
29: 0x7a411c180c9b - rustc_hir_analysis[7c52b57a28bd59dd]::check_crate
30: 0x7a411c185384 - rustc_interface[373d4675362b8f62]::passes::analysis
31: 0x7a411c185047 - rustc_query_impl[3fd9c6a4ad24362]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[3fd9c6a4ad24362]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e3248139c571040]::query::erase::Erased<[u8; 0usize]>>
32: 0x7a411ce268c2 - rustc_query_system[7e37a266f75ec588]::query::plumbing::try_execute_query::<rustc_query_impl[3fd9c6a4ad24362]::DynamicConfig<rustc_query_system[7e37a266f75ec588]::query::caches::SingleCache<rustc_middle[e3248139c571040]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[3fd9c6a4ad24362]::plumbing::QueryCtxt, true>
33: 0x7a411ce261ff - rustc_query_impl[3fd9c6a4ad24362]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
34: 0x7a411cf6724b - rustc_interface[373d4675362b8f62]::passes::create_and_enter_global_ctxt::<core[606ee596359a9bc5]::option::Option<rustc_interface[373d4675362b8f62]::queries::Linker>, rustc_driver_impl[de6ab808e8043f3f]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
35: 0x7a411cf56e71 - rustc_interface[373d4675362b8f62]::interface::run_compiler::<(), rustc_driver_impl[de6ab808e8043f3f]::run_compiler::{closure#0}>::{closure#1}
36: 0x7a411cdb3241 - std[a2e6032cce42d97f]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[373d4675362b8f62]::util::run_in_thread_with_globals<rustc_interface[373d4675362b8f62]::util::run_in_thread_pool_with_globals<rustc_interface[373d4675362b8f62]::interface::run_compiler<(), rustc_driver_impl[de6ab808e8043f3f]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
37: 0x7a411cdb2f22 - <<std[a2e6032cce42d97f]::thread::Builder>::spawn_unchecked_<rustc_interface[373d4675362b8f62]::util::run_in_thread_with_globals<rustc_interface[373d4675362b8f62]::util::run_in_thread_pool_with_globals<rustc_interface[373d4675362b8f62]::interface::run_compiler<(), rustc_driver_impl[de6ab808e8043f3f]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[606ee596359a9bc5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
38: 0x7a411cdb9085 - std::sys::pal::unix::thread::Thread::new::thread_start::hf6a510012528f331
39: 0x7a411649caa4 - start_thread
at ./nptl/pthread_create.c:447:8
40: 0x7a4116529c3c - clone3
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0
41: 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 `/home/xiyuzhai/rustc-ice-report0/rustc-ice-2025-08-04T03_50_57-336701.txt` to your bug report
note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [typeck] type-checking `trigger_ice`
#1 [analysis] running analysis passes on this crate
end of query stack
Additional Information
- The ICE occurs when attempting to chain
.partition_map()
calls from the itertools crate - The panic happens in the unification table during type checking:
index out of bounds: the len is 31 but the index is 37
- Minimal reproduction repository: https://github.com/xiyuzhai/rustc-ice-report0
- Dependencies: itertools = "0.13"
- Edition: 2024
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.