summaryrefslogtreecommitdiff
path: root/src/hir_expand/closures.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/hir_expand/closures.cpp')
-rw-r--r--src/hir_expand/closures.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/hir_expand/closures.cpp b/src/hir_expand/closures.cpp
index b4ab564c..f09917de 100644
--- a/src/hir_expand/closures.cpp
+++ b/src/hir_expand/closures.cpp
@@ -50,16 +50,18 @@ namespace {
{
for(auto& impl : new_trait_impls)
{
+ ::std::vector<::HIR::TraitImpl>* trait_impl_list;
switch(impl.first)
{
case ::HIR::ExprNode_Closure::Class::Once:
- crate.m_trait_impls[crate.get_lang_item_path(sp, "fn_once")].push_back( mv$(impl.second) );
- break;
+ trait_impl_list = &crate.m_trait_impls[crate.get_lang_item_path(sp, "fn_once")].get_list_for_type_mut(impl.second.m_type);
+ if(0)
case ::HIR::ExprNode_Closure::Class::Mut:
- crate.m_trait_impls[crate.get_lang_item_path(sp, "fn_mut" )].push_back( mv$(impl.second) );
- break;
+ trait_impl_list = &crate.m_trait_impls[crate.get_lang_item_path(sp, "fn_mut" )].get_list_for_type_mut(impl.second.m_type);
+ if(0)
case ::HIR::ExprNode_Closure::Class::Shared:
- crate.m_trait_impls[crate.get_lang_item_path(sp, "fn" )].push_back( mv$(impl.second) );
+ trait_impl_list = &crate.m_trait_impls[crate.get_lang_item_path(sp, "fn" )].get_list_for_type_mut(impl.second.m_type);
+ trait_impl_list->push_back( mv$(impl.second) );
break;
case ::HIR::ExprNode_Closure::Class::NoCapture: {
assert(impl.second.m_methods.size() == 1);
@@ -68,7 +70,7 @@ namespace {
// NOTE: This should always have a name
const auto& path = impl.second.m_type.m_data.as_Path().path.m_data.as_Generic().m_path;
DEBUG("Adding type impl " << path);
- auto list_it = crate.m_named_type_impls.insert( ::std::make_pair(path, ::std::vector<::HIR::TypeImpl>()) ).first;
+ auto list_it = crate.m_type_impls.named.insert( ::std::make_pair(path, ::std::vector<::HIR::TypeImpl>()) ).first;
list_it->second.push_back( ::HIR::TypeImpl {
mv$(impl.second.m_params),
mv$(impl.second.m_type),