summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-11-16 17:32:44 +0800
committerJohn Hodge <tpg@mutabah.net>2016-11-16 17:32:44 +0800
commit0d379740543283318f303074e0e46ad1a3a30c9e (patch)
treec71f23975e3fc8d74bcb0ec2c9ebd816430bf64b
parent1ecea3af716a85d9bb5730f774a38894eb27c79b (diff)
downloadmrust-0d379740543283318f303074e0e46ad1a3a30c9e.tar.gz
HIR Typecheck Expr - Emit an assoc bound for fuzzy impl selection
- Fixes errors where one of the fetched types contains a placeholder.
-rw-r--r--src/hir_typeck/expr_cs.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index cb2439c7..1f7d6bb6 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -2100,6 +2100,7 @@ namespace {
::HIR::TypeRef possible_res_type;
unsigned int count = 0;
bool rv = this->context.m_resolve.find_trait_impls(node.span(), lang_Index, trait_pp, ty, [&](auto impl, auto cmp) {
+ DEBUG("[visit(_Index)] cmp=" << cmp << " - " << impl);
possible_res_type = impl.get_type("Output");
count += 1;
if( cmp == ::HIR::Compare::Equal ) {
@@ -2115,8 +2116,7 @@ namespace {
}
else if( count == 1 ) {
assert( possible_index_type != ::HIR::TypeRef() );
- this->context.equate_types(node.span(), node.m_index->m_res_type, possible_index_type);
- this->context.equate_types(node.span(), node.m_res_type, possible_res_type);
+ this->context.equate_types_assoc(node.span(), node.m_res_type, lang_Index, mv$(trait_pp), ty, "Output", false);
break;
}
else if( count > 1 ) {