@@ -364,7 +364,7 @@ fn exported_symbols_provider_local(
364364 ) ) ;
365365 }
366366 MonoItem :: Fn ( Instance {
367- def : InstanceKind :: AsyncDropGlueCtorShim ( def_id, Some ( ty ) ) ,
367+ def : InstanceKind :: AsyncDropGlueCtorShim ( def_id, ty ) ,
368368 args,
369369 } ) => {
370370 // A little sanity-check
@@ -381,6 +381,16 @@ fn exported_symbols_provider_local(
381381 } ,
382382 ) ) ;
383383 }
384+ MonoItem :: Fn ( Instance { def : InstanceKind :: AsyncDropGlue ( _, ty) , args : _ } ) => {
385+ symbols. push ( (
386+ ExportedSymbol :: AsyncDropGlue ( ty) ,
387+ SymbolExportInfo {
388+ level : SymbolExportLevel :: Rust ,
389+ kind : SymbolExportKind :: Text ,
390+ used : false ,
391+ } ,
392+ ) ) ;
393+ }
384394 _ => {
385395 // Any other symbols don't qualify for sharing
386396 }
@@ -404,6 +414,7 @@ fn upstream_monomorphizations_provider(
404414
405415 let drop_in_place_fn_def_id = tcx. lang_items ( ) . drop_in_place_fn ( ) ;
406416 let async_drop_in_place_fn_def_id = tcx. lang_items ( ) . async_drop_in_place_fn ( ) ;
417+ let async_drop_in_place_poll_fn_def_id = tcx. lang_items ( ) . async_drop_in_place_poll_fn ( ) ;
407418
408419 for & cnum in cnums. iter ( ) {
409420 for ( exported_symbol, _) in tcx. exported_symbols ( cnum) . iter ( ) {
@@ -422,8 +433,13 @@ fn upstream_monomorphizations_provider(
422433 if let Some ( async_drop_in_place_fn_def_id) = async_drop_in_place_fn_def_id {
423434 ( async_drop_in_place_fn_def_id, tcx. mk_args ( & [ ty. into ( ) ] ) )
424435 } else {
425- // `drop_in_place` in place does not exist, don't try
426- // to use it.
436+ continue ;
437+ }
438+ }
439+ ExportedSymbol :: AsyncDropGlue ( ty) => {
440+ if let Some ( poll_fn_def_id) = async_drop_in_place_poll_fn_def_id {
441+ ( poll_fn_def_id, tcx. mk_args ( & [ ty. into ( ) ] ) )
442+ } else {
427443 continue ;
428444 }
429445 }
@@ -575,6 +591,13 @@ pub fn symbol_name_for_instance_in_crate<'tcx>(
575591 instantiating_crate,
576592 )
577593 }
594+ ExportedSymbol :: AsyncDropGlue ( ty) => {
595+ rustc_symbol_mangling:: symbol_name_for_instance_in_crate (
596+ tcx,
597+ Instance :: resolve_async_drop_in_place_poll ( tcx, ty) ,
598+ instantiating_crate,
599+ )
600+ }
578601 ExportedSymbol :: NoDefId ( symbol_name) => symbol_name. to_string ( ) ,
579602 }
580603}
@@ -626,6 +649,7 @@ pub fn linking_symbol_name_for_instance_in_crate<'tcx>(
626649 // AsyncDropGlueCtorShim always use the Rust calling convention and thus follow the
627650 // target's default symbol decoration scheme.
628651 ExportedSymbol :: AsyncDropGlueCtorShim ( ..) => None ,
652+ ExportedSymbol :: AsyncDropGlue ( ..) => None ,
629653 // NoDefId always follow the target's default symbol decoration scheme.
630654 ExportedSymbol :: NoDefId ( ..) => None ,
631655 // ThreadLocalShim always follow the target's default symbol decoration scheme.
0 commit comments