Open
Description
The code is generated by a fuzzer and reduced manually
Possible repetition with #129209
Code
struct A<const N: usize> {}
impl<const N: usize> Iterator for A<N> {
fn next() -> [(); std::mem::size_of::<Option<Self::Item>>] {}
}
fn main() {}
Meta
rustc --version --verbose
:
rustc 1.89.0-nightly (dcecb9917 2025-05-09)
binary: rustc
commit-hash: dcecb99176edf2eec51613730937d21cdd5c8f6e
commit-date: 2025-05-09
host: x86_64-pc-windows-msvc
release: 1.89.0-nightly
LLVM version: 20.1.4
Error output
error[E0186]: method `next` has a `&mut self` declaration in the trait, but not in the impl
|
197 | fn next() -> [(); std::mem::size_of::<Option<Self::Item>>] {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&mut self` in impl
|
= note: `next` from trait: `fn(&mut Self) -> Option<<Self as Iterator>::Item>`
error[E0046]: not all trait items implemented, missing: `Item`
|
196 | impl<const N: usize> Iterator for A<N> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Item` in implementation
|
= help: implement the missing item: `type Item = /* Type */;`
error: generic `Self` types are currently not permitted in anonymous constants
|
197 | fn next() -> [(); std::mem::size_of::<Option<Self::Item>>] {}
Backtrace
thread 'rustc' panicked at compiler\rustc_middle\src\ty\sty.rs:364:36:
called `Option::unwrap()` on a `None` value
stack backtrace:
0: 0x7ff96d220282 - std::backtrace_rs::backtrace::win64::trace
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
1: 0x7ff96d220282 - std::backtrace_rs::backtrace::trace_unsynchronized
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
2: 0x7ff96d220282 - std::sys::backtrace::_print_fmt
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\std\src\sys\backtrace.rs:66
3: 0x7ff96d220282 - std::sys::backtrace::impl$0::print::impl$0::fmt
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\std\src\sys\backtrace.rs:39
4: 0x7ff96d252aab - core::fmt::rt::Argument::fmt
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\core\src\fmt\rt.rs:181
5: 0x7ff96d252aab - core::fmt::write
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\core\src\fmt\mod.rs:1446
6: 0x7ff96d2160a7 - std::io::default_write_fmt
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\std\src\io\mod.rs:639
7: 0x7ff96d2160a7 - std::io::Write::write_fmt<std::sys::stdio::windows::Stderr>
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\std\src\io\mod.rs:1914
8: 0x7ff96d2200c5 - std::sys::backtrace::BacktraceLock::print
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\std\src\sys\backtrace.rs:42
9: 0x7ff96d225d4a - std::panicking::default_hook::closure$0
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\std\src\panicking.rs:300
10: 0x7ff96d225ae0 - std::panicking::default_hook
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\std\src\panicking.rs:327
11: 0x7ff96e9410bf - core[9d60ee0329d566fc]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[748db264f8602b7b]::Level, &str), usize), <((rustc_lint_defs[748db264f8602b7b]::Level, &str), usize) as core[9d60ee0329d566fc]::cmp::PartialOrd>::lt>
12: 0x7ff96d2269de - std::panicking::rust_panic_with_hook
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\std\src\panicking.rs:841
13: 0x7ff96d226702 - std::panicking::begin_panic_handler::closure$0
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\std\src\panicking.rs:699
14: 0x7ff96d22104f - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\std\src\sys\backtrace.rs:168
15: 0x7ff96d22633e - std::panicking::begin_panic_handler
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\std\src\panicking.rs:697
16: 0x7ff9703d3351 - core::panicking::panic_fmt
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\core\src\panicking.rs:75
17: 0x7ff9703d340d - core::panicking::panic
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\core\src\panicking.rs:145
18: 0x7ff9703d32ce - core::option::unwrap_failed
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\core\src\option.rs:2040
19: 0x7ff96d0aa4c6 - <rustc_middle[8660d27183fc6825]::ty::sty::ParamConst>::find_ty_from_env
20: 0x7ff96e281f71 - <rustc_trait_selection[58084ddd0cf58050]::traits::fulfill::FulfillProcessor as rustc_data_structures[9935af3ebed2be53]::obligation_forest::ObligationProcessor>::process_obligation
21: 0x7ff96e1c843b - <rustc_data_structures[9935af3ebed2be53]::obligation_forest::ObligationForest<rustc_trait_selection[58084ddd0cf58050]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[58084ddd0cf58050]::traits::fulfill::FulfillProcessor>
22: 0x7ff96d4d87bc - <rustc_hir_typeck[bfa3800aa3d4f1a2]::upvar::InferBorrowKind as rustc_hir_typeck[bfa3800aa3d4f1a2]::expr_use_visitor::Delegate>::borrow
23: 0x7ff96d48e2bf - rustc_hir_typeck[bfa3800aa3d4f1a2]::typeck
24: 0x7ff96e17427b - rustc_query_impl[993ab63a0c6afe36]::plumbing::query_key_hash_verify_all
25: 0x7ff96e0acd04 - RINvNtNtCsi9HO7w7UkL_18rustc_query_system5query8plumbing17try_execute_queryINtCsd9DrxHbgjXe_16rustc_query_impl13DynamicConfigINtNtCsd9wXIVlvcyJ_21rustc_data_structures9vec_cache8VecCacheNtNtCs4F9Gp71IGkq_10rustc_span6def_id10LocalDefIdINtNtNtCsbxi6Ha6uNij_
26: 0x7ff96e17c7b2 - rustc_query_impl[993ab63a0c6afe36]::plumbing::query_key_hash_verify_all
27: 0x7ff96d8813c3 - rustc_mir_build[d6bf2d72d7ee99f6]::thir::pattern::check_match::check_match
28: 0x7ff96e171e1b - rustc_query_impl[993ab63a0c6afe36]::plumbing::query_key_hash_verify_all
29: 0x7ff96e0a7a4e - RINvNtNtCsi9HO7w7UkL_18rustc_query_system5query8plumbing17try_execute_queryINtCsd9DrxHbgjXe_16rustc_query_impl13DynamicConfigINtNtCsd9wXIVlvcyJ_21rustc_data_structures9vec_cache8VecCacheNtNtCs4F9Gp71IGkq_10rustc_span6def_id10LocalDefIdINtNtNtCsbxi6Ha6uNij_
30: 0x7ff96e17d160 - rustc_query_impl[993ab63a0c6afe36]::plumbing::query_key_hash_verify_all
31: 0x7ff96d8167b5 - rustc_mir_build[d6bf2d72d7ee99f6]::builder::build_mir
32: 0x7ff96d6bb3f8 - rustc_mir_transform[581157cbd5ddc9bf]::mir_built
33: 0x7ff96e17447b - rustc_query_impl[993ab63a0c6afe36]::plumbing::query_key_hash_verify_all
34: 0x7ff96e0acd04 - RINvNtNtCsi9HO7w7UkL_18rustc_query_system5query8plumbing17try_execute_queryINtCsd9DrxHbgjXe_16rustc_query_impl13DynamicConfigINtNtCsd9wXIVlvcyJ_21rustc_data_structures9vec_cache8VecCacheNtNtCs4F9Gp71IGkq_10rustc_span6def_id10LocalDefIdINtNtNtCsbxi6Ha6uNij_
35: 0x7ff96e178552 - rustc_query_impl[993ab63a0c6afe36]::plumbing::query_key_hash_verify_all
36: 0x7ff96d6ba7a8 - rustc_mir_transform[581157cbd5ddc9bf]::mir_const_qualif
37: 0x7ff96e172ce0 - rustc_query_impl[993ab63a0c6afe36]::plumbing::query_key_hash_verify_all
38: 0x7ff96e03bb7b - RINvNtNtCsi9HO7w7UkL_18rustc_query_system5query8plumbing17try_execute_queryINtCsd9DrxHbgjXe_16rustc_query_impl13DynamicConfigINtNtB4_6caches10DefIdCacheINtNtNtCsbxi6Ha6uNij_12rustc_middle5query5erase6ErasedAhj4_EEKb0_KB3q_KB3q_ENtNtB1e_8plumbing9QueryCtxtK
39: 0x7ff96e178471 - rustc_query_impl[993ab63a0c6afe36]::plumbing::query_key_hash_verify_all
40: 0x7ff96d6bdcf1 - rustc_mir_transform[581157cbd5ddc9bf]::mir_promoted
41: 0x7ff96e1722f9 - rustc_query_impl[993ab63a0c6afe36]::plumbing::query_key_hash_verify_all
42: 0x7ff96e0a4041 - RINvNtNtCsi9HO7w7UkL_18rustc_query_system5query8plumbing17try_execute_queryINtCsd9DrxHbgjXe_16rustc_query_impl13DynamicConfigINtNtCsd9wXIVlvcyJ_21rustc_data_structures9vec_cache8VecCacheNtNtCs4F9Gp71IGkq_10rustc_span6def_id10LocalDefIdINtNtNtCsbxi6Ha6uNij_
43: 0x7ff96e178b02 - rustc_query_impl[993ab63a0c6afe36]::plumbing::query_key_hash_verify_all
44: 0x7ff96d96d0c8 - rustc_borrowck[d16af58a5736816b]::mir_borrowck
45: 0x7ff96e17227b - rustc_query_impl[993ab63a0c6afe36]::plumbing::query_key_hash_verify_all
46: 0x7ff96e0acd04 - RINvNtNtCsi9HO7w7UkL_18rustc_query_system5query8plumbing17try_execute_queryINtCsd9DrxHbgjXe_16rustc_query_impl13DynamicConfigINtNtCsd9wXIVlvcyJ_21rustc_data_structures9vec_cache8VecCacheNtNtCs4F9Gp71IGkq_10rustc_span6def_id10LocalDefIdINtNtNtCsbxi6Ha6uNij_
47: 0x7ff96e17cd12 - rustc_query_impl[993ab63a0c6afe36]::plumbing::query_key_hash_verify_all
48: 0x7ff96d6ce6f8 - rustc_mir_transform[581157cbd5ddc9bf]::mir_drops_elaborated_and_const_checked
49: 0x7ff96e173f1b - rustc_query_impl[993ab63a0c6afe36]::plumbing::query_key_hash_verify_all
50: 0x7ff96e0acd04 - RINvNtNtCsi9HO7w7UkL_18rustc_query_system5query8plumbing17try_execute_queryINtCsd9DrxHbgjXe_16rustc_query_impl13DynamicConfigINtNtCsd9wXIVlvcyJ_21rustc_data_structures9vec_cache8VecCacheNtNtCs4F9Gp71IGkq_10rustc_span6def_id10LocalDefIdINtNtNtCsbxi6Ha6uNij_
51: 0x7ff96e178912 - rustc_query_impl[993ab63a0c6afe36]::plumbing::query_key_hash_verify_all
52: 0x7ff96d6cb2cf - rustc_mir_transform[581157cbd5ddc9bf]::mir_for_ctfe
53: 0x7ff96e1722b0 - rustc_query_impl[993ab63a0c6afe36]::plumbing::query_key_hash_verify_all
54: 0x7ff96e03d935 - RINvNtNtCsi9HO7w7UkL_18rustc_query_system5query8plumbing17try_execute_queryINtCsd9DrxHbgjXe_16rustc_query_impl13DynamicConfigINtNtB4_6caches10DefIdCacheINtNtNtCsbxi6Ha6uNij_12rustc_middle5query5erase6ErasedAhj8_EEKb0_KB3q_KB3q_ENtNtB1e_8plumbing9QueryCtxtK
55: 0x7ff96e178a14 - rustc_query_impl[993ab63a0c6afe36]::plumbing::query_key_hash_verify_all
56: 0x7ff96dae4f89 - rustc_const_eval[5e4b847289603190]::interpret::eval_context::mir_assign_valid_types
57: 0x7ff96dca060c - rustc_const_eval[5e4b847289603190]::const_eval::eval_queries::eval_to_allocation_raw_provider
58: 0x7ff96e1734c8 - rustc_query_impl[993ab63a0c6afe36]::plumbing::query_key_hash_verify_all
59: 0x7ff96e06a393 - RINvNtNtCsi9HO7w7UkL_18rustc_query_system5query8plumbing17try_execute_queryINtCsd9DrxHbgjXe_16rustc_query_impl13DynamicConfigINtNtB4_6caches12DefaultCacheINtNtCsbxi6Ha6uNij_12rustc_middle2ty20PseudoCanonicalInputNtNtNtB2x_3mir9interpret8GlobalIdEINtNtNtB2x
60: 0x7ff96e17cf03 - rustc_query_impl[993ab63a0c6afe36]::plumbing::query_key_hash_verify_all
61: 0x7ff96cb6f0c5 - rustc_const_eval[5e4b847289603190]::const_eval::valtrees::eval_to_valtree
62: 0x7ff969b79b77 - <alloc[1be1f531b41370bc]::sync::Arc<jiff[27f6babda31ce97f]::tz::db::Kind>>::drop_slow
63: 0x7ff96cd9abe8 - RINvNtNtCsi9HO7w7UkL_18rustc_query_system5query8plumbing17try_execute_queryINtCsd9DrxHbgjXe_16rustc_query_impl13DynamicConfigINtNtCsd9wXIVlvcyJ_21rustc_data_structures9vec_cache8VecCacheNtNtCs4F9Gp71IGkq_10rustc_span6def_id8CrateNumINtNtNtCsbxi6Ha6uNij_12r
64: 0x7ff96cd7089b - RINvNtNtCsi9HO7w7UkL_18rustc_query_system5query8plumbing17try_execute_queryINtCsd9DrxHbgjXe_16rustc_query_impl13DynamicConfigINtNtCsd9wXIVlvcyJ_21rustc_data_structures9vec_cache8VecCacheNtNtCs4F9Gp71IGkq_10rustc_span6def_id8CrateNumINtNtNtCsbxi6Ha6uNij_12r
65: 0x7ff96e06a4ec - RINvNtNtCsi9HO7w7UkL_18rustc_query_system5query8plumbing17try_execute_queryINtCsd9DrxHbgjXe_16rustc_query_impl13DynamicConfigINtNtB4_6caches12DefaultCacheINtNtCsbxi6Ha6uNij_12rustc_middle2ty20PseudoCanonicalInputNtNtNtB2x_3mir9interpret8GlobalIdEINtNtNtB2x
66: 0x7ff96cdb2653 - rustc_query_impl[993ab63a0c6afe36]::query_system
67: 0x7ff96d0a65cb - <rustc_middle[8660d27183fc6825]::ty::context::TyCtxt>::const_eval_global_id_for_typeck
68: 0x7ff96d0a5786 - <rustc_middle[8660d27183fc6825]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
69: 0x7ff96cebc54f - rustc_trait_selection[58084ddd0cf58050]::traits::try_evaluate_const
70: 0x7ff96ceb57ec - <rustc_trait_selection[58084ddd0cf58050]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[829588816c884077]::fold::TypeFolder<rustc_middle[8660d27183fc6825]::ty::context::TyCtxt>>::fold_const
71: 0x7ff96e21bc18 - <rustc_trait_selection[58084ddd0cf58050]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[829588816c884077]::fold::TypeFolder<rustc_middle[8660d27183fc6825]::ty::context::TyCtxt>>::fold_ty
72: 0x7ff96d54f778 - rustc_hir_analysis[284df9e8bdc6f5c4]::check::region::region_scope_tree
73: 0x7ff96d5c0fcf - <rustc_hir_analysis[284df9e8bdc6f5c4]::check::wfcheck::check_where_clauses::{closure#2}::CountParams as rustc_type_ir[829588816c884077]::visit::TypeVisitor<rustc_middle[8660d27183fc6825]::ty::context::TyCtxt>>::visit_ty
74: 0x7ff96d551294 - rustc_hir_analysis[284df9e8bdc6f5c4]::check::region::region_scope_tree
75: 0x7ff96d554efe - rustc_hir_analysis[284df9e8bdc6f5c4]::check::wfcheck::check_well_formed
76: 0x7ff96e172d7b - rustc_query_impl[993ab63a0c6afe36]::plumbing::query_key_hash_verify_all
77: 0x7ff96e0a7cee - RINvNtNtCsi9HO7w7UkL_18rustc_query_system5query8plumbing17try_execute_queryINtCsd9DrxHbgjXe_16rustc_query_impl13DynamicConfigINtNtCsd9wXIVlvcyJ_21rustc_data_structures9vec_cache8VecCacheNtNtCs4F9Gp71IGkq_10rustc_span6def_id10LocalDefIdINtNtNtCsbxi6Ha6uNij_
78: 0x7ff96e183785 - rustc_query_impl[993ab63a0c6afe36]::plumbing::query_key_hash_verify_all
79: 0x7ff96d566dea - rustc_hir_analysis[284df9e8bdc6f5c4]::check::wfcheck::check_mod_type_wf
80: 0x7ff96cd9ba3b - RINvNtNtCsi9HO7w7UkL_18rustc_query_system5query8plumbing17try_execute_queryINtCsd9DrxHbgjXe_16rustc_query_impl13DynamicConfigINtNtCsd9wXIVlvcyJ_21rustc_data_structures9vec_cache8VecCacheNtNtCs4F9Gp71IGkq_10rustc_span6def_id8CrateNumINtNtNtCsbxi6Ha6uNij_12r
81: 0x7ff96cce5976 - RINvNtNtCsi9HO7w7UkL_18rustc_query_system5query8plumbing17try_execute_queryINtCsd9DrxHbgjXe_16rustc_query_impl13DynamicConfigINtNtB4_6caches12DefaultCacheNtNtCs4F9Gp71IGkq_10rustc_span6def_id13LocalModDefIdINtNtNtCsbxi6Ha6uNij_12rustc_middle5query5erase6Er
82: 0x7ff96cdb0160 - rustc_query_impl[993ab63a0c6afe36]::query_system
83: 0x7ff96d5b2d6e - rustc_hir_analysis[284df9e8bdc6f5c4]::check_crate
84: 0x7ff96d28a1f6 - <rustc_interface[642e9f6cacad30a4]::passes::LintStoreExpandImpl as rustc_expand[6c773f9594c871da]::base::LintStoreExpand>::pre_expansion_lint
85: 0x7ff969b8dbf7 - rustc_interface[642e9f6cacad30a4]::passes::analysis
86: 0x7ff96cd9e7ca - RINvNtNtCsi9HO7w7UkL_18rustc_query_system5query8plumbing17try_execute_queryINtCsd9DrxHbgjXe_16rustc_query_impl13DynamicConfigINtNtCsd9wXIVlvcyJ_21rustc_data_structures9vec_cache8VecCacheNtNtCs4F9Gp71IGkq_10rustc_span6def_id8CrateNumINtNtNtCsbxi6Ha6uNij_12r
87: 0x7ff96cca730a - RINvNtNtCsi9HO7w7UkL_18rustc_query_system5query8plumbing17try_execute_queryINtCsd9DrxHbgjXe_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCsbxi6Ha6uNij_12rustc_middle5query5erase6ErasedAhj0_EEKb0_KB3r_KB3r_ENtNtB1e_8plumbing9QueryCtxt
88: 0x7ff96cda4df3 - rustc_query_impl[993ab63a0c6afe36]::query_system
89: 0x7ff969b4ecf8 - std[547ad0aa56f99cda]::sys::backtrace::__rust_begin_short_backtrace::<<std[547ad0aa56f99cda]::thread::Builder>::spawn_unchecked_<ctrlc[8beb5292918c80fb]::set_handler_inner<rustc_driver_impl[ee03924009af6117]::install_ctrlc_handler::{closure#0}>::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
90: 0x7ff969b48f36 - std[547ad0aa56f99cda]::sys::backtrace::__rust_begin_short_backtrace::<<std[547ad0aa56f99cda]::thread::Builder>::spawn_unchecked_<ctrlc[8beb5292918c80fb]::set_handler_inner<rustc_driver_impl[ee03924009af6117]::install_ctrlc_handler::{closure#0}>::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
91: 0x7ff969b4413f - RINvNtNtCs7fGoaO6NkXC_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCs8BgyDmMp6lY_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_compileruNCNvCskqWrDiLSCdn_17rustc_driver_i
92: 0x7ff969b53050 - std[547ad0aa56f99cda]::sys::backtrace::__rust_begin_short_backtrace::<<std[547ad0aa56f99cda]::thread::Builder>::spawn_unchecked_<ctrlc[8beb5292918c80fb]::set_handler_inner<rustc_driver_impl[ee03924009af6117]::install_ctrlc_handler::{closure#0}>::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
93: 0x7ff96d22ad6d - alloc::boxed::impl$28::call_once
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\alloc\src\boxed.rs:1966
94: 0x7ff96d22ad6d - alloc::boxed::impl$28::call_once
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\alloc\src\boxed.rs:1966
95: 0x7ff96d22ad6d - std::sys::pal::windows::thread::impl$0::new::thread_start
at /rustc/dcecb99176edf2eec51613730937d21cdd5c8f6e/library\std\src\sys\pal\windows\thread.rs:56
96: 0x7ffa0f247374 - BaseThreadInitThunk
97: 0x7ffa1063cc91 - RtlUserThreadStart
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 `D:\rust_test\test1\src\rustc-ice-2025-05-10T11_55_56-33528.txt` to your bug report
query stack during panic:
#0 [typeck] type-checking `<impl at .\test.rs:2:1: 2:39>::next::{constant#0}`
#1 [check_match] match-checking `<impl at .\test.rs:2:1: 2:39>::next::{constant#0}`
... and 11 other queries... use `env RUST_BACKTRACE=1` to see the full query stack
error: aborting due to 3 previous errors