summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-07-06 19:32:32 +1000
committerJohn Hodge <tpg@mutabah.net>2016-07-06 19:32:32 +1000
commit3ab4855c589b575afe2027614515c965fe2b82da (patch)
tree985878754f19d1d80fbd8609bde198eb747300fb /src
parent6d44c5e7d57dd270d06ecf81d6aed3111b4be406 (diff)
downloadmrust-3ab4855c589b575afe2027614515c965fe2b82da.tar.gz
HIR Typecheck CS - Don't bother coercing when both types are already equal
Diffstat (limited to 'src')
-rw-r--r--src/hir_typeck/expr_cs.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index 1d1e7eed..57bf90cd 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -2068,6 +2068,11 @@ namespace {
// - Deref
// - Unsize?
+ // If the types are already equal, no operation is required
+ if( context.m_ivars.types_equal(ty_dst, ty_src) ) {
+ return true;
+ }
+
// If the source is '_', we can't know yet
TU_IFLET(::HIR::TypeRef::Data, ty_src.m_data, Infer, r_e,
// - Except if it's known to be a primitive