@@ -254,23 +254,29 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
254254 }
255255 ty:: Adt ( def, _) => is_def_must_use ( cx, def. did ( ) , span) ,
256256 ty:: Alias ( ty:: Opaque , ty:: AliasTy { def_id : def, .. } ) => {
257- elaborate ( cx. tcx , cx. tcx . explicit_item_bounds ( def) . iter ( ) . cloned ( ) )
258- // We only care about self bounds for the impl-trait
259- . filter_only_self ( )
260- . find_map ( |( pred, _span) | {
261- // We only look at the `DefId`, so it is safe to skip the binder here.
262- if let ty:: PredicateKind :: Clause ( ty:: Clause :: Trait (
263- ref poly_trait_predicate,
264- ) ) = pred. kind ( ) . skip_binder ( )
265- {
266- let def_id = poly_trait_predicate. trait_ref . def_id ;
267-
268- is_def_must_use ( cx, def_id, span)
269- } else {
270- None
271- }
272- } )
273- . map ( |inner| MustUsePath :: Opaque ( Box :: new ( inner) ) )
257+ elaborate (
258+ cx. tcx ,
259+ cx. tcx
260+ . bound_explicit_item_bounds ( def)
261+ . transpose_iter ( )
262+ . map ( |bound| bound. map_bound ( |b| * b) . subst_identity ( ) ) ,
263+ )
264+ // We only care about self bounds for the impl-trait
265+ . filter_only_self ( )
266+ . find_map ( |( pred, _span) | {
267+ // We only look at the `DefId`, so it is safe to skip the binder here.
268+ if let ty:: PredicateKind :: Clause ( ty:: Clause :: Trait (
269+ ref poly_trait_predicate,
270+ ) ) = pred. kind ( ) . skip_binder ( )
271+ {
272+ let def_id = poly_trait_predicate. trait_ref . def_id ;
273+
274+ is_def_must_use ( cx, def_id, span)
275+ } else {
276+ None
277+ }
278+ } )
279+ . map ( |inner| MustUsePath :: Opaque ( Box :: new ( inner) ) )
274280 }
275281 ty:: Dynamic ( binders, _, _) => binders. iter ( ) . find_map ( |predicate| {
276282 if let ty:: ExistentialPredicate :: Trait ( ref trait_ref) = predicate. skip_binder ( )
0 commit comments