From df7c1e4aae0d847fab34f50d24a8b881ce29d03a Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 3 Sep 2017 18:18:49 +0800 Subject: HIR Typecheck - Equate associated types in trait object unsize --- src/hir_typeck/expr_cs.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index f4504364..cb40e6b4 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -4478,6 +4478,19 @@ namespace { { context.equate_types(sp, trait.m_params.m_types[i], args.m_types[i]); } + for(const auto& tyb : dep->m_trait.m_type_bounds) + { + auto ty = best_impl.get_type(tyb.first.c_str()); + if( ty != ::HIR::TypeRef() ) + { + context.equate_types(sp, tyb.second, ty); + } + else + { + // Error? Log? ... + DEBUG("Associated type " << tyb.first << " not present in impl, can't equate"); + } + } } } -- cgit v1.2.3