Open
Description
Code
#![feature(closure_lifetime_binder)]
fn fails() {
callback(for<'a> |y: &'a mut i32| -> () {
let _: &'a mut i32 = y;
});
}
fn callback(_: impl for<'a> FnOnce(&'a mut i32)) {}
@rustbot labels +F-closure_lifetime_binder
This issue was discovered while experimenting with #141481
Meta
Reproducible on the playground with rustc 1.89.0-nightly (2025-05-23 3e674b06b5c74adea662)
Error output
Backtrace
error: internal compiler error: compiler/rustc_borrowck/src/universal_regions.rs:928:36: cannot convert `ReLateParam(DefId(0:4 ~ playground[7ed8]::fails::{closure#0}), LateNamed(DefId(0:5 ~ playground[7ed8]::fails::{closure#0}::'a), 'a))` to a region vid
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_borrowck::type_check::TypeChecker>::push_region_constraints
7: <rustc_borrowck::type_check::TypeChecker>::ascribe_user_type
8: rustc_borrowck::do_mir_borrowck
9: <rustc_borrowck::root_cx::BorrowCheckRootCtxt>::get_or_insert_nested
10: rustc_borrowck::mir_borrowck
[... omitted 1 frame ...]
11: <rustc_middle::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface::passes::run_required_analyses::{closure#2}::{closure#0}>::{closure#0}
12: rustc_interface::passes::run_required_analyses
13: rustc_interface::passes::analysis
[... omitted 1 frame ...]
14: 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}
15: 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: please make sure that you have updated to the latest nightly
note: please attach the file at `/playground/rustc-ice-2025-05-24T13_36_39-26.txt` to your bug report
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 `fails`
#1 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `playground` (lib)
Metadata
Metadata
Assignees
Labels
Area: Lifetimes / regionsCategory: This is a bug.`#![feature(closure_lifetime_binder)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: A Minimal Complete and Verifiable Example has been found for this issueRelevant to the compiler team, which will review and decide on the PR/issue.