]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_hir_typeck/src/method/mod.rs
Rollup merge of #104580 - notriddle:notriddle/issue-102354-hide-sugg, r=compiler...
[rust.git] / compiler / rustc_hir_typeck / src / method / mod.rs
index 1577eb666c847adf0c82e461b6d047827665d0a1..37336edd1fda59d6a513c283f5dfdf181bb0b760 100644 (file)
@@ -20,7 +20,7 @@
 use rustc_infer::infer::{self, InferOk};
 use rustc_middle::traits::ObligationCause;
 use rustc_middle::ty::subst::{InternalSubsts, SubstsRef};
-use rustc_middle::ty::{self, DefIdTree, GenericParamDefKind, ToPredicate, Ty, TypeVisitable};
+use rustc_middle::ty::{self, DefIdTree, GenericParamDefKind, Ty, TypeVisitable};
 use rustc_span::symbol::Ident;
 use rustc_span::Span;
 use rustc_trait_selection::traits;
@@ -209,7 +209,7 @@ pub fn lookup_method(
                     call_expr,
                     ProbeScope::TraitsInScope,
                 ) {
-                    Ok(ref new_pick) if new_pick.self_ty != pick.self_ty => {
+                    Ok(ref new_pick) if pick.differs_from(new_pick) => {
                         needs_mut = true;
                     }
                     _ => {}
@@ -220,7 +220,7 @@ pub fn lookup_method(
             let mut candidates =
                 match self.lookup_probe(segment.ident, self_ty, call_expr, ProbeScope::AllTraits) {
                     // If we find a different result the caller probably forgot to import a trait.
-                    Ok(ref new_pick) if new_pick.self_ty != pick.self_ty => {
+                    Ok(ref new_pick) if pick.differs_from(new_pick) => {
                         vec![new_pick.item.container_id(self.tcx)]
                     }
                     Err(Ambiguity(ref sources)) => sources
@@ -293,10 +293,11 @@ pub(super) fn obligation_for_method(
         let poly_trait_ref = ty::Binder::dummy(trait_ref);
         (
             traits::Obligation::misc(
+                self.tcx,
                 span,
                 self.body_id,
                 self.param_env,
-                poly_trait_ref.without_const().to_predicate(self.tcx),
+                poly_trait_ref.without_const(),
             ),
             substs,
         )
@@ -335,6 +336,7 @@ pub(super) fn obligation_for_op_method(
 
         (
             traits::Obligation::new(
+                self.tcx,
                 traits::ObligationCause::new(
                     span,
                     self.body_id,
@@ -346,7 +348,7 @@ pub(super) fn obligation_for_op_method(
                     },
                 ),
                 self.param_env,
-                poly_trait_ref.without_const().to_predicate(self.tcx),
+                poly_trait_ref.without_const(),
             ),
             substs,
         )
@@ -523,9 +525,10 @@ fn construct_obligation_for_trait(
             method_ty, obligation
         );
         obligations.push(traits::Obligation::new(
+            tcx,
             cause,
             self.param_env,
-            ty::Binder::dummy(ty::PredicateKind::WellFormed(method_ty.into())).to_predicate(tcx),
+            ty::Binder::dummy(ty::PredicateKind::WellFormed(method_ty.into())),
         ));
 
         let callee = MethodCallee { def_id, substs, sig: fn_sig };