summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-07-07 05:44:51 +1000
committerJohn Hodge <tpg@mutabah.net>2016-07-07 05:44:51 +1000
commitf9c65798a26800cb2a24f827bcf8943e4a68775a (patch)
tree117872b3ab3cca0111786bbcd93cae1477d5161e /src
parentf066bcb98c61febd82ae24498d4fbb71d89e45df (diff)
downloadmrust-f9c65798a26800cb2a24f827bcf8943e4a68775a.tar.gz
HIR Typecheck CS - Remove coercion if types are equal
Diffstat (limited to 'src')
-rw-r--r--src/hir_typeck/expr_cs.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index 789f8509..d0f15d10 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -2312,6 +2312,10 @@ namespace {
const auto& ty_r = context.m_ivars.get_type(node_ptr->m_res_type);
TRACE_FUNCTION_F(v << " - " << ty << " := " << ty_r);
+ if( context.m_ivars.types_equal(ty, ty_r) ) {
+ return true;
+ }
+
// TODO: CoerceUnsized trait
// 1. Check that the source type can coerce