@@ -374,7 +374,7 @@ fn exported_symbols_provider_local(
374374 ) ) ;
375375 }
376376 MonoItem :: Fn ( Instance {
377- def : InstanceKind :: AsyncDropGlueCtorShim ( _, Some ( ty ) ) ,
377+ def : InstanceKind :: AsyncDropGlueCtorShim ( _, ty ) ,
378378 args,
379379 } ) => {
380380 // A little sanity-check
@@ -388,6 +388,16 @@ fn exported_symbols_provider_local(
388388 } ,
389389 ) ) ;
390390 }
391+ MonoItem :: Fn ( Instance { def : InstanceKind :: AsyncDropGlue ( _, ty) , args : _ } ) => {
392+ symbols. push ( (
393+ ExportedSymbol :: AsyncDropGlue ( ty) ,
394+ SymbolExportInfo {
395+ level : SymbolExportLevel :: Rust ,
396+ kind : SymbolExportKind :: Text ,
397+ used : false ,
398+ } ,
399+ ) ) ;
400+ }
391401 _ => {
392402 // Any other symbols don't qualify for sharing
393403 }
@@ -411,6 +421,7 @@ fn upstream_monomorphizations_provider(
411421
412422 let drop_in_place_fn_def_id = tcx. lang_items ( ) . drop_in_place_fn ( ) ;
413423 let async_drop_in_place_fn_def_id = tcx. lang_items ( ) . async_drop_in_place_fn ( ) ;
424+ let async_drop_in_place_poll_fn_def_id = tcx. lang_items ( ) . async_drop_in_place_poll_fn ( ) ;
414425
415426 for & cnum in cnums. iter ( ) {
416427 for ( exported_symbol, _) in tcx. exported_symbols ( cnum) . iter ( ) {
@@ -429,8 +440,13 @@ fn upstream_monomorphizations_provider(
429440 if let Some ( async_drop_in_place_fn_def_id) = async_drop_in_place_fn_def_id {
430441 ( async_drop_in_place_fn_def_id, tcx. mk_args ( & [ ty. into ( ) ] ) )
431442 } else {
432- // `drop_in_place` in place does not exist, don't try
433- // to use it.
443+ continue ;
444+ }
445+ }
446+ ExportedSymbol :: AsyncDropGlue ( ty) => {
447+ if let Some ( poll_fn_def_id) = async_drop_in_place_poll_fn_def_id {
448+ ( poll_fn_def_id, tcx. mk_args ( & [ ty. into ( ) ] ) )
449+ } else {
434450 continue ;
435451 }
436452 }
@@ -582,6 +598,13 @@ pub(crate) fn symbol_name_for_instance_in_crate<'tcx>(
582598 instantiating_crate,
583599 )
584600 }
601+ ExportedSymbol :: AsyncDropGlue ( ty) => {
602+ rustc_symbol_mangling:: symbol_name_for_instance_in_crate (
603+ tcx,
604+ Instance :: resolve_async_drop_in_place_poll ( tcx, ty) ,
605+ instantiating_crate,
606+ )
607+ }
585608 ExportedSymbol :: NoDefId ( symbol_name) => symbol_name. to_string ( ) ,
586609 }
587610}
@@ -604,6 +627,7 @@ fn calling_convention_for_symbol<'tcx>(
604627 // AsyncDropGlueCtorShim always use the Rust calling convention and thus follow the
605628 // target's default symbol decoration scheme.
606629 ExportedSymbol :: AsyncDropGlueCtorShim ( ..) => None ,
630+ ExportedSymbol :: AsyncDropGlue ( ..) => None ,
607631 // NoDefId always follow the target's default symbol decoration scheme.
608632 ExportedSymbol :: NoDefId ( ..) => None ,
609633 // ThreadLocalShim always follow the target's default symbol decoration scheme.
0 commit comments