Rollup merge of #159614 - amirHdev:fix-unsafe-binder-debuginfo, r=JohnTitor

debuginfo generation for unsafe binders

debug-info generation removed an unsafe binder which allowed bound regions to escape into layout and trait queries while constructing the inner debug info type
instantiate those bound regions with erased regions before constructing the inner debug info node

Fix rust-lang/rust#159576
This commit is contained in:
Jacob Pratt
2026-07-21 20:59:19 -04:00
committed by GitHub
2 changed files with 10 additions and 1 deletions

View File

@@ -1635,7 +1635,7 @@ fn build_unsafe_binder_type_di_node<'ll, 'tcx>(
binder_type
)
};
let inner_type = inner.skip_binder();
let inner_type = cx.tcx.instantiate_bound_regions_with_erased((*inner).into());
let inner_type_di_node = type_di_node(cx, inner_type);
let type_name = compute_debuginfo_type_name(cx.tcx, binder_type, true);

View File

@@ -0,0 +1,9 @@
//@ check-pass
//@ compile-flags: --crate-type=lib -Cdebuginfo=2
#![feature(unsafe_binders)]
#![allow(incomplete_features)]
pub fn woof() -> unsafe<'a, 'b> &'b Box<dyn Fn(Box<dyn Fn() -> &'a isize>)> {
todo!()
}