@@ -363,6 +363,42 @@ fn exported_symbols_provider_local(
363363 } ,
364364 ) ) ;
365365 }
366+ MonoItem :: Fn ( Instance {
367+ def : InstanceDef :: AsyncDropGlueCtorShim ( def_id, Some ( ty) ) ,
368+ args,
369+ } ) => {
370+ // A little sanity-check
371+ debug_assert_eq ! (
372+ args. non_erasable_generics( tcx, def_id) . skip( 1 ) . next( ) ,
373+ Some ( GenericArgKind :: Type ( ty) )
374+ ) ;
375+ symbols. push ( (
376+ ExportedSymbol :: AsyncDropGlueCtorShim ( ty) ,
377+ SymbolExportInfo {
378+ level : SymbolExportLevel :: Rust ,
379+ kind : SymbolExportKind :: Text ,
380+ used : false ,
381+ } ,
382+ ) ) ;
383+ }
384+ MonoItem :: Fn ( Instance {
385+ def : InstanceDef :: AsyncDropGlue ( def_id, Some ( ty) ) ,
386+ args,
387+ } ) => {
388+ // A little sanity-check
389+ debug_assert_eq ! (
390+ args. non_erasable_generics( tcx, def_id) . skip( 1 ) . next( ) ,
391+ Some ( GenericArgKind :: Type ( ty) )
392+ ) ;
393+ symbols. push ( (
394+ ExportedSymbol :: AsyncDropGlue ( ty) ,
395+ SymbolExportInfo {
396+ level : SymbolExportLevel :: Rust ,
397+ kind : SymbolExportKind :: Text ,
398+ used : false ,
399+ } ,
400+ ) ) ;
401+ }
366402 _ => {
367403 // Any other symbols don't qualify for sharing
368404 }
@@ -385,6 +421,8 @@ fn upstream_monomorphizations_provider(
385421 let mut instances: DefIdMap < UnordMap < _ , _ > > = Default :: default ( ) ;
386422
387423 let drop_in_place_fn_def_id = tcx. lang_items ( ) . drop_in_place_fn ( ) ;
424+ let async_drop_in_place_fn_def_id = tcx. lang_items ( ) . async_drop_in_place_fn ( ) ;
425+ let async_drop_in_place_poll_fn_def_id = tcx. lang_items ( ) . async_drop_in_place_poll_fn ( ) ;
388426
389427 for & cnum in cnums. iter ( ) {
390428 for ( exported_symbol, _) in tcx. exported_symbols ( cnum) . iter ( ) {
@@ -399,6 +437,26 @@ fn upstream_monomorphizations_provider(
399437 continue ;
400438 }
401439 }
440+ ExportedSymbol :: AsyncDropGlueCtorShim ( ty) => {
441+ if let Some ( async_drop_in_place_fn_def_id) = async_drop_in_place_fn_def_id {
442+ (
443+ async_drop_in_place_fn_def_id,
444+ tcx. mk_args ( & [ tcx. lifetimes . re_erased . into ( ) , ty. into ( ) ] ) ,
445+ )
446+ } else {
447+ continue ;
448+ }
449+ }
450+ ExportedSymbol :: AsyncDropGlue ( ty) => {
451+ if let Some ( poll_fn_def_id) = async_drop_in_place_poll_fn_def_id {
452+ (
453+ poll_fn_def_id,
454+ tcx. mk_args ( & [ tcx. lifetimes . re_erased . into ( ) , ty. into ( ) ] ) ,
455+ )
456+ } else {
457+ continue ;
458+ }
459+ }
402460 ExportedSymbol :: NonGeneric ( ..)
403461 | ExportedSymbol :: ThreadLocalShim ( ..)
404462 | ExportedSymbol :: NoDefId ( ..) => {
@@ -534,6 +592,20 @@ pub fn symbol_name_for_instance_in_crate<'tcx>(
534592 Instance :: resolve_drop_in_place ( tcx, ty) ,
535593 instantiating_crate,
536594 ) ,
595+ ExportedSymbol :: AsyncDropGlueCtorShim ( ty) => {
596+ rustc_symbol_mangling:: symbol_name_for_instance_in_crate (
597+ tcx,
598+ Instance :: resolve_async_drop_in_place ( tcx, ty) ,
599+ instantiating_crate,
600+ )
601+ }
602+ ExportedSymbol :: AsyncDropGlue ( ty) => {
603+ rustc_symbol_mangling:: symbol_name_for_instance_in_crate (
604+ tcx,
605+ Instance :: resolve_async_drop_in_place_poll ( tcx, ty) ,
606+ instantiating_crate,
607+ )
608+ }
537609 ExportedSymbol :: NoDefId ( symbol_name) => symbol_name. to_string ( ) ,
538610 }
539611}
@@ -581,6 +653,10 @@ pub fn linking_symbol_name_for_instance_in_crate<'tcx>(
581653 // DropGlue always use the Rust calling convention and thus follow the target's default
582654 // symbol decoration scheme.
583655 ExportedSymbol :: DropGlue ( ..) => None ,
656+ // AsyncDropGlueCtorShim always use the Rust calling convention and thus follow the
657+ // target's default symbol decoration scheme.
658+ ExportedSymbol :: AsyncDropGlueCtorShim ( ..) => None ,
659+ ExportedSymbol :: AsyncDropGlue ( ..) => None ,
584660 // NoDefId always follow the target's default symbol decoration scheme.
585661 ExportedSymbol :: NoDefId ( ..) => None ,
586662 // ThreadLocalShim always follow the target's default symbol decoration scheme.
0 commit comments