summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-07-17 17:16:21 +0800
committerJohn Hodge <tpg@mutabah.net>2016-07-17 17:16:21 +0800
commit394fb3ccec788e2c3abff511d142a9573bc783a6 (patch)
tree8e8098adde7981a75d44fecb021507f0885b7bfa /src
parent9b639d59895a125973ffaf2e7dfd2c3bad50cc97 (diff)
downloadmrust-394fb3ccec788e2c3abff511d142a9573bc783a6.tar.gz
HIR - Fix bad trait path creation
Diffstat (limited to 'src')
-rw-r--r--src/hir_conv/resolve_ufcs.cpp5
-rw-r--r--src/hir_typeck/expr_cs.cpp6
-rw-r--r--src/hir_typeck/helpers.cpp2
3 files changed, 8 insertions, 5 deletions
diff --git a/src/hir_conv/resolve_ufcs.cpp b/src/hir_conv/resolve_ufcs.cpp
index 303926bd..c7302a0b 100644
--- a/src/hir_conv/resolve_ufcs.cpp
+++ b/src/hir_conv/resolve_ufcs.cpp
@@ -203,7 +203,8 @@ namespace {
auto trait_path_g = ::HIR::GenericPath( mv$(sp) );
for(unsigned int i = 0; i < trait.m_params.m_types.size(); i ++ ) {
//trait_path_g.m_params.m_types.push_back( ::HIR::TypeRef(trait.m_params.m_types[i].m_name, i) );
- trait_path_g.m_params.m_types.push_back( ::HIR::TypeRef() );
+ //trait_path_g.m_params.m_types.push_back( ::HIR::TypeRef() );
+ trait_path_g.m_params.m_types.push_back( trait.m_params.m_types[i].m_default.clone() );
}
return trait_path_g;
}
@@ -211,7 +212,7 @@ namespace {
// TODO: This code may end up generating paths without the type information they should contain
bool locate_in_trait_and_set(::HIR::Visitor::PathContext pc, const ::HIR::GenericPath& trait_path, const ::HIR::Trait& trait, ::HIR::Path::Data& pd) {
if( locate_item_in_trait(pc, trait, pd) ) {
- pd = get_ufcs_known(mv$(pd.as_UfcsUnknown()), make_generic_path(trait_path.m_path, trait), trait);
+ pd = get_ufcs_known(mv$(pd.as_UfcsUnknown()), trait_path.clone() /*make_generic_path(trait_path.m_path, trait)*/, trait);
return true;
}
// Search supertraits (recursively)
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index 5c3ac0ec..195e5e66 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -291,15 +291,17 @@ namespace {
// --- Monomorphise the argument/return types (into current context)
for(const auto& arg : fcn.m_args) {
+ DEBUG("Arg " << arg.first << ": " << arg.second);
if( monomorphise_type_needed(arg.second) ) {
- cache.m_arg_types.push_back( /*this->context.expand_associated_types(sp, */monomorphise_type_with(sp, arg.second, monomorph_cb)/*)*/ );
+ cache.m_arg_types.push_back( /*this->context.expand_associated_types(sp, */monomorphise_type_with(sp, arg.second, monomorph_cb, false)/*)*/ );
}
else {
cache.m_arg_types.push_back( arg.second.clone() );
}
}
+ DEBUG("Ret " << fcn.m_return);
if( monomorphise_type_needed(fcn.m_return) ) {
- cache.m_arg_types.push_back( /*this->context.expand_associated_types(sp, */monomorphise_type_with(sp, fcn.m_return, monomorph_cb)/*)*/ );
+ cache.m_arg_types.push_back( /*this->context.expand_associated_types(sp, */monomorphise_type_with(sp, fcn.m_return, monomorph_cb, false)/*)*/ );
}
else {
cache.m_arg_types.push_back( fcn.m_return.clone() );
diff --git a/src/hir_typeck/helpers.cpp b/src/hir_typeck/helpers.cpp
index 29f4b1bb..516bd40d 100644
--- a/src/hir_typeck/helpers.cpp
+++ b/src/hir_typeck/helpers.cpp
@@ -105,7 +105,7 @@ bool monomorphise_type_needed(const ::HIR::TypeRef& tpl)
{
::HIR::PathParams rv;
for( const auto& ty : tpl.m_types)
- rv.m_types.push_back( monomorphise_type_with(sp, ty, callback) );
+ rv.m_types.push_back( monomorphise_type_with(sp, ty, callback, allow_infer) );
return rv;
}
::HIR::GenericPath monomorphise_genericpath_with(const Span& sp, const ::HIR::GenericPath& tpl, t_cb_generic callback, bool allow_infer)