summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2018-12-09 21:42:59 +0800
committerJohn Hodge <tpg@mutabah.net>2018-12-09 21:49:23 +0800
commit937b161b40dd6dfdaa0a55c1399b3af2d23227d7 (patch)
treedeacf9231812472ebf3ce334ee46a20eeebc53d7
parent6e16b6d9df92e7ec3222984502f580e46dae09f6 (diff)
downloadmrust-937b161b40dd6dfdaa0a55c1399b3af2d23227d7.tar.gz
HIR Typecheck Expr - Handle duplicate bounded options for types
-rw-r--r--src/hir_typeck/expr_cs.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index 13eabe9c..23ac0afd 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -4277,6 +4277,9 @@ void Context::possible_equate_type_bound(unsigned int ivar_index, const ::HIR::T
possible_ivar_vals.resize( ivar_index + 1 );
}
auto& ent = possible_ivar_vals[ivar_index];
+ for(const auto& e : ent.bounded)
+ if( e == t )
+ return ;
ent.bounded.push_back( t.clone() );
}
void Context::possible_equate_type_disable(unsigned int ivar_index, bool is_to) {
@@ -5392,6 +5395,7 @@ namespace {
for(auto& possible_impl : possible_impls)
{
const auto& best_impl = possible_impl.impl_ref;
+ // TODO: Handle duplicates (from overlapping bounds)
if( impl.overlaps_with(context.m_crate, best_impl) )
{
DEBUG("[check_associated] - Overlaps with existing - " << best_impl);