summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-04-20 18:09:28 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-04-20 18:09:28 +0800
commitf96264846fdc79aa220e46b12afcb25f1d12b135 (patch)
treea7b83dab386a580877e47ef09b9fa4ef0ea5bc08
parent8fc434a3fd67e1e72de1f92c1ba3a8df726c170b (diff)
downloadmrust-f96264846fdc79aa220e46b12afcb25f1d12b135.tar.gz
Typecheck Expressions - Little tweaks
-rw-r--r--src/hir_typeck/expr_cs.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index 641dddc5..6ad8032b 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -7631,7 +7631,8 @@ namespace {
}
DEBUG("possible_tys = " << possible_tys);
- if( possible_tys.size() == 1 && n_ivars == 0 )
+ // If there's only one option (or one real option w/ ivars, if in fallback mode) - equate it
+ if( possible_tys.size() == 1 && (n_ivars == 0 || !honour_disable) )
{
const auto& new_ty = *possible_tys[0].ty;
DEBUG("Only " << new_ty << " is an option");
@@ -7810,7 +7811,7 @@ namespace {
context.equate_types(sp, ty_l, *good_types.front());
return true;
}
- else if( good_types.size() > 0 && !honour_disable )
+ else if( good_types.size() > 0 && !honour_disable && good_types.size() > n_good_ints )
{
auto typ_is_borrow = [&](const ::HIR::TypeRef* typ) { return typ->m_data.is_Borrow(); };
// NOTE: We want to select from sets of primitives and generics (which can be interchangable)