@@ -251,6 +251,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
251
251
/// The root of the normal must_use lint with an optional message.
252
252
Def ( Span , DefId , Option < Symbol > ) ,
253
253
Boxed ( Box < Self > ) ,
254
+ Pinned ( Box < Self > ) ,
254
255
Opaque ( Box < Self > ) ,
255
256
TraitObject ( Box < Self > ) ,
256
257
TupleElement ( Vec < ( usize , Self ) > ) ,
@@ -284,6 +285,11 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
284
285
is_ty_must_use ( cx, boxed_ty, expr, span)
285
286
. map ( |inner| MustUsePath :: Boxed ( Box :: new ( inner) ) )
286
287
}
288
+ ty:: Adt ( def, args) if cx. tcx . lang_items ( ) . pin_type ( ) == Some ( def. did ( ) ) => {
289
+ let pinned_ty = args. type_at ( 0 ) ;
290
+ is_ty_must_use ( cx, pinned_ty, expr, span)
291
+ . map ( |inner| MustUsePath :: Pinned ( Box :: new ( inner) ) )
292
+ }
287
293
ty:: Adt ( def, _) => is_def_must_use ( cx, def. did ( ) , span) ,
288
294
ty:: Alias ( ty:: Opaque , ty:: AliasTy { def_id : def, .. } ) => {
289
295
elaborate (
@@ -425,6 +431,18 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
425
431
expr_is_from_block,
426
432
) ;
427
433
}
434
+ MustUsePath :: Pinned ( path) => {
435
+ let descr_pre = & format ! ( "{descr_pre}pinned " ) ;
436
+ emit_must_use_untranslated (
437
+ cx,
438
+ path,
439
+ descr_pre,
440
+ descr_post,
441
+ plural_len,
442
+ true ,
443
+ expr_is_from_block,
444
+ ) ;
445
+ }
428
446
MustUsePath :: Opaque ( path) => {
429
447
let descr_pre = & format ! ( "{descr_pre}implementer{plural_suffix} of " ) ;
430
448
emit_must_use_untranslated (
0 commit comments