about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc/traits/project.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs
index 1778a8d693a..1cf92d5a786 100644
--- a/src/librustc/traits/project.rs
+++ b/src/librustc/traits/project.rs
@@ -142,8 +142,11 @@ impl<'tcx> ProjectionTyCandidateSet<'tcx> {
                 true
             }
             Single(current) => {
-                // No duplicates are expected.
-                assert_ne!(current, &candidate);
+                // Duplicates can happen inside ParamEnv. In the case, we
+                // perform a lazy deduplication.
+                if current == &candidate {
+                    return false;
+                }
                 // Prefer where-clauses. As in select, if there are multiple
                 // candidates, we prefer where-clause candidates over impls.  This
                 // may seem a bit surprising, since impls are the source of