about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2024-12-20 01:36:48 -0500
committerGitHub <noreply@github.com>2024-12-20 01:36:48 -0500
commite6aea1afe920f0146699ff35e6a83e61b100d006 (patch)
tree8d6969592fd2ab711a0bb36e4af5f8ddc5181d7e /compiler
parentef47ba091d27b3cb41b0daa5ef20a640ded3b2d0 (diff)
parent25a9d62211ad1b1a89951497952f9aa1ca332d01 (diff)
downloadrust-e6aea1afe920f0146699ff35e6a83e61b100d006.tar.gz
rust-e6aea1afe920f0146699ff35e6a83e61b100d006.zip
Rollup merge of #134521 - adetaylor:roll-loop, r=wesleywiser
Arbitrary self types v2: roll loop.

Just for slightly more concise code - no functional changes.

r? `@wesleywiser`

Part of #44874
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_hir_typeck/src/method/probe.rs27
1 files changed, 10 insertions, 17 deletions
diff --git a/compiler/rustc_hir_typeck/src/method/probe.rs b/compiler/rustc_hir_typeck/src/method/probe.rs
index bc304c2b687..fb599558490 100644
--- a/compiler/rustc_hir_typeck/src/method/probe.rs
+++ b/compiler/rustc_hir_typeck/src/method/probe.rs
@@ -1229,23 +1229,16 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
                 if let Some(by_value_pick) = by_value_pick {
                     if let Ok(by_value_pick) = by_value_pick.as_ref() {
                         if by_value_pick.kind == PickKind::InherentImplPick {
-                            if let Err(e) = self.check_for_shadowed_autorefd_method(
-                                by_value_pick,
-                                step,
-                                self_ty,
-                                hir::Mutability::Not,
-                                track_unstable_candidates,
-                            ) {
-                                return Some(Err(e));
-                            }
-                            if let Err(e) = self.check_for_shadowed_autorefd_method(
-                                by_value_pick,
-                                step,
-                                self_ty,
-                                hir::Mutability::Mut,
-                                track_unstable_candidates,
-                            ) {
-                                return Some(Err(e));
+                            for mutbl in [hir::Mutability::Not, hir::Mutability::Mut] {
+                                if let Err(e) = self.check_for_shadowed_autorefd_method(
+                                    by_value_pick,
+                                    step,
+                                    self_ty,
+                                    mutbl,
+                                    track_unstable_candidates,
+                                ) {
+                                    return Some(Err(e));
+                                }
                             }
                         }
                     }