@@ -383,6 +383,16 @@ fn exported_symbols_provider_local(
383383 } ,
384384 ) ) ;
385385 }
386+ MonoItem :: Fn ( Instance { def : InstanceKind :: AsyncDropGlue ( _, ty) , args : _ } ) => {
387+ symbols. push ( (
388+ ExportedSymbol :: AsyncDropGlue ( ty) ,
389+ SymbolExportInfo {
390+ level : SymbolExportLevel :: Rust ,
391+ kind : SymbolExportKind :: Text ,
392+ used : false ,
393+ } ,
394+ ) ) ;
395+ }
386396 _ => {
387397 // Any other symbols don't qualify for sharing
388398 }
@@ -406,6 +416,8 @@ fn upstream_monomorphizations_provider(
406416
407417 let drop_in_place_fn_def_id = tcx. lang_items ( ) . drop_in_place_fn ( ) ;
408418 let async_drop_in_place_fn_def_id = tcx. lang_items ( ) . async_drop_in_place_fn ( ) ;
419+ let async_drop_in_place_poll_fn_def_id = tcx. lang_items ( ) . async_drop_in_place_poll_fn ( ) ;
420+ let future_drop_poll_fn_def_id = tcx. lang_items ( ) . future_drop_poll_fn ( ) ;
409421
410422 for & cnum in cnums. iter ( ) {
411423 for ( exported_symbol, _) in tcx. exported_symbols ( cnum) . iter ( ) {
@@ -424,8 +436,20 @@ fn upstream_monomorphizations_provider(
424436 if let Some ( async_drop_in_place_fn_def_id) = async_drop_in_place_fn_def_id {
425437 ( async_drop_in_place_fn_def_id, tcx. mk_args ( & [ ty. into ( ) ] ) )
426438 } else {
427- // `drop_in_place` in place does not exist, don't try
428- // to use it.
439+ continue ;
440+ }
441+ }
442+ ExportedSymbol :: AsyncDropGlue ( ty) => {
443+ if let Some ( poll_fn_def_id) = async_drop_in_place_poll_fn_def_id {
444+ ( poll_fn_def_id, tcx. mk_args ( & [ ty. into ( ) ] ) )
445+ } else {
446+ continue ;
447+ }
448+ }
449+ ExportedSymbol :: FutureDropPoll ( ty) => {
450+ if let Some ( poll_fn_def_id) = future_drop_poll_fn_def_id {
451+ ( poll_fn_def_id, tcx. mk_args ( & [ ty. into ( ) ] ) )
452+ } else {
429453 continue ;
430454 }
431455 }
@@ -577,6 +601,20 @@ pub fn symbol_name_for_instance_in_crate<'tcx>(
577601 instantiating_crate,
578602 )
579603 }
604+ ExportedSymbol :: AsyncDropGlue ( ty) => {
605+ rustc_symbol_mangling:: symbol_name_for_instance_in_crate (
606+ tcx,
607+ Instance :: resolve_async_drop_in_place_poll ( tcx, ty) ,
608+ instantiating_crate,
609+ )
610+ }
611+ ExportedSymbol :: FutureDropPoll ( ty) => {
612+ rustc_symbol_mangling:: symbol_name_for_instance_in_crate (
613+ tcx,
614+ Instance :: resolve_future_drop_poll ( tcx, ty) ,
615+ instantiating_crate,
616+ )
617+ }
580618 ExportedSymbol :: NoDefId ( symbol_name) => symbol_name. to_string ( ) ,
581619 }
582620}
@@ -628,6 +666,8 @@ pub fn linking_symbol_name_for_instance_in_crate<'tcx>(
628666 // AsyncDropGlueCtorShim always use the Rust calling convention and thus follow the
629667 // target's default symbol decoration scheme.
630668 ExportedSymbol :: AsyncDropGlueCtorShim ( ..) => None ,
669+ ExportedSymbol :: AsyncDropGlue ( ..) => None ,
670+ ExportedSymbol :: FutureDropPoll ( ..) => None ,
631671 // NoDefId always follow the target's default symbol decoration scheme.
632672 ExportedSymbol :: NoDefId ( ..) => None ,
633673 // ThreadLocalShim always follow the target's default symbol decoration scheme.
0 commit comments