@@ -453,29 +453,25 @@ fn iterate_over_potentially_unsafe_regions_in_type<'a, 'tcx>(
453453 let dtor_predicates = ty:: lookup_predicates ( rcx. tcx ( ) , impl_did) ;
454454
455455 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.
462461
463462 let result = match * pred {
464463 ty:: Predicate :: Trait ( ty:: Binder ( ref t_pred) ) => {
465464 let def_id = t_pred. trait_ref . def_id ;
466- match rcx. tcx ( ) . lang_items . to_builtin_kind ( def_id) {
467- // Issue 24895: deliberately do not include `BoundCopy` here.
468- Some ( ty:: BoundSend ) |
469- Some ( ty:: BoundSized ) |
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
473469 }
474470 ty:: Predicate :: Equate ( ..) |
475471 ty:: Predicate :: RegionOutlives ( ..) |
476472 ty:: Predicate :: TypeOutlives ( ..) |
477473 ty:: Predicate :: Projection ( ..) => {
478- // we assume all of these where-clauses may
474+ // for now, assume all other where-clauses may
479475 // give the drop implementation the capabilty
480476 // to access borrowed data.
481477 true
0 commit comments