From db7f669fab5b2f6dd75b94b809ee77a9671c7766 Mon Sep 17 00:00:00 2001 From: Sebastien Tardif Date: Wed, 24 Jun 2026 10:55:08 -0700 Subject: [PATCH] sanitizers: encode CFI typeid for UnsafeBinder via erased inner type encode_ty had todo!() on ty::UnsafeBinder, which would ICE if CFI type metadata were requested for an unstable unsafe-binder type. Treat binders as transparent and encode the region-erased inner type, matching symbol mangling and other ty queries. Signed-off-by: Sebastien Tardif --- .../src/cfi/typeid/itanium_cxx_abi/encode.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs index 873ed9bb10398..fbcded1fbcd56 100644 --- a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs +++ b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs @@ -592,9 +592,11 @@ pub(crate) fn encode_ty<'tcx>( typeid.push_str(&s); } - // FIXME(unsafe_binders): Implement this. - ty::UnsafeBinder(_) => { - todo!() + // Unsafe binders are transparent for CFI type identity: encode the inner + // type with regions erased (same approach as symbol mangling / ty queries). + ty::UnsafeBinder(bound_ty) => { + let inner = tcx.instantiate_bound_regions_with_erased((*bound_ty).into()); + typeid.push_str(&encode_ty(tcx, inner, dict, options)); } // Trait types