From f297f56e767ea440672b4d5996770afd478401b2 Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Tue, 27 Feb 2018 17:30:20 +0900 Subject: [PATCH] Bring back ParamEnv deduplication --- src/librustc/traits/project.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index 1778a8d693a83..1cf92d5a78669 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