From 9b59341d7bc1b5cc988ec10f2aff80dc998dce61 Mon Sep 17 00:00:00 2001 From: Sebastien Tardif Date: Tue, 30 Jun 2026 12:16:30 -0700 Subject: [PATCH] ty_utils: allow UnsafeBinder and Pat in async drop glue allowlist AsyncDropInPlace instance resolution omitted UnsafeBinder (and Pat) while DropGlue already accepted UnsafeBinder. Align both allowlists with needs_drop component handling. Closes #611 Signed-off-by: Sebastien Tardif --- compiler/rustc_ty_utils/src/instance.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_ty_utils/src/instance.rs b/compiler/rustc_ty_utils/src/instance.rs index 7386afbe53771..8e2c5cfe038b6 100644 --- a/compiler/rustc_ty_utils/src/instance.rs +++ b/compiler/rustc_ty_utils/src/instance.rs @@ -57,6 +57,8 @@ fn resolve_instance_raw<'tcx>( | ty::Dynamic(..) | ty::Array(..) | ty::Slice(..) + // Pat peels in needs_drop_components; allow nontrivial glue for consistency. + | ty::Pat(..) | ty::UnsafeBinder(..) => ty::InstanceKind::DropGlue(def_id, Some(ty)), // Drop shims can only be built from ADTs. _ => return Ok(None), @@ -77,7 +79,10 @@ fn resolve_instance_raw<'tcx>( | ty::Adt(..) | ty::Dynamic(..) | ty::Array(..) - | ty::Slice(..) => {} + | ty::Slice(..) + // Mirror DropGlue: binders and pattern types are compound like Array/Slice. + | ty::Pat(..) + | ty::UnsafeBinder(..) => {} // Async destructor ctor shims can only be built from ADTs. _ => return Ok(None), }