@@ -649,7 +649,12 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> {
649649 if obligation. predicate . is_global ( ) {
650650 // no type variables present, can use evaluation for better caching.
651651 // FIXME: consider caching errors too.
652- if infcx. predicate_must_hold_considering_regions ( obligation) {
652+ //
653+ // If the predicate is considered const, then we cannot use this because
654+ // it will cause false negatives in the ui tests.
655+ if !self . selcx . is_predicate_const ( obligation. predicate )
656+ && infcx. predicate_must_hold_considering_regions ( obligation)
657+ {
653658 debug ! (
654659 "selecting trait at depth {} evaluated to holds" ,
655660 obligation. recursion_depth
@@ -703,7 +708,12 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> {
703708 if obligation. predicate . is_global ( ) {
704709 // no type variables present, can use evaluation for better caching.
705710 // FIXME: consider caching errors too.
706- if self . selcx . infcx ( ) . predicate_must_hold_considering_regions ( obligation) {
711+ //
712+ // If the predicate is considered const, then we cannot use this because
713+ // it will cause false negatives in the ui tests.
714+ if !self . selcx . is_predicate_const ( obligation. predicate )
715+ && self . selcx . infcx ( ) . predicate_must_hold_considering_regions ( obligation)
716+ {
707717 return ProcessResult :: Changed ( vec ! [ ] ) ;
708718 } else {
709719 tracing:: debug!( "Does NOT hold: {:?}" , obligation) ;
0 commit comments