@@ -342,7 +342,7 @@ fn exported_symbols_provider_local(
342342 } ) ) ;
343343 }
344344 MonoItem :: Fn ( Instance {
345- def : InstanceKind :: AsyncDropGlueCtorShim ( _, Some ( ty ) ) ,
345+ def : InstanceKind :: AsyncDropGlueCtorShim ( _, ty ) ,
346346 args,
347347 } ) => {
348348 // A little sanity-check
@@ -353,6 +353,13 @@ fn exported_symbols_provider_local(
353353 used : false ,
354354 } ) ) ;
355355 }
356+ MonoItem :: Fn ( Instance { def : InstanceKind :: AsyncDropGlue ( _, ty) , args : _ } ) => {
357+ symbols. push ( ( ExportedSymbol :: AsyncDropGlue ( ty) , SymbolExportInfo {
358+ level : SymbolExportLevel :: Rust ,
359+ kind : SymbolExportKind :: Text ,
360+ used : false ,
361+ } ) ) ;
362+ }
356363 _ => {
357364 // Any other symbols don't qualify for sharing
358365 }
@@ -376,6 +383,7 @@ fn upstream_monomorphizations_provider(
376383
377384 let drop_in_place_fn_def_id = tcx. lang_items ( ) . drop_in_place_fn ( ) ;
378385 let async_drop_in_place_fn_def_id = tcx. lang_items ( ) . async_drop_in_place_fn ( ) ;
386+ let async_drop_in_place_poll_fn_def_id = tcx. lang_items ( ) . async_drop_in_place_poll_fn ( ) ;
379387
380388 for & cnum in cnums. iter ( ) {
381389 for ( exported_symbol, _) in tcx. exported_symbols ( cnum) . iter ( ) {
@@ -394,8 +402,13 @@ fn upstream_monomorphizations_provider(
394402 if let Some ( async_drop_in_place_fn_def_id) = async_drop_in_place_fn_def_id {
395403 ( async_drop_in_place_fn_def_id, tcx. mk_args ( & [ ty. into ( ) ] ) )
396404 } else {
397- // `drop_in_place` in place does not exist, don't try
398- // to use it.
405+ continue ;
406+ }
407+ }
408+ ExportedSymbol :: AsyncDropGlue ( ty) => {
409+ if let Some ( poll_fn_def_id) = async_drop_in_place_poll_fn_def_id {
410+ ( poll_fn_def_id, tcx. mk_args ( & [ ty. into ( ) ] ) )
411+ } else {
399412 continue ;
400413 }
401414 }
@@ -547,6 +560,13 @@ pub(crate) fn symbol_name_for_instance_in_crate<'tcx>(
547560 instantiating_crate,
548561 )
549562 }
563+ ExportedSymbol :: AsyncDropGlue ( ty) => {
564+ rustc_symbol_mangling:: symbol_name_for_instance_in_crate (
565+ tcx,
566+ Instance :: resolve_async_drop_in_place_poll ( tcx, ty) ,
567+ instantiating_crate,
568+ )
569+ }
550570 ExportedSymbol :: NoDefId ( symbol_name) => symbol_name. to_string ( ) ,
551571 }
552572}
@@ -598,6 +618,7 @@ pub(crate) fn linking_symbol_name_for_instance_in_crate<'tcx>(
598618 // AsyncDropGlueCtorShim always use the Rust calling convention and thus follow the
599619 // target's default symbol decoration scheme.
600620 ExportedSymbol :: AsyncDropGlueCtorShim ( ..) => None ,
621+ ExportedSymbol :: AsyncDropGlue ( ..) => None ,
601622 // NoDefId always follow the target's default symbol decoration scheme.
602623 ExportedSymbol :: NoDefId ( ..) => None ,
603624 // ThreadLocalShim always follow the target's default symbol decoration scheme.
0 commit comments