@@ -2739,7 +2739,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
2739
2739
| ObligationCauseCode :: ReferenceOutlivesReferent ( ..)
2740
2740
| ObligationCauseCode :: ObjectTypeBound ( ..) => { }
2741
2741
ObligationCauseCode :: RustCall => {
2742
- if let Some ( pred) = predicate. to_opt_poly_trait_pred ( )
2742
+ if let Some ( pred) = predicate. as_trait_clause ( )
2743
2743
&& Some ( pred. def_id ( ) ) == tcx. lang_items ( ) . sized_trait ( )
2744
2744
{
2745
2745
err. note ( "argument required to be sized due to `extern \" rust-call\" ` ABI" ) ;
@@ -3725,7 +3725,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
3725
3725
{
3726
3726
if let hir:: Expr { kind : hir:: ExprKind :: MethodCall ( _, rcvr, _, _) , .. } = expr
3727
3727
&& 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 ( )
3729
3729
&& let pred = failed_pred. map_bound ( |pred| pred. with_self_ty ( tcx, ty) )
3730
3730
&& self . predicate_must_hold_modulo_regions ( & Obligation :: misc (
3731
3731
tcx, expr. span , body_id, param_env, pred,
@@ -3816,7 +3816,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
3816
3816
&& let Some ( where_pred) = where_clauses. predicates . get ( * idx)
3817
3817
{
3818
3818
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 ( )
3820
3820
{
3821
3821
self . enter_forall ( where_pred, |where_pred| {
3822
3822
let failed_pred = self . instantiate_binder_with_fresh_vars (
@@ -3842,7 +3842,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
3842
3842
}
3843
3843
} )
3844
3844
} 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 ( )
3846
3846
&& let Some ( found) = failed_pred. skip_binder ( ) . term . ty ( )
3847
3847
{
3848
3848
type_diffs = vec ! [ Sorts ( ty:: error:: ExpectedFound {
0 commit comments