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