summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-07-07 04:59:56 +1000
committerJohn Hodge <tpg@mutabah.net>2016-07-07 04:59:56 +1000
commitae5df84479553a3bb0dff7c0ebc85eb4305bd298 (patch)
treef1050a838676cd3544f2de52bc063ffef5b9522e /src
parent37fc78ec4ed2e248983a8b365ba98b8dd2bd3b20 (diff)
downloadmrust-ae5df84479553a3bb0dff7c0ebc85eb4305bd298.tar.gz
HIR Typecheck CS - Expect inner block of loop{} to yield ()
Diffstat (limited to 'src')
-rw-r--r--src/hir_typeck/expr_cs.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index 68d5c77e..79a4e8e6 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -349,8 +349,11 @@ namespace {
TRACE_FUNCTION_F(&node << " loop { ... }");
this->context.equate_types(node.span(), node.m_res_type, ::HIR::TypeRef::new_unit());
+ // TODO: This is more correct, but could cause variables to be falsely marked as !
+ //this->context.equate_types(node.span(), node.m_res_type, ::HIR::TypeRef::new_diverge());
this->context.add_ivars(node.m_code->m_res_type);
+ this->context.equate_types(node.span(), node.m_code->m_res_type, ::HIR::TypeRef::new_unit());
node.m_code->visit( *this );
}
void visit(::HIR::ExprNode_LoopControl& node) override