summaryrefslogtreecommitdiff
path: root/src/hir_expand
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-06-09 20:31:41 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-06-09 20:31:41 +0800
commita9f501bde9d8ff5e714d0ef2663177b0949f95cc (patch)
tree47189972d96bb44e2111e707987aabf75f9e3872 /src/hir_expand
parent8992eaa470e27ed3da396aed41ce741bc509bb0f (diff)
downloadmrust-a9f501bde9d8ff5e714d0ef2663177b0949f95cc.tar.gz
HIR - Sort trait impls too
Diffstat (limited to 'src/hir_expand')
-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),