about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-02-28 01:55:39 +0100
committerGitHub <noreply@github.com>2020-02-28 01:55:39 +0100
commit84f5bcc41dcc4d8ca54ea11c7d687c897cf92d61 (patch)
treecccdfd143b965741b9daa572044189d6d059cf28
parent350491da19cf92ffd4116e342eed1dc32a139704 (diff)
parentb6f05674508aa115b93e9855013b3f97a687eaee (diff)
downloadrust-84f5bcc41dcc4d8ca54ea11c7d687c897cf92d61.tar.gz
rust-84f5bcc41dcc4d8ca54ea11c7d687c897cf92d61.zip
Rollup merge of #69430 - matthiaskrgr:noloop, r=varkor
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 49f38d86d91..710f02cdedb 100644
--- a/src/librustc_typeck/astconv.rs
+++ b/src/librustc_typeck/astconv.rs
@@ -2439,10 +2439,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