-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Open
Labels
A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-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
Code
pub struct Foo {}
fn foo(foos: Vec<Foo>) {
let foos = foos.iter().collect::<Vec<_>>();
let bar = Bar {};
bar.bar(foos);
}
struct Bar {}
impl Bar {
pub fn bar<I>(&self, iter: I)
where
for<'a> &'a I: IntoIterator<Item = &'a Foo>,
{
}
}
fn main() {}
Meta
rustc --version --verbose
:
rustc 1.91.0-nightly (425a9c0a0 2025-08-17)
binary: rustc
commit-hash: 425a9c0a0e365c0b8c6cfd00c2ded83a73bed9a0
commit-date: 2025-08-17
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 21.1.0
Error output
error: internal compiler error: compiler/rustc_infer/src/infer/region_constraints/mod.rs:474:17: cannot relate bound region: '^0.Named(DefId(0:9 ~ main[1cf8]::{impl#0}::bar::'a)) <= '?13
Backtrace
thread 'rustc' (1602720) panicked at compiler/rustc_infer/src/infer/region_constraints/mod.rs:474:17:
Box<dyn Any>
stack backtrace:
0: 0x7fd00603a7a3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hd788cb3bb9158ca2
1: 0x7fd006801b3c - core::fmt::write::hb80f4ffa6fc0f7b1
2: 0x7fd006025773 - std::io::Write::write_fmt::h6bb076bf70b12ef4
3: 0x7fd00603a8a2 - std::sys::backtrace::BacktraceLock::print::hd483e8dd2b718b72
4: 0x7fd00601d14d - std::panicking::default_hook::{{closure}}::he0bed7ad3805cac7
5: 0x7fd00601cc79 - std::panicking::default_hook::h94a2c2de065812c1
6: 0x7fd00508fb55 - std[f4f1a80b30fd3472]::panicking::update_hook::<alloc[f5336e6eca456f2f]::boxed::Box<rustc_driver_impl[f2114a46e1686a35]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7fd00601c8ef - std::panicking::panic_with_hook::h63c49c5ee0c589f9
8: 0x7fd0050c9371 - std[f4f1a80b30fd3472]::panicking::begin_panic::<rustc_errors[d31dd5bee2539243]::ExplicitBug>::{closure#0}
9: 0x7fd0050c9346 - std[f4f1a80b30fd3472]::sys::backtrace::__rust_end_short_backtrace::<std[f4f1a80b30fd3472]::panicking::begin_panic<rustc_errors[d31dd5bee2539243]::ExplicitBug>::{closure#0}, !>
10: 0x7fd0050c7454 - std[f4f1a80b30fd3472]::panicking::begin_panic::<rustc_errors[d31dd5bee2539243]::ExplicitBug>
11: 0x7fd0050b3a51 - <rustc_errors[d31dd5bee2539243]::diagnostic::BugAbort as rustc_errors[d31dd5bee2539243]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
12: 0x7fd0056d3ccc - <rustc_errors[d31dd5bee2539243]::DiagCtxtHandle>::span_bug::<rustc_span[6757df1147112d96]::span_encoding::Span, alloc[f5336e6eca456f2f]::string::String>
13: 0x7fd0056c2217 - rustc_middle[8bf7973c1327acf9]::util::bug::opt_span_bug_fmt::<rustc_span[6757df1147112d96]::span_encoding::Span>::{closure#0}
14: 0x7fd0056c217a - rustc_middle[8bf7973c1327acf9]::ty::context::tls::with_opt::<rustc_middle[8bf7973c1327acf9]::util::bug::opt_span_bug_fmt<rustc_span[6757df1147112d96]::span_encoding::Span>::{closure#0}, !>::{closure#0}
15: 0x7fd0056c214b - rustc_middle[8bf7973c1327acf9]::ty::context::tls::with_context_opt::<rustc_middle[8bf7973c1327acf9]::ty::context::tls::with_opt<rustc_middle[8bf7973c1327acf9]::util::bug::opt_span_bug_fmt<rustc_span[6757df1147112d96]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
16: 0x7fd0030b1877 - rustc_middle[8bf7973c1327acf9]::util::bug::span_bug_fmt::<rustc_span[6757df1147112d96]::span_encoding::Span>
17: 0x7fd00689680d - rustc_type_ir[580a971a19414d59]::relate::structurally_relate_tys::<rustc_middle[8bf7973c1327acf9]::ty::context::TyCtxt, rustc_infer[4c46ddb0eaa04f9]::infer::relate::type_relating::TypeRelating>::{closure#0}
18: 0x7fd00688ab62 - <rustc_infer[4c46ddb0eaa04f9]::infer::relate::type_relating::TypeRelating as rustc_type_ir[580a971a19414d59]::relate::TypeRelation<rustc_middle[8bf7973c1327acf9]::ty::context::TyCtxt>>::tys
19: 0x7fd006f95d83 - <rustc_trait_selection[13b6d97e8f3edd7e]::traits::engine::ObligationCtxt>::eq::<rustc_middle[8bf7973c1327acf9]::ty::Ty>
20: 0x7fd005dd0012 - <rustc_trait_selection[13b6d97e8f3edd7e]::error_reporting::TypeErrCtxt>::point_at_chain::<rustc_span[6757df1147112d96]::ErrorGuaranteed>
21: 0x7fd005d758f7 - <rustc_trait_selection[13b6d97e8f3edd7e]::error_reporting::TypeErrCtxt>::note_function_argument_obligation::<rustc_span[6757df1147112d96]::ErrorGuaranteed>
22: 0x7fd005dc261d - <rustc_trait_selection[13b6d97e8f3edd7e]::error_reporting::TypeErrCtxt>::note_obligation_cause_code::<rustc_span[6757df1147112d96]::ErrorGuaranteed, rustc_middle[8bf7973c1327acf9]::ty::predicate::Predicate>
23: 0x7fd005d68175 - <rustc_trait_selection[13b6d97e8f3edd7e]::error_reporting::TypeErrCtxt>::note_obligation_cause
24: 0x7fd005defdff - <rustc_trait_selection[13b6d97e8f3edd7e]::error_reporting::TypeErrCtxt>::report_fulfillment_errors
25: 0x7fd00754a6cf - <rustc_hir_typeck[acb03daf39edfc1d]::fn_ctxt::FnCtxt>::check_argument_types
26: 0x7fd007561f1b - <rustc_hir_typeck[acb03daf39edfc1d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
27: 0x7fd00754dec3 - <rustc_hir_typeck[acb03daf39edfc1d]::fn_ctxt::FnCtxt>::check_expr_block
28: 0x7fd00756081c - <rustc_hir_typeck[acb03daf39edfc1d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
29: 0x7fd006a2c092 - rustc_hir_typeck[acb03daf39edfc1d]::check::check_fn
30: 0x7fd006c1adcc - rustc_hir_typeck[acb03daf39edfc1d]::typeck_with_inspect::{closure#0}
31: 0x7fd006c19576 - rustc_query_impl[a0dba7199608cd7a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a0dba7199608cd7a]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8bf7973c1327acf9]::query::erase::Erased<[u8; 8usize]>>
32: 0x7fd006c07685 - rustc_query_system[b801c0976c7f847d]::query::plumbing::try_execute_query::<rustc_query_impl[a0dba7199608cd7a]::DynamicConfig<rustc_data_structures[18101be9f54d6fe6]::vec_cache::VecCache<rustc_span[6757df1147112d96]::def_id::LocalDefId, rustc_middle[8bf7973c1327acf9]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[b801c0976c7f847d]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[a0dba7199608cd7a]::plumbing::QueryCtxt, false>
33: 0x7fd006c07009 - rustc_query_impl[a0dba7199608cd7a]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
34: 0x7fd006c0f993 - rustc_hir_analysis[b888ad5db2cbf28c]::check_crate
35: 0x7fd006c02e7a - rustc_interface[48b61b598b161ed3]::passes::analysis
36: 0x7fd006c02b39 - rustc_query_impl[a0dba7199608cd7a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a0dba7199608cd7a]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8bf7973c1327acf9]::query::erase::Erased<[u8; 0usize]>>
37: 0x7fd0078c7208 - rustc_query_system[b801c0976c7f847d]::query::plumbing::try_execute_query::<rustc_query_impl[a0dba7199608cd7a]::DynamicConfig<rustc_query_system[b801c0976c7f847d]::query::caches::SingleCache<rustc_middle[8bf7973c1327acf9]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[a0dba7199608cd7a]::plumbing::QueryCtxt, false>
38: 0x7fd0078c6e42 - rustc_query_impl[a0dba7199608cd7a]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
39: 0x7fd007ba870b - rustc_interface[48b61b598b161ed3]::passes::create_and_enter_global_ctxt::<core[13a792314c69ca94]::option::Option<rustc_interface[48b61b598b161ed3]::queries::Linker>, rustc_driver_impl[f2114a46e1686a35]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
40: 0x7fd007aa0483 - rustc_interface[48b61b598b161ed3]::interface::run_compiler::<(), rustc_driver_impl[f2114a46e1686a35]::run_compiler::{closure#0}>::{closure#1}
41: 0x7fd007922ef8 - std[f4f1a80b30fd3472]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[48b61b598b161ed3]::util::run_in_thread_with_globals<rustc_interface[48b61b598b161ed3]::util::run_in_thread_pool_with_globals<rustc_interface[48b61b598b161ed3]::interface::run_compiler<(), rustc_driver_impl[f2114a46e1686a35]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
42: 0x7fd007922bdc - <<std[f4f1a80b30fd3472]::thread::Builder>::spawn_unchecked_<rustc_interface[48b61b598b161ed3]::util::run_in_thread_with_globals<rustc_interface[48b61b598b161ed3]::util::run_in_thread_pool_with_globals<rustc_interface[48b61b598b161ed3]::interface::run_compiler<(), rustc_driver_impl[f2114a46e1686a35]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[13a792314c69ca94]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
43: 0x7fd0079283cb - std::sys::pal::unix::thread::Thread::new::thread_start::h1f0570bc6293e30b
44: 0x7fd0010969cb - <unknown>
45: 0x7fd00111aa0c - <unknown>
46: 0x0 - <unknown>
Metadata
Metadata
Assignees
Labels
A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-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.