about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2020-02-24 15:50:40 +0100
committerMatthias Krüger <matthias.krueger@famsik.de>2020-02-27 15:01:56 +0100
commitb6f05674508aa115b93e9855013b3f97a687eaee (patch)
tree9b8e243b852ffe2055d757191c8d2d843b311832
parenta8437cf213ac1e950b6f5c691c4d2a29bf949bcd (diff)
downloadrust-b6f05674508aa115b93e9855013b3f97a687eaee.tar.gz
rust-b6f05674508aa115b93e9855013b3f97a687eaee.zip
librustc_typeck: remove loop that never actually loops
-rw-r--r--src/librustc_typeck/astconv.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs
index 78c05a51e4f..6b7f85bcffb 100644
--- a/src/librustc_typeck/astconv.rs
+++ b/src/librustc_typeck/astconv.rs
@@ -2358,10 +2358,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
                     break;
                 }
             }
-            for binding in segment.generic_args().bindings {
+
+            // Only emit the first error to avoid overloading the user with error messages.
+            if let [binding, ..] = segment.generic_args().bindings {
                 has_err = true;
                 Self::prohibit_assoc_ty_binding(self.tcx(), binding.span);
-                break;
             }
         }
         has_err