@@ -2739,7 +2739,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
27392739 | ObligationCauseCode :: ReferenceOutlivesReferent ( ..)
27402740 | ObligationCauseCode :: ObjectTypeBound ( ..) => { }
27412741 ObligationCauseCode :: RustCall => {
2742- if let Some ( pred) = predicate. to_opt_poly_trait_pred ( )
2742+ if let Some ( pred) = predicate. as_trait_clause ( )
27432743 && Some ( pred. def_id ( ) ) == tcx. lang_items ( ) . sized_trait ( )
27442744 {
27452745 err. note ( "argument required to be sized due to `extern \" rust-call\" ` ABI" ) ;
@@ -3725,7 +3725,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
37253725 {
37263726 if let hir:: Expr { kind : hir:: ExprKind :: MethodCall ( _, rcvr, _, _) , .. } = expr
37273727 && let Some ( ty) = typeck_results. node_type_opt ( rcvr. hir_id )
3728- && let Some ( failed_pred) = failed_pred. to_opt_poly_trait_pred ( )
3728+ && let Some ( failed_pred) = failed_pred. as_trait_clause ( )
37293729 && let pred = failed_pred. map_bound ( |pred| pred. with_self_ty ( tcx, ty) )
37303730 && self . predicate_must_hold_modulo_regions ( & Obligation :: misc (
37313731 tcx, expr. span , body_id, param_env, pred,
@@ -3816,7 +3816,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
38163816 && let Some ( where_pred) = where_clauses. predicates . get ( * idx)
38173817 {
38183818 if let Some ( where_pred) = where_pred. as_trait_clause ( )
3819- && let Some ( failed_pred) = failed_pred. to_opt_poly_trait_pred ( )
3819+ && let Some ( failed_pred) = failed_pred. as_trait_clause ( )
38203820 {
38213821 self . enter_forall ( where_pred, |where_pred| {
38223822 let failed_pred = self . instantiate_binder_with_fresh_vars (
@@ -3842,7 +3842,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
38423842 }
38433843 } )
38443844 } else if let Some ( where_pred) = where_pred. as_projection_clause ( )
3845- && let Some ( failed_pred) = failed_pred. to_opt_poly_projection_pred ( )
3845+ && let Some ( failed_pred) = failed_pred. as_projection_clause ( )
38463846 && let Some ( found) = failed_pred. skip_binder ( ) . term . ty ( )
38473847 {
38483848 type_diffs = vec ! [ Sorts ( ty:: error:: ExpectedFound {
0 commit comments