summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-07-10 17:55:04 +1000
committerJohn Hodge <tpg@mutabah.net>2016-07-10 17:55:04 +1000
commit7c25ad66f817b2f34312fda8d96d8ba12f165f04 (patch)
tree387e37e0317a57fcf8b676593d9202164a9abf23
parent4acd7ffabe335884210ce3d65219c4b0999b88e1 (diff)
downloadmrust-7c25ad66f817b2f34312fda8d96d8ba12f165f04.tar.gz
HIR Typecheck CS - Cleaner debug output
-rw-r--r--src/hir_typeck/expr_cs.cpp5
-rw-r--r--src/hir_typeck/helpers.cpp18
2 files changed, 20 insertions, 3 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index 4714fa1f..820fd4ac 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -3028,6 +3028,9 @@ namespace {
TRACE_FUNCTION_F(i);
+ // TODO: Some cases lead to two possibilities that compare different (due to inferrence) but are actually the same.
+ // - The above dedup should probably be aware of the way the types are used.
+
if( ivar_ent.types_to.size() > 1 ) {
H::dedup_type_list(context, ivar_ent.types_to);
}
@@ -3051,7 +3054,7 @@ namespace {
context.equate_types(Span(), ty_l, ty_r);
}
else {
- DEBUG("- IVar " << ty_l << " not concretely known");
+ DEBUG("- IVar " << ty_l << " not concretely known {" << ivar_ent.types_from << "} and {" << ivar_ent.types_to << "}" );
}
ivar_ent.force_no = false;
diff --git a/src/hir_typeck/helpers.cpp b/src/hir_typeck/helpers.cpp
index a6ce091b..691b507e 100644
--- a/src/hir_typeck/helpers.cpp
+++ b/src/hir_typeck/helpers.cpp
@@ -252,10 +252,24 @@ void HMTypeInferrence::dump() const
unsigned int i = 0;
for(const auto& v : m_ivars) {
if(v.is_alias()) {
- DEBUG("#" << i << " = " << v.alias);
+ //DEBUG("#" << i << " = " << v.alias);
}
else {
- DEBUG("#" << i << " = " << *v.type);
+ DEBUG("#" << i << " = " << *v.type << FMT_CB(os,
+ bool open = false;
+ unsigned int i2 = 0;
+ for(const auto& v2 : m_ivars) {
+ if( v2.is_alias() && v2.alias == i ) {
+ if( !open )
+ os << " { ";
+ open = true;
+ os << "#" << i2 << " ";
+ }
+ i2 ++;
+ }
+ if(open)
+ os << "}";
+ ));
}
i ++ ;
}