summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-08-06 12:31:07 +0800
committerJohn Hodge <tpg@mutabah.net>2016-08-06 12:31:07 +0800
commit697406729a0b1d3a49b12be66fda1c9d858af67a (patch)
tree2039361623b2f42347e4a7abe31d415a2645b295 /src
parent30ab1aa2ad4c8f817211571891ccf63cf04aae49 (diff)
downloadmrust-697406729a0b1d3a49b12be66fda1c9d858af67a.tar.gz
HIR Typecheck CS - Bound Self in UfcsKnown calls
Diffstat (limited to 'src')
-rw-r--r--src/hir_typeck/expr_cs.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index 9b81021f..305758e6 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -140,6 +140,7 @@ namespace {
/// (HELPER) Populate the cache for nodes that use visit_call
void visit_call_populate_cache(Context& context, const Span& sp, ::HIR::Path& path, ::HIR::ExprCallCache& cache)
{
+ TRACE_FUNCTION_FR(path, path);
assert(cache.m_arg_types.size() == 0);
const ::HIR::Function* fcn_ptr = nullptr;
@@ -184,7 +185,8 @@ namespace {
cache.m_fcn_params = &fcn.m_params;
cache.m_top_params = &trait.m_params;
- // TODO: Check/apply trait bounds (apply = closure arguments or fixed trait args)
+ // Add a bound requiring the Self type impl the trait
+ context.equate_types_assoc(sp, ::HIR::TypeRef(), e.trait.m_path, mv$(e.trait.m_params.clone().m_types), *e.type, "");
fcn_ptr = &fcn;
@@ -2014,8 +2016,8 @@ namespace {
check_type_resolved(sp, ty, top_type);
}
void check_type_resolved_path(const Span& sp, ::HIR::Path& path) const {
- //auto tmp = ::HIR::TypeRef(path.clone());
- auto tmp = ::HIR::TypeRef();
+ auto tmp = ::HIR::TypeRef(path.clone());
+ //auto tmp = ::HIR::TypeRef();
check_type_resolved_path(sp, path, tmp);
}
void check_type_resolved_path(const Span& sp, ::HIR::Path& path, const ::HIR::TypeRef& top_type) const {