@@ -41,7 +41,7 @@ pub(super) enum CandidateSource {
41
41
ObjectBound ( usize ) ,
42
42
/// Implementation of `Send` or other explicitly listed *auto* traits for
43
43
/// a `dyn Trait + Send + Sync`
44
- ObjectAutoBound ( usize ) ,
44
+ ObjectAutoBound ,
45
45
/// A builtin implementation for some specific traits, used in cases
46
46
/// where we cannot rely an ordinary library implementations.
47
47
///
@@ -165,12 +165,8 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
165
165
}
166
166
}
167
167
168
- for ( idx, predicate) in object_bounds. iter ( ) . enumerate ( ) {
169
- let ty:: ExistentialPredicate :: AutoTrait ( def_id) = predicate. skip_binder ( ) else { continue } ;
170
- if def_id != goal. predicate . def_id ( ) {
171
- continue ;
172
- }
173
- acx. try_insert_candidate ( CandidateSource :: ObjectAutoBound ( idx) , Certainty :: Yes ) ;
168
+ if object_bounds. auto_traits ( ) . any ( |def_id| def_id == goal. predicate . def_id ( ) ) {
169
+ acx. try_insert_candidate ( CandidateSource :: ObjectAutoBound , Certainty :: Yes ) ;
174
170
}
175
171
}
176
172
}
@@ -265,7 +261,7 @@ impl<'tcx> EvalCtxt<'tcx> {
265
261
| ( CandidateSource :: ParamEnv ( _) , _)
266
262
| ( CandidateSource :: AliasBound ( _) , _)
267
263
| ( CandidateSource :: ObjectBound ( _) , _)
268
- | ( CandidateSource :: ObjectAutoBound ( _ ) , _)
264
+ | ( CandidateSource :: ObjectAutoBound , _)
269
265
| ( CandidateSource :: Builtin , _)
270
266
| ( CandidateSource :: AutoImpl , _) => unimplemented ! ( ) ,
271
267
}
0 commit comments