summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-10-03 11:30:07 +0800
committerJohn Hodge <tpg@mutabah.net>2016-10-03 11:30:07 +0800
commit9b7486b16d271e08d2cf41b62e376970c6b8d03f (patch)
tree518107bfb39e7a155acba3821b22d0a765026406
parentd41e4106940d0170cd16677479366f513f64bcca (diff)
downloadmrust-9b7486b16d271e08d2cf41b62e376970c6b8d03f.tar.gz
HIR Typecheck Expr - Add bounds from impl blocks as rules
-rw-r--r--src/hir_typeck/expr_cs.cpp7
1 files changed, 5 insertions, 2 deletions
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);