to_opt_poly_X_pred -> as_X_clause

This commit is contained in:
Michael Goulet 2024-05-15 12:58:41 -04:00
parent 550d1b4fb6
commit 2025e44ef8
9 changed files with 23 additions and 23 deletions

View file

@ -2250,7 +2250,7 @@ fn try_report_async_mismatch<'tcx>(
for error in errors {
if let ObligationCauseCode::WhereClause(def_id, _) = *error.root_obligation.cause.code()
&& def_id == async_future_def_id
&& let Some(proj) = error.root_obligation.predicate.to_opt_poly_projection_pred()
&& let Some(proj) = error.root_obligation.predicate.as_projection_clause()
&& let Some(proj) = proj.no_bound_vars()
&& infcx.can_eq(
error.root_obligation.param_env,

View file

@ -1350,12 +1350,12 @@ fn check_impl<'tcx>(
// We already have a better span.
continue;
}
if let Some(pred) = obligation.predicate.to_opt_poly_trait_pred()
if let Some(pred) = obligation.predicate.as_trait_clause()
&& pred.skip_binder().self_ty() == trait_ref.self_ty()
{
obligation.cause.span = hir_self_ty.span;
}
if let Some(pred) = obligation.predicate.to_opt_poly_projection_pred()
if let Some(pred) = obligation.predicate.as_projection_clause()
&& pred.skip_binder().self_ty() == trait_ref.self_ty()
{
obligation.cause.span = hir_self_ty.span;