-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-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) ❄️S-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueT-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
auto-reduced (treereduce-rust):
trait Iterable {
type Iter;
}
impl<T> Iterable for [T] {
fn iter() -> Self::Iter {}
}original:
trait Iterable {
type Iter;
}
impl<T> Iterable for [T] {
//type Iter = T;
fn iter() -> Self::Iter {}
}
fn main() {}Version information
rustc 1.95.0-nightly (4c37f6d78 2026-02-15)
binary: rustc
commit-hash: 4c37f6d78c9c83e05caa0d1e43ce7d0c3f27538e
commit-date: 2026-02-15
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 22.1.0
Possibly related line of code:
rust/compiler/rustc_hir_analysis/src/collect/type_of.rs
Lines 77 to 89 in 4c37f6d
| ) | |
| }) | |
| }) | |
| .unwrap_or_else(|| icx.lower_ty(ty)), | |
| TraitItemKind::Type(_, Some(ty)) => icx.lower_ty(ty), | |
| TraitItemKind::Type(_, None) => { | |
| span_bug!(item.span, "associated type missing default"); | |
| } | |
| }, | |
| Node::ImplItem(item) => match item.kind { | |
| ImplItemKind::Fn(..) => { | |
| let args = ty::GenericArgs::identity_for_item(tcx, def_id); |
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error[E0407]: method `iter` is not a member of trait `Iterable`
--> /tmp/icemaker_global_tempdir.tLlD0YdmmImj/rustc_testrunner_tmpdir_reporting.19rfhwRLVF3q/mvce.rs:5:5
|
5 | fn iter() -> Self::Iter {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `Iterable`
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.tLlD0YdmmImj/rustc_testrunner_tmpdir_reporting.19rfhwRLVF3q/mvce.rs:6:2
|
6 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.tLlD0YdmmImj/rustc_testrunner_tmpdir_reporting.19rfhwRLVF3q/mvce.rs`
error[E0046]: not all trait items implemented, missing: `Iter`
--> /tmp/icemaker_global_tempdir.tLlD0YdmmImj/rustc_testrunner_tmpdir_reporting.19rfhwRLVF3q/mvce.rs:4:1
|
2 | type Iter;
| --------- `Iter` from trait
3 | }
4 | impl<T> Iterable for [T] {
| ^^^^^^^^^^^^^^^^^^^^^^^^ missing `Iter` in implementation
error: internal compiler error: /rustc-dev/4c37f6d78c9c83e05caa0d1e43ce7d0c3f27538e/compiler/rustc_hir_analysis/src/collect/type_of.rs:83:17: associated type missing default
--> /tmp/icemaker_global_tempdir.tLlD0YdmmImj/rustc_testrunner_tmpdir_reporting.19rfhwRLVF3q/mvce.rs:2:5
|
2 | type Iter;
| ^^^^^^^^^^
thread 'rustc' (3756732) panicked at /rustc-dev/4c37f6d78c9c83e05caa0d1e43ce7d0c3f27538e/compiler/rustc_hir_analysis/src/collect/type_of.rs:83:17:
Box<dyn Any>
stack backtrace:
0: 0x7f7134fd12db - <<std[13bb623c5f41015b]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[1a612d415c39447]::fmt::Display>::fmt
1: 0x7f71356110e0 - core[1a612d415c39447]::fmt::write
2: 0x7f7134fe8556 - <std[13bb623c5f41015b]::sys::stdio::unix::Stderr as std[13bb623c5f41015b]::io::Write>::write_fmt
3: 0x7f7134fa7388 - std[13bb623c5f41015b]::panicking::default_hook::{closure#0}
4: 0x7f7134fc4743 - std[13bb623c5f41015b]::panicking::default_hook
5: 0x7f7133f8e2af - std[13bb623c5f41015b]::panicking::update_hook::<alloc[94fa22a9d513d2fb]::boxed::Box<rustc_driver_impl[7a5c7b89587ab710]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7f7134fc4a22 - std[13bb623c5f41015b]::panicking::panic_with_hook
7: 0x7f7133fc2201 - std[13bb623c5f41015b]::panicking::begin_panic::<rustc_errors[6037551e036617b5]::ExplicitBug>::{closure#0}
8: 0x7f7133fbae36 - std[13bb623c5f41015b]::sys::backtrace::__rust_end_short_backtrace::<std[13bb623c5f41015b]::panicking::begin_panic<rustc_errors[6037551e036617b5]::ExplicitBug>::{closure#0}, !>
9: 0x7f7133fb8a78 - std[13bb623c5f41015b]::panicking::begin_panic::<rustc_errors[6037551e036617b5]::ExplicitBug>
10: 0x7f7133fcd791 - <rustc_errors[6037551e036617b5]::diagnostic::BugAbort as rustc_errors[6037551e036617b5]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
11: 0x7f71345716fc - <rustc_errors[6037551e036617b5]::DiagCtxtHandle>::span_bug::<rustc_span[d957d39e4d9cbd0e]::span_encoding::Span, alloc[94fa22a9d513d2fb]::string::String>
12: 0x7f71345996d6 - rustc_middle[6fed03d8291d2233]::util::bug::opt_span_bug_fmt::<rustc_span[d957d39e4d9cbd0e]::span_encoding::Span>::{closure#0}
13: 0x7f7134599882 - rustc_middle[6fed03d8291d2233]::ty::context::tls::with_opt::<rustc_middle[6fed03d8291d2233]::util::bug::opt_span_bug_fmt<rustc_span[d957d39e4d9cbd0e]::span_encoding::Span>::{closure#0}, !>::{closure#0}
14: 0x7f713458abdb - rustc_middle[6fed03d8291d2233]::ty::context::tls::with_context_opt::<rustc_middle[6fed03d8291d2233]::ty::context::tls::with_opt<rustc_middle[6fed03d8291d2233]::util::bug::opt_span_bug_fmt<rustc_span[d957d39e4d9cbd0e]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
15: 0x7f71326887c8 - rustc_middle[6fed03d8291d2233]::util::bug::span_bug_fmt::<rustc_span[d957d39e4d9cbd0e]::span_encoding::Span>
16: 0x7f7135c252de - rustc_hir_analysis[9dc4cf66aa438ac0]::collect::type_of::type_of
17: 0x7f713583cda6 - rustc_query_impl[241a4a1e976ada83]::query_impl::type_of::invoke_provider_fn::__rust_begin_short_backtrace
18: 0x7f71359da3b4 - rustc_query_impl[241a4a1e976ada83]::execution::try_execute_query::<rustc_middle[6fed03d8291d2233]::query::caches::DefIdCache<rustc_middle[6fed03d8291d2233]::query::erase::ErasedData<[u8; 8usize]>>, {rustc_query_impl[241a4a1e976ada83]::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: true }}, false>
19: 0x7f71359d9f68 - rustc_query_impl[241a4a1e976ada83]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
20: 0x7f7132705877 - <rustc_trait_selection[f521b0c5075d355b]::error_reporting::TypeErrCtxt>::report_mismatched_types
21: 0x7f7135b6cf9c - <rustc_hir_typeck[e40907cf86d5c04b]::fn_ctxt::FnCtxt>::check_expr_block
22: 0x7f7135b66165 - <rustc_hir_typeck[e40907cf86d5c04b]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
23: 0x7f7135b2e82e - rustc_hir_typeck[e40907cf86d5c04b]::check::check_fn
24: 0x7f71363adf9f - rustc_hir_typeck[e40907cf86d5c04b]::typeck_with_inspect::{closure#0}
25: 0x7f71363ac972 - rustc_query_impl[241a4a1e976ada83]::query_impl::typeck::invoke_provider_fn::__rust_begin_short_backtrace
26: 0x7f713605b0be - rustc_query_impl[241a4a1e976ada83]::execution::try_execute_query::<rustc_data_structures[cfafd8999d18e910]::vec_cache::VecCache<rustc_span[d957d39e4d9cbd0e]::def_id::LocalDefId, rustc_middle[6fed03d8291d2233]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[6fed03d8291d2233]::dep_graph::graph::DepNodeIndex>, {rustc_query_impl[241a4a1e976ada83]::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}, false>
27: 0x7f713605ac89 - rustc_query_impl[241a4a1e976ada83]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
28: 0x7f71360545ce - <rustc_middle[6fed03d8291d2233]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[9dc4cf66aa438ac0]::check_crate::{closure#2}>::{closure#0}
29: 0x7f7136053fee - rustc_hir_analysis[9dc4cf66aa438ac0]::check_crate
30: 0x7f7136057c56 - rustc_interface[675341b454225ef6]::passes::analysis
31: 0x7f713685ef99 - rustc_query_impl[241a4a1e976ada83]::execution::try_execute_query::<rustc_middle[6fed03d8291d2233]::query::caches::SingleCache<rustc_middle[6fed03d8291d2233]::query::erase::ErasedData<[u8; 0usize]>>, {rustc_query_impl[241a4a1e976ada83]::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}, false>
32: 0x7f713685ecd4 - rustc_query_impl[241a4a1e976ada83]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
33: 0x7f713691f367 - <rustc_interface[675341b454225ef6]::passes::create_and_enter_global_ctxt<core[1a612d415c39447]::option::Option<rustc_interface[675341b454225ef6]::queries::Linker>, rustc_driver_impl[7a5c7b89587ab710]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[1a612d415c39447]::ops::function::FnOnce<(&rustc_session[d9db1c251ec97918]::session::Session, rustc_middle[6fed03d8291d2233]::ty::context::CurrentGcx, alloc[94fa22a9d513d2fb]::sync::Arc<rustc_data_structures[cfafd8999d18e910]::jobserver::Proxy>, &std[13bb623c5f41015b]::sync::once_lock::OnceLock<rustc_middle[6fed03d8291d2233]::ty::context::GlobalCtxt>, &rustc_data_structures[cfafd8999d18e910]::sync::worker_local::WorkerLocal<rustc_middle[6fed03d8291d2233]::arena::Arena>, &rustc_data_structures[cfafd8999d18e910]::sync::worker_local::WorkerLocal<rustc_hir[9894d5a1279548]::Arena>, rustc_driver_impl[7a5c7b89587ab710]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
34: 0x7f713683d877 - rustc_interface[675341b454225ef6]::interface::run_compiler::<(), rustc_driver_impl[7a5c7b89587ab710]::run_compiler::{closure#0}>::{closure#1}
35: 0x7f7136820cfe - std[13bb623c5f41015b]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[675341b454225ef6]::util::run_in_thread_with_globals<rustc_interface[675341b454225ef6]::util::run_in_thread_pool_with_globals<rustc_interface[675341b454225ef6]::interface::run_compiler<(), rustc_driver_impl[7a5c7b89587ab710]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
36: 0x7f71368213e0 - <std[13bb623c5f41015b]::thread::lifecycle::spawn_unchecked<rustc_interface[675341b454225ef6]::util::run_in_thread_with_globals<rustc_interface[675341b454225ef6]::util::run_in_thread_pool_with_globals<rustc_interface[675341b454225ef6]::interface::run_compiler<(), rustc_driver_impl[7a5c7b89587ab710]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[1a612d415c39447]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
37: 0x7f713682226c - <std[13bb623c5f41015b]::sys::thread::unix::Thread>::new::thread_start
38: 0x7f713029b98b - <unknown>
39: 0x7f713031fa0c - <unknown>
40: 0x0 - <unknown>
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.95.0-nightly (4c37f6d78 2026-02-15) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [type_of] computing type of `Iterable::Iter`
#1 [typeck] type-checking `<impl at /tmp/icemaker_global_tempdir.tLlD0YdmmImj/rustc_testrunner_tmpdir_reporting.19rfhwRLVF3q/mvce.rs:4:1: 4:25>::iter`
#2 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0046, E0407, E0601.
For more information about an error, try `rustc --explain E0046`.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-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) ❄️S-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueT-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.