From 9b7486b16d271e08d2cf41b62e376970c6b8d03f Mon Sep 17 00:00:00 2001 From: John Hodge Date: Mon, 3 Oct 2016 11:30:07 +0800 Subject: HIR Typecheck Expr - Add bounds from impl blocks as rules --- src/hir_typeck/expr_cs.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index 5d5f880d..be3e328b 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -449,6 +449,9 @@ namespace { } }; + // Add trait bounds for all impl and function bounds + apply_bounds_as_rules(context, sp, impl_ptr->m_params, cache.m_monomorph_cb); + return true; } @@ -2018,9 +2021,9 @@ namespace { // If the expected result type is still an ivar, nothing can be done // HACK: Add a possibility of the result type being ``Box<`data_ty`>`` - // - This only happens if the `owned_box` lang item is present + // - This only happens if the `owned_box` lang item is present and this node is a `box` operation const auto& lang_Boxed = this->context.m_crate.get_lang_item_path_opt("owned_box"); - if( ! lang_Boxed.m_components.empty() ) + if( ! lang_Boxed.m_components.empty() && node_ty == ::HIR::ExprNode_Emplace::Type::Boxer ) { // NOTE: `owned_box` shouldn't point to anything but a struct const auto& str = this->context.m_crate.get_struct_by_path(sp, lang_Boxed); -- cgit v1.2.3