summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-10-22 19:28:45 +0800
committerJohn Hodge <tpg@mutabah.net>2016-10-22 19:29:08 +0800
commitb5cb5a870257bd87a377403278f6a0f8853e7d97 (patch)
treeddebd0188dc41fac4a38ade7ea6fc7ab2f8c9e1e
parentc0755f1d37b4e49815cf7c20a9ab27ff3f96dba0 (diff)
downloadmrust-b5cb5a870257bd87a377403278f6a0f8853e7d97.tar.gz
HIR Typecheck Expr - (minor) Comments about possible quirk with Unsize/CoerceUsized handling
-rw-r--r--src/hir_typeck/expr_cs.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index 091a6c56..1ebdd0c0 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -4445,6 +4445,8 @@ namespace {
// `Unsize<U> for T` means `T -> U`
if( v.trait == context.m_crate.get_lang_item_path(sp, "unsize") )
{
+ // TODO: Detect if this was a compiler-generated bound, or was actually in the code.
+
ASSERT_BUG(sp, v.params.m_types.size() == 1, "Incorrect number of parameters for Unsize");
const auto& src_ty = context.get_type(v.impl_ty);
const auto& dst_ty = context.get_type(v.params.m_types[0]);
@@ -4487,6 +4489,8 @@ namespace {
}
if( v.trait == context.m_crate.get_lang_item_path(sp, "coerce_unsized") )
{
+ // TODO: Detect if this was a compiler-generated bound, or was actually in the code.
+
// `CoerceUnsized<U> for T` means when T is found an U is expected, a coerce can happen
ASSERT_BUG(sp, v.params.m_types.size() == 1, "Incorrect number of parameters for Unsize");
const auto& src_ty = context.get_type(v.impl_ty);
@@ -4592,6 +4596,8 @@ namespace {
}
else if( v.trait == context.m_crate.get_lang_item_path(sp, "unsize") )
{
+ // TODO: Detect if this was a compiler-generated bound, or was actually in the code.
+
ASSERT_BUG(sp, v.params.m_types.size() == 1, "Incorrect number of parameters for Unsize");
const auto& src_ty = context.get_type(v.impl_ty);
const auto& dst_ty = context.get_type(v.params.m_types[0]);