summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-10-28 12:34:36 +0800
committerJohn Hodge <tpg@mutabah.net>2016-10-28 12:34:36 +0800
commit609b469f75d77edf7e03dcdccc8caac28bef4e6f (patch)
treec820fc2cf7fabd4034a0bae64bb2dd0ca148b3d2 /src
parentd1d9cba0a6c66570f0f05eaf957927980f8a0336 (diff)
downloadmrust-609b469f75d77edf7e03dcdccc8caac28bef4e6f.tar.gz
HIR Typecheck Expr - Equate Self type in UfcsInherent method selection
Diffstat (limited to 'src')
-rw-r--r--src/hir_typeck/expr_cs.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index 768bc8fe..19cfee35 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -466,6 +466,14 @@ namespace {
// Add trait bounds for all impl and function bounds
apply_bounds_as_rules(context, sp, impl_ptr->m_params, cache.m_monomorph_cb);
+ // Equate `Self` and `impl_ptr->m_type` (after monomorph)
+ {
+ ::HIR::TypeRef tmp;
+ const auto& impl_ty_m = (monomorphise_type_needed(impl_ptr->m_type) ? tmp = monomorphise_type_with(sp, impl_ptr->m_type, cache.m_monomorph_cb) : impl_ptr->m_type);
+
+ context.equate_types(sp, *e.type, impl_ty_m);
+ }
+
return true;
}