@@ -372,7 +372,7 @@ fn exported_symbols_provider_local(
372372 ) ) ;
373373 }
374374 MonoItem :: Fn ( Instance {
375- def : InstanceKind :: AsyncDropGlueCtorShim ( _, Some ( ty ) ) ,
375+ def : InstanceKind :: AsyncDropGlueCtorShim ( _, ty ) ,
376376 args,
377377 } ) => {
378378 // A little sanity-check
@@ -386,6 +386,16 @@ fn exported_symbols_provider_local(
386386 } ,
387387 ) ) ;
388388 }
389+ MonoItem :: Fn ( Instance { def : InstanceKind :: AsyncDropGlue ( _, ty) , args : _ } ) => {
390+ symbols. push ( (
391+ ExportedSymbol :: AsyncDropGlue ( ty) ,
392+ SymbolExportInfo {
393+ level : SymbolExportLevel :: Rust ,
394+ kind : SymbolExportKind :: Text ,
395+ used : false ,
396+ } ,
397+ ) ) ;
398+ }
389399 _ => {
390400 // Any other symbols don't qualify for sharing
391401 }
@@ -409,6 +419,7 @@ fn upstream_monomorphizations_provider(
409419
410420 let drop_in_place_fn_def_id = tcx. lang_items ( ) . drop_in_place_fn ( ) ;
411421 let async_drop_in_place_fn_def_id = tcx. lang_items ( ) . async_drop_in_place_fn ( ) ;
422+ let async_drop_in_place_poll_fn_def_id = tcx. lang_items ( ) . async_drop_in_place_poll_fn ( ) ;
412423
413424 for & cnum in cnums. iter ( ) {
414425 for ( exported_symbol, _) in tcx. exported_symbols ( cnum) . iter ( ) {
@@ -427,8 +438,13 @@ fn upstream_monomorphizations_provider(
427438 if let Some ( async_drop_in_place_fn_def_id) = async_drop_in_place_fn_def_id {
428439 ( async_drop_in_place_fn_def_id, tcx. mk_args ( & [ ty. into ( ) ] ) )
429440 } else {
430- // `drop_in_place` in place does not exist, don't try
431- // to use it.
441+ continue ;
442+ }
443+ }
444+ ExportedSymbol :: AsyncDropGlue ( ty) => {
445+ if let Some ( poll_fn_def_id) = async_drop_in_place_poll_fn_def_id {
446+ ( poll_fn_def_id, tcx. mk_args ( & [ ty. into ( ) ] ) )
447+ } else {
432448 continue ;
433449 }
434450 }
@@ -580,6 +596,13 @@ pub(crate) fn symbol_name_for_instance_in_crate<'tcx>(
580596 instantiating_crate,
581597 )
582598 }
599+ ExportedSymbol :: AsyncDropGlue ( ty) => {
600+ rustc_symbol_mangling:: symbol_name_for_instance_in_crate (
601+ tcx,
602+ Instance :: resolve_async_drop_in_place_poll ( tcx, ty) ,
603+ instantiating_crate,
604+ )
605+ }
583606 ExportedSymbol :: NoDefId ( symbol_name) => symbol_name. to_string ( ) ,
584607 }
585608}
@@ -631,6 +654,7 @@ pub(crate) fn linking_symbol_name_for_instance_in_crate<'tcx>(
631654 // AsyncDropGlueCtorShim always use the Rust calling convention and thus follow the
632655 // target's default symbol decoration scheme.
633656 ExportedSymbol :: AsyncDropGlueCtorShim ( ..) => None ,
657+ ExportedSymbol :: AsyncDropGlue ( ..) => None ,
634658 // NoDefId always follow the target's default symbol decoration scheme.
635659 ExportedSymbol :: NoDefId ( ..) => None ,
636660 // ThreadLocalShim always follow the target's default symbol decoration scheme.
0 commit comments