about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorAdrian Taylor <adetaylor@chromium.org>2024-12-19 15:30:44 +0000
committerAdrian Taylor <adetaylor@chromium.org>2024-12-19 15:30:44 +0000
commit25a9d62211ad1b1a89951497952f9aa1ca332d01 (patch)
treecd87cadf099471200745043b92945eef607da31d /compiler
parenteedc229049b937a007a79ee6fc2801bfc484240e (diff)
downloadrust-25a9d62211ad1b1a89951497952f9aa1ca332d01.tar.gz
rust-25a9d62211ad1b1a89951497952f9aa1ca332d01.zip
Arbitrary self types v2: roll loop.
Just for slightly more concise code - no functional changes.

r? @wesleywiser
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 3b377076545..f07153afc06 100644
--- a/compiler/rustc_hir_typeck/src/method/probe.rs
+++ b/compiler/rustc_hir_typeck/src/method/probe.rs
@@ -1230,23 +1230,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));
+                                }
                             }
                         }
                     }