X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_hir_typeck%2Fsrc%2Fmethod%2Fmod.rs;h=3f3af53d199b12918512a1597a9f7b1eb34532a5;hb=3142e6f0b179e53f2ef229bda2ad24e5f0f55bf9;hp=b15c086ffad5781f2b921dd61d5c97b31d8bb470;hpb=5e38e702aac61e1c1a243e6ee09d054bfdd71598;p=rust.git diff --git a/compiler/rustc_hir_typeck/src/method/mod.rs b/compiler/rustc_hir_typeck/src/method/mod.rs index b15c086ffad..3f3af53d199 100644 --- a/compiler/rustc_hir_typeck/src/method/mod.rs +++ b/compiler/rustc_hir_typeck/src/method/mod.rs @@ -209,7 +209,7 @@ pub fn lookup_method( ProbeScope::TraitsInScope, ) { Ok(ref new_pick) if pick.differs_from(new_pick) => { - needs_mut = true; + needs_mut = new_pick.self_ty.ref_mutability() != self_ty.ref_mutability(); } _ => {} } @@ -285,7 +285,7 @@ pub(super) fn obligation_for_method( self.var_for_def(span, param) }); - let trait_ref = ty::TraitRef::new(trait_def_id, substs); + let trait_ref = self.tcx.mk_trait_ref(trait_def_id, substs); // Construct an obligation let poly_trait_ref = ty::Binder::dummy(trait_ref); @@ -326,7 +326,7 @@ pub(super) fn obligation_for_op_method( self.var_for_def(span, param) }); - let trait_ref = ty::TraitRef::new(trait_def_id, substs); + let trait_ref = self.tcx.mk_trait_ref(trait_def_id, substs); // Construct an obligation let poly_trait_ref = ty::Binder::dummy(trait_ref);