diff options
Diffstat (limited to 'compiler/rustc_trait_selection/src')
4 files changed, 13 insertions, 13 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 01804a448df..c1654f60f1c 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -2739,7 +2739,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { | ObligationCauseCode::ReferenceOutlivesReferent(..) | ObligationCauseCode::ObjectTypeBound(..) => {} ObligationCauseCode::RustCall => { - if let Some(pred) = predicate.to_opt_poly_trait_pred() + if let Some(pred) = predicate.as_trait_clause() && Some(pred.def_id()) == tcx.lang_items().sized_trait() { err.note("argument required to be sized due to `extern \"rust-call\"` ABI"); @@ -3725,7 +3725,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { { if let hir::Expr { kind: hir::ExprKind::MethodCall(_, rcvr, _, _), .. } = expr && let Some(ty) = typeck_results.node_type_opt(rcvr.hir_id) - && let Some(failed_pred) = failed_pred.to_opt_poly_trait_pred() + && let Some(failed_pred) = failed_pred.as_trait_clause() && let pred = failed_pred.map_bound(|pred| pred.with_self_ty(tcx, ty)) && self.predicate_must_hold_modulo_regions(&Obligation::misc( tcx, expr.span, body_id, param_env, pred, @@ -3816,7 +3816,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { && let Some(where_pred) = where_clauses.predicates.get(*idx) { if let Some(where_pred) = where_pred.as_trait_clause() - && let Some(failed_pred) = failed_pred.to_opt_poly_trait_pred() + && let Some(failed_pred) = failed_pred.as_trait_clause() { self.enter_forall(where_pred, |where_pred| { let failed_pred = self.instantiate_binder_with_fresh_vars( @@ -3842,7 +3842,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { } }) } else if let Some(where_pred) = where_pred.as_projection_clause() - && let Some(failed_pred) = failed_pred.to_opt_poly_projection_pred() + && let Some(failed_pred) = failed_pred.as_projection_clause() && let Some(found) = failed_pred.skip_binder().term.ty() { type_diffs = vec![Sorts(ty::error::ExpectedFound { diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs index c090cd70888..d693bac90dc 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs @@ -1417,7 +1417,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { }; let mut code = obligation.cause.code(); - let mut pred = obligation.predicate.to_opt_poly_trait_pred(); + let mut pred = obligation.predicate.as_trait_clause(); while let Some((next_code, next_pred)) = code.parent() { if let Some(pred) = pred { self.enter_forall(pred, |pred| { @@ -1481,16 +1481,16 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { return true; } - if let Some(error) = error.to_opt_poly_trait_pred() { + if let Some(error) = error.as_trait_clause() { self.enter_forall(error, |error| { elaborate(self.tcx, std::iter::once(cond)) - .filter_map(|implied| implied.to_opt_poly_trait_pred()) + .filter_map(|implied| implied.as_trait_clause()) .any(|implied| self.can_match_trait(error, implied)) }) - } else if let Some(error) = error.to_opt_poly_projection_pred() { + } else if let Some(error) = error.as_projection_clause() { self.enter_forall(error, |error| { elaborate(self.tcx, std::iter::once(cond)) - .filter_map(|implied| implied.to_opt_poly_projection_pred()) + .filter_map(|implied| implied.as_projection_clause()) .any(|implied| self.can_match_projection(error, implied)) }) } else { @@ -2415,8 +2415,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { return e; } err.note(format!("cannot satisfy `{predicate}`")); - let impl_candidates = self - .find_similar_impl_candidates(predicate.to_opt_poly_trait_pred().unwrap()); + let impl_candidates = + self.find_similar_impl_candidates(predicate.as_trait_clause().unwrap()); if impl_candidates.len() < 40 { self.report_similar_impl_candidates( impl_candidates.as_slice(), diff --git a/compiler/rustc_trait_selection/src/traits/object_safety.rs b/compiler/rustc_trait_selection/src/traits/object_safety.rs index b30f26f92f6..abb19c7efd8 100644 --- a/compiler/rustc_trait_selection/src/traits/object_safety.rs +++ b/compiler/rustc_trait_selection/src/traits/object_safety.rs @@ -653,7 +653,7 @@ fn object_ty_for_trait<'tcx>( let mut elaborated_predicates: Vec<_> = elaborate(tcx, [pred]) .filter_map(|pred| { debug!(?pred); - let pred = pred.to_opt_poly_projection_pred()?; + let pred = pred.as_projection_clause()?; Some(pred.map_bound(|p| { ty::ExistentialPredicate::Projection(ty::ExistentialProjection::erase_self_ty( tcx, p, diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs index 6d84523da8a..f4189ff0902 100644 --- a/compiler/rustc_trait_selection/src/traits/wf.rs +++ b/compiler/rustc_trait_selection/src/traits/wf.rs @@ -377,7 +377,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> { let item = self.item; let extend = |traits::PredicateObligation { predicate, mut cause, .. }| { - if let Some(parent_trait_pred) = predicate.to_opt_poly_trait_pred() { + if let Some(parent_trait_pred) = predicate.as_trait_clause() { cause = cause.derived_cause( parent_trait_pred, traits::ObligationCauseCode::WellFormedDerived, |
