@@ -58,6 +58,7 @@ impl<'ast, 'tcx> LanguageItemCollector<'ast, 'tcx> {
58
58
& mut self ,
59
59
actual_target : Target ,
60
60
def_id : LocalDefId ,
61
+ cor_def_id : Option < LocalDefId > ,
61
62
attrs : & ' ast [ ast:: Attribute ] ,
62
63
item_span : Span ,
63
64
generics : Option < & ' ast ast:: Generics > ,
@@ -74,6 +75,18 @@ impl<'ast, 'tcx> LanguageItemCollector<'ast, 'tcx> {
74
75
generics,
75
76
actual_target,
76
77
) ;
78
+ // We need to register LangItem::AsyncDropInPlacePoll
79
+ // for async_drop_in_place<T>::{closure}
80
+ if cor_def_id. is_some ( ) && lang_item == LangItem :: AsyncDropInPlace {
81
+ self . collect_item_extended (
82
+ LangItem :: AsyncDropInPlacePoll ,
83
+ cor_def_id. unwrap ( ) ,
84
+ item_span,
85
+ attr_span,
86
+ generics,
87
+ actual_target,
88
+ ) ;
89
+ }
77
90
}
78
91
// Known lang item with attribute on incorrect target.
79
92
Some ( lang_item) => {
@@ -289,10 +302,18 @@ impl<'ast, 'tcx> visit::Visitor<'ast> for LanguageItemCollector<'ast, 'tcx> {
289
302
unreachable ! ( "macros should have been expanded" )
290
303
}
291
304
} ;
305
+ let cor_def_id = if let ast:: ItemKind :: Fn ( box ast:: Fn { sig, .. } ) = & i. kind
306
+ && let Some ( kind) = sig. header . coroutine_kind
307
+ {
308
+ self . resolver . node_id_to_def_id . get ( & kind. closure_id ( ) ) . copied ( )
309
+ } else {
310
+ None
311
+ } ;
292
312
293
313
self . check_for_lang (
294
314
target,
295
315
self . resolver . node_id_to_def_id [ & i. id ] ,
316
+ cor_def_id,
296
317
& i. attrs ,
297
318
i. span ,
298
319
i. opt_generics ( ) ,
@@ -308,6 +329,7 @@ impl<'ast, 'tcx> visit::Visitor<'ast> for LanguageItemCollector<'ast, 'tcx> {
308
329
self . check_for_lang (
309
330
Target :: Variant ,
310
331
self . resolver . node_id_to_def_id [ & variant. id ] ,
332
+ None ,
311
333
& variant. attrs ,
312
334
variant. span ,
313
335
None ,
@@ -350,6 +372,7 @@ impl<'ast, 'tcx> visit::Visitor<'ast> for LanguageItemCollector<'ast, 'tcx> {
350
372
self . check_for_lang (
351
373
target,
352
374
self . resolver . node_id_to_def_id [ & i. id ] ,
375
+ None ,
353
376
& i. attrs ,
354
377
i. span ,
355
378
generics,
0 commit comments