@@ -363,6 +363,42 @@ fn exported_symbols_provider_local(
363
363
} ,
364
364
) ) ;
365
365
}
366
+ MonoItem :: Fn ( Instance {
367
+ def : InstanceDef :: AsyncDropGlueCtorShim ( def_id, Some ( ty) ) ,
368
+ args,
369
+ } ) => {
370
+ // A little sanity-check
371
+ debug_assert_eq ! (
372
+ args. non_erasable_generics( tcx, def_id) . skip( 1 ) . next( ) ,
373
+ Some ( GenericArgKind :: Type ( ty) )
374
+ ) ;
375
+ symbols. push ( (
376
+ ExportedSymbol :: AsyncDropGlueCtorShim ( ty) ,
377
+ SymbolExportInfo {
378
+ level : SymbolExportLevel :: Rust ,
379
+ kind : SymbolExportKind :: Text ,
380
+ used : false ,
381
+ } ,
382
+ ) ) ;
383
+ }
384
+ MonoItem :: Fn ( Instance {
385
+ def : InstanceDef :: AsyncDropGlue ( def_id, Some ( ty) ) ,
386
+ args,
387
+ } ) => {
388
+ // A little sanity-check
389
+ debug_assert_eq ! (
390
+ args. non_erasable_generics( tcx, def_id) . skip( 1 ) . next( ) ,
391
+ Some ( GenericArgKind :: Type ( ty) )
392
+ ) ;
393
+ symbols. push ( (
394
+ ExportedSymbol :: AsyncDropGlue ( ty) ,
395
+ SymbolExportInfo {
396
+ level : SymbolExportLevel :: Rust ,
397
+ kind : SymbolExportKind :: Text ,
398
+ used : false ,
399
+ } ,
400
+ ) ) ;
401
+ }
366
402
_ => {
367
403
// Any other symbols don't qualify for sharing
368
404
}
@@ -385,6 +421,8 @@ fn upstream_monomorphizations_provider(
385
421
let mut instances: DefIdMap < UnordMap < _ , _ > > = Default :: default ( ) ;
386
422
387
423
let drop_in_place_fn_def_id = tcx. lang_items ( ) . drop_in_place_fn ( ) ;
424
+ let async_drop_in_place_fn_def_id = tcx. lang_items ( ) . async_drop_in_place_fn ( ) ;
425
+ let async_drop_in_place_poll_fn_def_id = tcx. lang_items ( ) . async_drop_in_place_poll_fn ( ) ;
388
426
389
427
for & cnum in cnums. iter ( ) {
390
428
for ( exported_symbol, _) in tcx. exported_symbols ( cnum) . iter ( ) {
@@ -399,6 +437,26 @@ fn upstream_monomorphizations_provider(
399
437
continue ;
400
438
}
401
439
}
440
+ ExportedSymbol :: AsyncDropGlueCtorShim ( ty) => {
441
+ if let Some ( async_drop_in_place_fn_def_id) = async_drop_in_place_fn_def_id {
442
+ (
443
+ async_drop_in_place_fn_def_id,
444
+ tcx. mk_args ( & [ tcx. lifetimes . re_erased . into ( ) , ty. into ( ) ] ) ,
445
+ )
446
+ } else {
447
+ continue ;
448
+ }
449
+ }
450
+ ExportedSymbol :: AsyncDropGlue ( ty) => {
451
+ if let Some ( poll_fn_def_id) = async_drop_in_place_poll_fn_def_id {
452
+ (
453
+ poll_fn_def_id,
454
+ tcx. mk_args ( & [ tcx. lifetimes . re_erased . into ( ) , ty. into ( ) ] ) ,
455
+ )
456
+ } else {
457
+ continue ;
458
+ }
459
+ }
402
460
ExportedSymbol :: NonGeneric ( ..)
403
461
| ExportedSymbol :: ThreadLocalShim ( ..)
404
462
| ExportedSymbol :: NoDefId ( ..) => {
@@ -534,6 +592,20 @@ pub fn symbol_name_for_instance_in_crate<'tcx>(
534
592
Instance :: resolve_drop_in_place ( tcx, ty) ,
535
593
instantiating_crate,
536
594
) ,
595
+ ExportedSymbol :: AsyncDropGlueCtorShim ( ty) => {
596
+ rustc_symbol_mangling:: symbol_name_for_instance_in_crate (
597
+ tcx,
598
+ Instance :: resolve_async_drop_in_place ( tcx, ty) ,
599
+ instantiating_crate,
600
+ )
601
+ }
602
+ ExportedSymbol :: AsyncDropGlue ( ty) => {
603
+ rustc_symbol_mangling:: symbol_name_for_instance_in_crate (
604
+ tcx,
605
+ Instance :: resolve_async_drop_in_place_poll ( tcx, ty) ,
606
+ instantiating_crate,
607
+ )
608
+ }
537
609
ExportedSymbol :: NoDefId ( symbol_name) => symbol_name. to_string ( ) ,
538
610
}
539
611
}
@@ -581,6 +653,10 @@ pub fn linking_symbol_name_for_instance_in_crate<'tcx>(
581
653
// DropGlue always use the Rust calling convention and thus follow the target's default
582
654
// symbol decoration scheme.
583
655
ExportedSymbol :: DropGlue ( ..) => None ,
656
+ // AsyncDropGlueCtorShim always use the Rust calling convention and thus follow the
657
+ // target's default symbol decoration scheme.
658
+ ExportedSymbol :: AsyncDropGlueCtorShim ( ..) => None ,
659
+ ExportedSymbol :: AsyncDropGlue ( ..) => None ,
584
660
// NoDefId always follow the target's default symbol decoration scheme.
585
661
ExportedSymbol :: NoDefId ( ..) => None ,
586
662
// ThreadLocalShim always follow the target's default symbol decoration scheme.
0 commit comments