From 28eab11e10b0eb4540a892963a70a2efb9b57c6d Mon Sep 17 00:00:00 2001 From: Sebastien Tardif Date: Tue, 23 Jun 2026 22:44:13 -0700 Subject: [PATCH] rustc_public: lower UnsafeBinder and CoroutineClosure types to SMIR - UnsafeBinder: lower via erased inner type (avoids todo! without a dedicated RigidTy variant yet) - CoroutineClosure: lower with coroutine_closure_def like Closure/Coroutine Signed-off-by: Sebastien Tardif --- .../src/unstable/convert/stable/ty.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_public/src/unstable/convert/stable/ty.rs b/compiler/rustc_public/src/unstable/convert/stable/ty.rs index f9ee9f4ee779e..cd599b80ae416 100644 --- a/compiler/rustc_public/src/unstable/convert/stable/ty.rs +++ b/compiler/rustc_public/src/unstable/convert/stable/ty.rs @@ -465,8 +465,12 @@ impl<'tcx> Stable<'tcx> for ty::TyKind<'tcx> { ty::FnPtr(sig_tys, hdr) => { TyKind::RigidTy(RigidTy::FnPtr(sig_tys.with(*hdr).stable(tables, cx))) } - // FIXME(unsafe_binders): - ty::UnsafeBinder(_) => todo!(), + // Represent unsafe binders by their inner type with regions erased, + // matching other ty queries; full binder structure is not in RigidTy yet. + ty::UnsafeBinder(bound_ty) => { + let inner = cx.tcx.instantiate_bound_regions_with_erased((*bound_ty).into()); + inner.stable(tables, cx) + } ty::Dynamic(existential_predicates, region) => TyKind::RigidTy(RigidTy::Dynamic( existential_predicates .iter() @@ -478,7 +482,12 @@ impl<'tcx> Stable<'tcx> for ty::TyKind<'tcx> { tables.closure_def(*def_id), generic_args.stable(tables, cx), )), - ty::CoroutineClosure(..) => todo!("FIXME(async_closures): Lower these to SMIR"), + ty::CoroutineClosure(def_id, generic_args) => { + TyKind::RigidTy(RigidTy::CoroutineClosure( + tables.coroutine_closure_def(*def_id), + generic_args.stable(tables, cx), + )) + } ty::Coroutine(def_id, generic_args) => TyKind::RigidTy(RigidTy::Coroutine( tables.coroutine_def(*def_id), generic_args.stable(tables, cx),