@@ -390,45 +390,13 @@ fn check_predicates<'tcx>(
390390
391391 let mut res = Ok ( ( ) ) ;
392392 for ( clause, span) in impl1_predicates {
393- if !impl2_predicates. iter ( ) . any ( |pred2| trait_predicates_eq ( clause. as_predicate ( ) , * pred2) )
394- {
393+ if !impl2_predicates. iter ( ) . any ( |& pred2| clause. as_predicate ( ) == pred2) {
395394 res = res. and ( check_specialization_on ( tcx, clause, span) )
396395 }
397396 }
398397 res
399398}
400399
401- /// Checks if some predicate on the specializing impl (`predicate1`) is the same
402- /// as some predicate on the base impl (`predicate2`).
403- ///
404- /// This basically just checks syntactic equivalence, but is a little more
405- /// forgiving since we want to equate `T: Tr` with `T: [const] Tr` so this can work:
406- ///
407- /// ```ignore (illustrative)
408- /// #[rustc_specialization_trait]
409- /// trait Specialize { }
410- ///
411- /// impl<T: Bound> Tr for T { }
412- /// impl<T: [const] Bound + Specialize> const Tr for T { }
413- /// ```
414- ///
415- /// However, we *don't* want to allow the reverse, i.e., when the bound on the
416- /// specializing impl is not as const as the bound on the base impl:
417- ///
418- /// ```ignore (illustrative)
419- /// impl<T: [const] Bound> const Tr for T { }
420- /// impl<T: Bound + Specialize> const Tr for T { } // should be T: [const] Bound
421- /// ```
422- ///
423- /// So we make that check in this function and try to raise a helpful error message.
424- fn trait_predicates_eq < ' tcx > (
425- predicate1 : ty:: Predicate < ' tcx > ,
426- predicate2 : ty:: Predicate < ' tcx > ,
427- ) -> bool {
428- // FIXME(const_trait_impl)
429- predicate1 == predicate2
430- }
431-
432400#[ instrument( level = "debug" , skip( tcx) ) ]
433401fn check_specialization_on < ' tcx > (
434402 tcx : TyCtxt < ' tcx > ,
0 commit comments