-
Notifications
You must be signed in to change notification settings - Fork 14k
Open
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.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.
Description
auto-reduced (treereduce-rust):
fn main() {
<&'a TDeref as IntoIterator>::IntoIter(vec![]);
}original:
// check-pass
fn foo<T>(t: T) -> usize
where
for<'a> &'a T: IntoIterator,
for<'a> <&'a T as IntoIterator>::IntoIter: ExactSizeIterator,
{
foo::<Vec<u32>>(vec![]).len()
}
fn main() {
<&'a TDeref as IntoIterator>::IntoIter(vec![]);
}
mod another {
use std::ops::Deref;
fn test<T, TDeref>()
where
T: Deref<Target = TDeref>,
TDeref: ?Sized,
for<'a> &'a TDeref: IntoIterator,
for<'a> &'a T: IntoIterator,
{
}
fn main() {
test::<Vec<u8>, _>();
}
}Version information
rustc 1.92.0-nightly (bd4a8004c 2025-10-20)
binary: rustc
commit-hash: bd4a8004c2f3b73795cb4c03bf8e7634e4d89677
commit-date: 2025-10-20
host: x86_64-unknown-linux-gnu
release: 1.92.0-nightly
LLVM version: 21.1.3
Possibly related line of code:
rust/compiler/rustc_errors/src/lib.rs
Lines 379 to 391 in bd4a800
| .cloned() | |
| .filter_map(|mut substitution| { | |
| // Assumption: all spans are in the same file, and all spans | |
| // are disjoint. Sort in ascending order. | |
| substitution.parts.sort_by_key(|part| part.span.lo()); | |
| // Verify the assumption that all spans are disjoint | |
| assert_eq!( | |
| substitution.parts.array_windows().find(|[a, b]| a.span.overlaps(b.span)), | |
| None, | |
| "all spans must be disjoint", | |
| ); | |
| // Account for cases where we are suggesting the same code that's already |
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error[E0261]: use of undeclared lifetime name `'a`
--> /tmp/icemaker_global_tempdir.zT6DmWVt6amy/rustc_testrunner_tmpdir_reporting.gMs0r5JvGv5W/mvce.rs:2:7
|
2 | <&'a TDeref as IntoIterator>::IntoIter(vec![]);
| ^^ undeclared lifetime
|
help: consider introducing lifetime `'a` here
|
1 | fn main<'a>() {
| ++++
error[E0575]: expected method or associated constant, found associated type `IntoIterator::IntoIter`
--> /tmp/icemaker_global_tempdir.zT6DmWVt6amy/rustc_testrunner_tmpdir_reporting.gMs0r5JvGv5W/mvce.rs:2:5
|
2 | <&'a TDeref as IntoIterator>::IntoIter(vec![]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: can't use a type alias as a constructor
thread 'rustc' (1082747) panicked at compiler/rustc_errors/src/lib.rs:385:17:
assertion `left == right` failed: all spans must be disjoint
left: Some([SubstitutionPart { span: /home/matthias/.rustup/toolchains/master/lib/rustlib/src/rust/library/alloc/src/macros.rs:44:9: 44:32 (#4), snippet: " { 0: " }, SubstitutionPart { span: /home/matthias/.rustup/toolchains/master/lib/rustlib/src/rust/library/alloc/src/macros.rs:44:9: 44:32 (#4), snippet: " }" }])
right: None
stack backtrace:
0: 0x7f2daf21bad3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h7ce1817dc787ae2a
1: 0x7f2daf801ad8 - core::fmt::write::h4b44684f3eb278fd
2: 0x7f2daf1cfc43 - std::io::Write::write_fmt::hce8030c46a5cc224
3: 0x7f2daf1e1192 - std::sys::backtrace::BacktraceLock::print::h96e3511f9684deb2
4: 0x7f2daf1e7269 - std::panicking::default_hook::{{closure}}::h8f19c297eed9b282
5: 0x7f2daf1e6d93 - std::panicking::default_hook::h419be45792712020
6: 0x7f2dae1f3d07 - std[77a4331de3222898]::panicking::update_hook::<alloc[b29b593dea949441]::boxed::Box<rustc_driver_impl[5267ee30c81b0e]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7f2daf1e768f - std::panicking::panic_with_hook::hb1a2dc8e6eebd27b
8: 0x7f2daf1e744a - std::panicking::panic_handler::{{closure}}::hd5af40f7328a8837
9: 0x7f2daf1e12c9 - std::sys::backtrace::__rust_end_short_backtrace::h43c84acb4bc43c12
10: 0x7f2daf1c1e5d - __rustc[3e962e80ec1fc39a]::rust_begin_unwind
11: 0x7f2dac161890 - core::panicking::panic_fmt::h87f499a557a86b6c
12: 0x7f2dadbd2833 - core::panicking::assert_failed_inner::h7a36df2f7aa52825
13: 0x7f2dae221838 - core[98aea282fc88ea4b]::panicking::assert_failed::<core[98aea282fc88ea4b]::option::Option<&[rustc_errors[2c8b44d91033c985]::SubstitutionPart; 2usize]>, core[98aea282fc88ea4b]::option::Option<&[rustc_errors[2c8b44d91033c985]::SubstitutionPart; 2usize]>>
14: 0x7f2db0b5c027 - <core[98aea282fc88ea4b]::iter::adapters::filter_map::FilterMap<core[98aea282fc88ea4b]::iter::adapters::cloned::Cloned<core[98aea282fc88ea4b]::iter::adapters::filter::Filter<core[98aea282fc88ea4b]::slice::iter::Iter<rustc_errors[2c8b44d91033c985]::Substitution>, <rustc_errors[2c8b44d91033c985]::CodeSuggestion>::splice_lines::{closure#0}>>, <rustc_errors[2c8b44d91033c985]::CodeSuggestion>::splice_lines::{closure#1}> as core[98aea282fc88ea4b]::iter::traits::iterator::Iterator>::next
15: 0x7f2db0b57c8b - <rustc_errors[2c8b44d91033c985]::emitter::HumanEmitter>::emit_suggestion_default
16: 0x7f2db0cf3649 - <rustc_errors[2c8b44d91033c985]::emitter::HumanEmitter as rustc_errors[2c8b44d91033c985]::emitter::Emitter>::emit_diagnostic
17: 0x7f2db0cef326 - <rustc_errors[2c8b44d91033c985]::DiagCtxtInner>::emit_diagnostic::{closure#3}
18: 0x7f2db0cece04 - rustc_interface[e8534005bd5cee03]::callbacks::track_diagnostic::<core[98aea282fc88ea4b]::option::Option<rustc_span[235b32e56945d136]::ErrorGuaranteed>>
19: 0x7f2db0cebe36 - <rustc_errors[2c8b44d91033c985]::DiagCtxtInner>::emit_diagnostic
20: 0x7f2db0cebcff - <rustc_errors[2c8b44d91033c985]::DiagCtxtHandle>::emit_diagnostic
21: 0x7f2dac54749e - <rustc_span[235b32e56945d136]::ErrorGuaranteed as rustc_errors[2c8b44d91033c985]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
22: 0x7f2dafd0d6dd - <rustc_resolve[f580584eb261ff18]::Resolver>::resolve_crate::{closure#0}
23: 0x7f2dafd02f8b - <rustc_resolve[f580584eb261ff18]::Resolver>::resolve_crate
24: 0x7f2db0379d15 - rustc_interface[e8534005bd5cee03]::passes::configure_and_expand
25: 0x7f2db091f615 - rustc_interface[e8534005bd5cee03]::passes::resolver_for_lowering_raw
26: 0x7f2db091f38d - rustc_query_impl[4f9b9f05dcc10e6c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[4f9b9f05dcc10e6c]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[57c44cee7187e787]::query::erase::Erased<[u8; 16usize]>>
27: 0x7f2db091f367 - <rustc_query_impl[4f9b9f05dcc10e6c]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[98aea282fc88ea4b]::ops::function::FnOnce<(rustc_middle[57c44cee7187e787]::ty::context::TyCtxt, ())>>::call_once
28: 0x7f2db088859f - rustc_query_system[ee3fd6b41b5cadc9]::query::plumbing::try_execute_query::<rustc_query_impl[4f9b9f05dcc10e6c]::DynamicConfig<rustc_query_system[ee3fd6b41b5cadc9]::query::caches::SingleCache<rustc_middle[57c44cee7187e787]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[4f9b9f05dcc10e6c]::plumbing::QueryCtxt, false>
29: 0x7f2db08880fc - rustc_query_impl[4f9b9f05dcc10e6c]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
30: 0x7f2db0a64931 - <rustc_interface[e8534005bd5cee03]::passes::create_and_enter_global_ctxt<core[98aea282fc88ea4b]::option::Option<rustc_interface[e8534005bd5cee03]::queries::Linker>, rustc_driver_impl[5267ee30c81b0e]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[98aea282fc88ea4b]::ops::function::FnOnce<(&rustc_session[39b43f51f4446db8]::session::Session, rustc_middle[57c44cee7187e787]::ty::context::CurrentGcx, alloc[b29b593dea949441]::sync::Arc<rustc_data_structures[738b40c7f5a39734]::jobserver::Proxy>, &std[77a4331de3222898]::sync::once_lock::OnceLock<rustc_middle[57c44cee7187e787]::ty::context::GlobalCtxt>, &rustc_data_structures[738b40c7f5a39734]::sync::worker_local::WorkerLocal<rustc_middle[57c44cee7187e787]::arena::Arena>, &rustc_data_structures[738b40c7f5a39734]::sync::worker_local::WorkerLocal<rustc_hir[4616985d3bd4a1e2]::Arena>, rustc_driver_impl[5267ee30c81b0e]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
31: 0x7f2db089c895 - rustc_interface[e8534005bd5cee03]::interface::run_compiler::<(), rustc_driver_impl[5267ee30c81b0e]::run_compiler::{closure#0}>::{closure#1}
32: 0x7f2db08fa6c7 - std[77a4331de3222898]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[e8534005bd5cee03]::util::run_in_thread_with_globals<rustc_interface[e8534005bd5cee03]::util::run_in_thread_pool_with_globals<rustc_interface[e8534005bd5cee03]::interface::run_compiler<(), rustc_driver_impl[5267ee30c81b0e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
33: 0x7f2db08fa3a8 - <<std[77a4331de3222898]::thread::Builder>::spawn_unchecked_<rustc_interface[e8534005bd5cee03]::util::run_in_thread_with_globals<rustc_interface[e8534005bd5cee03]::util::run_in_thread_pool_with_globals<rustc_interface[e8534005bd5cee03]::interface::run_compiler<(), rustc_driver_impl[5267ee30c81b0e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[98aea282fc88ea4b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
34: 0x7f2db09009ef - std::sys::thread::unix::Thread::new::thread_start::h5d7739f30ff88cb2
35: 0x7f2daa2969cb - <unknown>
36: 0x7f2daa31aa0c - <unknown>
37: 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: rustc 1.92.0-nightly (bd4a8004c 2025-10-20) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [resolver_for_lowering_raw] getting the resolver for lowering
end of query stack
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0261, E0575.
For more information about an error, try `rustc --explain E0261`.
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.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.