@@ -453,29 +453,25 @@ fn iterate_over_potentially_unsafe_regions_in_type<'a, 'tcx>(
453
453
let dtor_predicates = ty:: lookup_predicates ( rcx. tcx ( ) , impl_did) ;
454
454
455
455
let has_pred_of_interest = dtor_predicates. predicates . iter ( ) . any ( |pred| {
456
- // In `impl<T> Drop where ...`, we automatically
457
- // assume some predicate will be meaningful and thus
458
- // represents a type through which we could reach
459
- // borrowed data. However, there can be implicit
460
- // predicates (namely for Sized), and so we still need
461
- // to walk through and filter out those cases.
456
+ // In `impl<T> Drop where ...`, assume most predicates
457
+ // represent capability on `T` via which a destructor
458
+ // could access borrowed data. But some bounds (Sized,
459
+ // Copy, etc), have no items, i.e. no added capabilty
460
+ // for such type-specific access.
462
461
463
462
let result = match * pred {
464
463
ty:: Predicate :: Trait ( ty:: Binder ( ref t_pred) ) => {
465
464
let def_id = t_pred. trait_ref . def_id ;
466
- match rcx. tcx ( ) . lang_items . to_builtin_kind ( def_id) {
467
- Some ( ty:: BoundSend ) |
468
- Some ( ty:: BoundSized ) |
469
- Some ( ty:: BoundCopy ) |
470
- Some ( ty:: BoundSync ) => false ,
471
- _ => true ,
472
- }
465
+ // A OIBIT (or even a normal builtin) trait
466
+ // defines no associated items, and is
467
+ // uninteresting from point of view of dropck.
468
+ ty:: trait_items ( rcx. tcx ( ) , def_id) . len ( ) != 0
473
469
}
474
470
ty:: Predicate :: Equate ( ..) |
475
471
ty:: Predicate :: RegionOutlives ( ..) |
476
472
ty:: Predicate :: TypeOutlives ( ..) |
477
473
ty:: Predicate :: Projection ( ..) => {
478
- // we assume all of these where-clauses may
474
+ // for now, assume all other where-clauses may
479
475
// give the drop implementation the capabilty
480
476
// to access borrowed data.
481
477
true
0 commit comments