-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
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 playground
struct LifetimeMarker<'a>(std::marker::PhantomData<&'a ()>);
fn example<T: Default>() -> impl FnMut(&mut LifetimeMarker) {
// This line invokes ICE
|marker: &mut LifetimeMarker| {
//This works
//|_| {
|| {
let obj = T::default();
needs_static_lifetime(obj);
};
}
}
fn needs_static_lifetime<T: 'static>(obj: T) {}
Code should result in:
error[E0310]: the parameter type `T` may not live long enough
But result is:
error: internal compiler error: compiler/rustc_borrowck/src/universal_regions.rs:928:36: cannot convert `ReLateParam(DefId(0:10 ~ playground[961a]::example::{closure#0}), LateNamed(DefId(0:14 ~ playground[961a]::example::'_), '_))` to a region vid
Meta (local)
rustc --version --verbose
:
Same behavior on playground (both stable and nightly)
rustc 1.90.0-nightly (8f08b3a32 2025-07-18)
binary: rustc
commit-hash: 8f08b3a32478b8d0507732800ecb548a76e0fd0c
commit-date: 2025-07-18
host: x86_64-pc-windows-msvc
release: 1.90.0-nightly
LLVM version: 20.1.8
Error output
thread 'rustc' panicked at compiler/rustc_borrowck/src/universal_regions.rs:928:36:
Box<dyn Any>
stack backtrace:
0: 0x7174a1546543 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h46a716bba2450163
1: 0x7174a1c05947 - core::fmt::write::h275e5980d7008551
2: 0x7174a2cc16d1 - std::io::Write::write_fmt::h561a66a0340b6995
3: 0x7174a15463a2 - std::sys::backtrace::BacktraceLock::print::hafb9d5969adc39a0
4: 0x7174a1549f9a - std::panicking::default_hook::{{closure}}::hae2e97a5c4b2b777
5: 0x7174a1549b1f - std::panicking::default_hook::h3db1b505cfc4eb79
6: 0x7174a0575b93 - std[61bb86a81f0491]::panicking::update_hook::<alloc[7c55b5a5cf9e3c5f]::boxed::Box<rustc_driver_impl[b7d73271a09ede7d]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7174a154a813 - std::panicking::rust_panic_with_hook::h409da73ddef13937
8: 0x7174a05b1f41 - std[61bb86a81f0491]::panicking::begin_panic::<rustc_errors[38d461c0e4a8a2b3]::ExplicitBug>::{closure#0}
9: 0x7174a05a5e16 - std[61bb86a81f0491]::sys::backtrace::__rust_end_short_backtrace::<std[61bb86a81f0491]::panicking::begin_panic<rustc_errors[38d461c0e4a8a2b3]::ExplicitBug>::{closure#0}, !>
10: 0x7174a05a5bf3 - std[61bb86a81f0491]::panicking::begin_panic::<rustc_errors[38d461c0e4a8a2b3]::ExplicitBug>
11: 0x7174a05bc5c1 - <rustc_errors[38d461c0e4a8a2b3]::diagnostic::BugAbort as rustc_errors[38d461c0e4a8a2b3]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
12: 0x7174a0c2adaa - rustc_middle[1134768a56a896b4]::util::bug::opt_span_bug_fmt::<rustc_span[1f7aec696a0836ce]::span_encoding::Span>::{closure#0}
13: 0x7174a0c0331a - rustc_middle[1134768a56a896b4]::ty::context::tls::with_opt::<rustc_middle[1134768a56a896b4]::util::bug::opt_span_bug_fmt<rustc_span[1f7aec696a0836ce]::span_encoding::Span>::{closure#0}, !>::{closure#0}
14: 0x7174a0c0318b - rustc_middle[1134768a56a896b4]::ty::context::tls::with_context_opt::<rustc_middle[1134768a56a896b4]::ty::context::tls::with_opt<rustc_middle[1134768a56a896b4]::util::bug::opt_span_bug_fmt<rustc_span[1f7aec696a0836ce]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
15: 0x71749de85ff0 - rustc_middle[1134768a56a896b4]::util::bug::bug_fmt
16: 0x7174a22b316a - <rustc_infer[90ea0da8f705ff7b]::infer::outlives::obligations::TypeOutlives<&mut rustc_borrowck[177ef636edd0ce33]::type_check::constraint_conversion::ConstraintConversion>>::components_must_outlive
17: 0x7174a2c2c477 - <rustc_borrowck[177ef636edd0ce33]::type_check::constraint_conversion::ConstraintConversion>::convert
18: 0x7174a2c2ae2f - <rustc_borrowck[177ef636edd0ce33]::type_check::TypeChecker>::prove_closure_bounds
19: 0x71749eed40d0 - <rustc_borrowck[177ef636edd0ce33]::type_check::TypeChecker as rustc_middle[1134768a56a896b4]::mir::visit::Visitor>::visit_rvalue
20: 0x7174a2f9d233 - <rustc_borrowck[177ef636edd0ce33]::type_check::TypeChecker as rustc_middle[1134768a56a896b4]::mir::visit::Visitor>::visit_body
21: 0x7174a2c3fd14 - rustc_borrowck[177ef636edd0ce33]::do_mir_borrowck
22: 0x7174a2c2cbf6 - <rustc_borrowck[177ef636edd0ce33]::root_cx::BorrowCheckRootCtxt>::get_or_insert_nested
23: 0x7174a1fca8ef - rustc_borrowck[177ef636edd0ce33]::mir_borrowck
24: 0x7174a1fca59f - rustc_query_impl[6f0ca6887c150a69]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6f0ca6887c150a69]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1134768a56a896b4]::query::erase::Erased<[u8; 8usize]>>
25: 0x7174a1fc9366 - rustc_query_system[48caa8a8a4cfcb68]::query::plumbing::try_execute_query::<rustc_query_impl[6f0ca6887c150a69]::DynamicConfig<rustc_data_structures[e24569e090b577b3]::vec_cache::VecCache<rustc_span[1f7aec696a0836ce]::def_id::LocalDefId, rustc_middle[1134768a56a896b4]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[48caa8a8a4cfcb68]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[6f0ca6887c150a69]::plumbing::QueryCtxt, false>
26: 0x7174a1fc8d12 - rustc_query_impl[6f0ca6887c150a69]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
27: 0x7174a2e547eb - rustc_hir_analysis[5a87eb6962d34b42]::collect::type_of::opaque::find_opaque_ty_constraints_for_rpit
28: 0x7174a2e54574 - rustc_hir_analysis[5a87eb6962d34b42]::collect::type_of::type_of_opaque
29: 0x7174a2e54437 - rustc_query_impl[6f0ca6887c150a69]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6f0ca6887c150a69]::query_impl::type_of_opaque::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1134768a56a896b4]::query::erase::Erased<[u8; 8usize]>>
30: 0x7174a20800bf - rustc_query_system[48caa8a8a4cfcb68]::query::plumbing::try_execute_query::<rustc_query_impl[6f0ca6887c150a69]::DynamicConfig<rustc_query_system[48caa8a8a4cfcb68]::query::caches::DefIdCache<rustc_middle[1134768a56a896b4]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[6f0ca6887c150a69]::plumbing::QueryCtxt, false>
31: 0x7174a2ed7dfc - rustc_query_impl[6f0ca6887c150a69]::query_impl::type_of_opaque::get_query_non_incr::__rust_end_short_backtrace
32: 0x7174a2086b48 - rustc_hir_analysis[5a87eb6962d34b42]::collect::type_of::type_of
33: 0x7174a2081476 - rustc_query_impl[6f0ca6887c150a69]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6f0ca6887c150a69]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1134768a56a896b4]::query::erase::Erased<[u8; 8usize]>>
34: 0x7174a20800bf - rustc_query_system[48caa8a8a4cfcb68]::query::plumbing::try_execute_query::<rustc_query_impl[6f0ca6887c150a69]::DynamicConfig<rustc_query_system[48caa8a8a4cfcb68]::query::caches::DefIdCache<rustc_middle[1134768a56a896b4]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[6f0ca6887c150a69]::plumbing::QueryCtxt, false>
35: 0x7174a207fc6b - rustc_query_impl[6f0ca6887c150a69]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
36: 0x7174a2e54d19 - rustc_hir_analysis[5a87eb6962d34b42]::check::check::check_opaque
37: 0x7174a21ce682 - rustc_hir_analysis[5a87eb6962d34b42]::check::check::check_item_type
38: 0x7174a24199e9 - rustc_hir_analysis[5a87eb6962d34b42]::check::wfcheck::check_well_formed
39: 0x7174a241704b - rustc_query_impl[6f0ca6887c150a69]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6f0ca6887c150a69]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1134768a56a896b4]::query::erase::Erased<[u8; 1usize]>>
40: 0x7174a24168f1 - rustc_query_system[48caa8a8a4cfcb68]::query::plumbing::try_execute_query::<rustc_query_impl[6f0ca6887c150a69]::DynamicConfig<rustc_data_structures[e24569e090b577b3]::vec_cache::VecCache<rustc_span[1f7aec696a0836ce]::def_id::LocalDefId, rustc_middle[1134768a56a896b4]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[48caa8a8a4cfcb68]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[6f0ca6887c150a69]::plumbing::QueryCtxt, false>
41: 0x7174a24163e6 - rustc_query_impl[6f0ca6887c150a69]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
42: 0x7174a2413d23 - rustc_hir_analysis[5a87eb6962d34b42]::check::wfcheck::check_mod_type_wf
43: 0x7174a241375f - rustc_query_impl[6f0ca6887c150a69]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6f0ca6887c150a69]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1134768a56a896b4]::query::erase::Erased<[u8; 1usize]>>
44: 0x7174a2beda84 - rustc_query_system[48caa8a8a4cfcb68]::query::plumbing::try_execute_query::<rustc_query_impl[6f0ca6887c150a69]::DynamicConfig<rustc_query_system[48caa8a8a4cfcb68]::query::caches::DefaultCache<rustc_span[1f7aec696a0836ce]::def_id::LocalModDefId, rustc_middle[1134768a56a896b4]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[6f0ca6887c150a69]::plumbing::QueryCtxt, false>
45: 0x7174a2bed811 - rustc_query_impl[6f0ca6887c150a69]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
46: 0x7174a1fc6f72 - rustc_hir_analysis[5a87eb6962d34b42]::check_crate
47: 0x7174a25e0237 - rustc_interface[a43b584b4c4124b4]::passes::run_required_analyses
48: 0x7174a2aedb5e - rustc_interface[a43b584b4c4124b4]::passes::analysis
49: 0x7174a2aedb35 - rustc_query_impl[6f0ca6887c150a69]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6f0ca6887c150a69]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1134768a56a896b4]::query::erase::Erased<[u8; 0usize]>>
50: 0x7174a2aefc3a - rustc_query_system[48caa8a8a4cfcb68]::query::plumbing::try_execute_query::<rustc_query_impl[6f0ca6887c150a69]::DynamicConfig<rustc_query_system[48caa8a8a4cfcb68]::query::caches::SingleCache<rustc_middle[1134768a56a896b4]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[6f0ca6887c150a69]::plumbing::QueryCtxt, false>
51: 0x7174a2aef90f - rustc_query_impl[6f0ca6887c150a69]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
52: 0x7174a2daa0c7 - rustc_interface[a43b584b4c4124b4]::passes::create_and_enter_global_ctxt::<core[105cb658ab12d76f]::option::Option<rustc_interface[a43b584b4c4124b4]::queries::Linker>, rustc_driver_impl[b7d73271a09ede7d]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
53: 0x7174a2cfe966 - rustc_interface[a43b584b4c4124b4]::interface::run_compiler::<(), rustc_driver_impl[b7d73271a09ede7d]::run_compiler::{closure#0}>::{closure#1}
54: 0x7174a2cb523e - std[61bb86a81f0491]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[a43b584b4c4124b4]::util::run_in_thread_with_globals<rustc_interface[a43b584b4c4124b4]::util::run_in_thread_pool_with_globals<rustc_interface[a43b584b4c4124b4]::interface::run_compiler<(), rustc_driver_impl[b7d73271a09ede7d]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
55: 0x7174a2cb56b4 - <<std[61bb86a81f0491]::thread::Builder>::spawn_unchecked_<rustc_interface[a43b584b4c4124b4]::util::run_in_thread_with_globals<rustc_interface[a43b584b4c4124b4]::util::run_in_thread_pool_with_globals<rustc_interface[a43b584b4c4124b4]::interface::run_compiler<(), rustc_driver_impl[b7d73271a09ede7d]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[105cb658ab12d76f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
56: 0x7174a2cb6aab - std::sys::pal::unix::thread::Thread::new::thread_start::h1822d22fde68314f
57: 0x71749ca8aaa4 - <unknown>
58: 0x71749cb17a34 - clone
59: 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: rustc 1.88.0 (6b00bc388 2025-06-23) running on x86_64-unknown-linux-gnu
note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [mir_borrowck] borrow-checking `example`
#1 [type_of_opaque] computing type of opaque `example::{opaque#0}`
... and 4 other queries... use `env RUST_BACKTRACE=1` to see the full query stack
warning: `playground` (lib) generated 1 warning
error: could not compile `playground` (lib); 1 warning emitted
Caused by:
process didn't exit successfully: `/playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name playground --edition=2024 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=88d75c911cfddd04 -C extra-filename=-013ef0dffb93ce85 --out-dir /playground/target/debug/deps -L dependency=/playground/target/debug/deps [...] (deleted bcs 65536 character limit)` (exit status: 101)
Backtrace
thread 'rustc' panicked at compiler/rustc_borrowck/src/universal_regions.rs:928:36:
Box<dyn Any>
stack backtrace:
0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
2: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
3: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
4: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
5: rustc_middle::util::bug::bug_fmt
6: <rustc_infer::infer::outlives::obligations::TypeOutlives<&mut rustc_borrowck::type_check::constraint_conversion::ConstraintConversion>>::components_must_outlive
7: <rustc_borrowck::type_check::constraint_conversion::ConstraintConversion>::convert
8: <rustc_borrowck::type_check::TypeChecker>::prove_closure_bounds
9: <rustc_borrowck::type_check::TypeChecker as rustc_middle::mir::visit::Visitor>::visit_rvalue
10: <rustc_borrowck::type_check::TypeChecker as rustc_middle::mir::visit::Visitor>::visit_body
11: rustc_borrowck::do_mir_borrowck
12: <rustc_borrowck::root_cx::BorrowCheckRootCtxt>::get_or_insert_nested
13: rustc_borrowck::mir_borrowck
[... omitted 1 frame ...]
14: rustc_hir_analysis::collect::type_of::opaque::find_opaque_ty_constraints_for_rpit
15: rustc_hir_analysis::collect::type_of::type_of_opaque
[... omitted 1 frame ...]
16: rustc_hir_analysis::collect::type_of::type_of
[... omitted 1 frame ...]
17: rustc_hir_analysis::check::check::check_opaque
18: rustc_hir_analysis::check::check::check_item_type
19: rustc_hir_analysis::check::wfcheck::check_well_formed
[... omitted 1 frame ...]
20: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
[... omitted 1 frame ...]
21: rustc_hir_analysis::check_crate
22: rustc_interface::passes::run_required_analyses
23: rustc_interface::passes::analysis
[... omitted 1 frame ...]
24: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
25: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
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: rustc 1.88.0 (6b00bc388 2025-06-23) running on x86_64-unknown-linux-gnu
note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [mir_borrowck] borrow-checking `example`
#1 [type_of_opaque] computing type of opaque `example::{opaque#0}`
#2 [type_of] computing type of `example::{opaque#0}`
#3 [check_well_formed] checking that `example::{opaque#0}` is well-formed
#4 [check_mod_type_wf] checking that types are well-formed in top-level module
#5 [analysis] running analysis passes on this crate
end of query stack
warning: `playground` (lib) generated 1 warning
error: could not compile `playground` (lib); 1 warning emitted
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.